cancel
Showing results for 
Search instead for 
Did you mean: 

CAN RECEIVER NODE not working with STM32CUBEIDE and registers are not getting updated..

Reshma
Associate II

0690X00000BvVNxQAN.jpgHello friends..

I am currently working on STM32F446RE-NUCLEO boards and trying to set up a CAN link between two nucleo boards.

I have configured the CAN1 peripheral on one Nucleo as Transmitter using STM32Cubemx(Version: 5.1.0) and other as receiver....

Transmitter: 

I have configured CAN1 peripheral (PA11--Rx,PA12--Tx) on one board,can transceiver used is MCP2551..

I am using the code provided by Udemy course (https://www.udemy.com/course/microcontroller-programming-stm32-timers-pwm-can-bus-protocol/)..

I am using STM32CubeIDE(Version: 1.1.0) for building my project..

I have set APB clock as 25MHz using CubeMX and Can baud rate as 500kbps using the CAN BIT TIMING (using the site refered on udemy course:http://www.bittiming.can-wiki.info/)

On building the Transmitter code ,Its working fine ...Since the registers are correctly configured ...The TXM bit is high in MSR register denoting the node as transmitter ,The BTR register is updated with the baud rate that i configured,

The data registers TDT0R shows DLC bits correctly,TDL0R and TDH0R shows the data bytes correctly.

The ESR register shows the TEC bits as 128 (that means the transmitter error counter exceeds 127 denoting error),the LEC bits show 3 (denoting acknowledgement error)

I have attached my project with this post...The hardware setup pics are also attached below..

https://drive.google.com/drive/folders/1SvDHZUV3x-bOrZf3ZDVg3JvtaQMb26EA?usp=sharing

Receiver:

The problem is on the receiver side ....The code provided by the course does'nt update the Receiver registers at all...

The RXM bit in MSR register is low, RI0R register shows some junk values,the RDT0R(Stdid ,Dlc bits are junk) ,RDL0R(lower data bytes are also junk),RDH0R(higher data bytes are also junk) 

So my question is that the code provided updates the registers???

Should I call any other receive function to update the registers???

NOTE:The hardware is working fine...Since I was able to setup a proper link using MBED OS online compiler .

I confirmed that the receiver is working fine by looking at the serial monitor and led blinking..I was able to capture 

the received data on oscilloscope with acknowledgement on the CAN Bus .

So the problem is with the STM32CubeIDE if the receive functions aren't able to configure the registers...Does the data go till the Receive CAN controller???

We need ur help to solve this problem as soon as possible..Any help will be really appreciated..Thank you in advance. 

0690X00000BvVLhQAN.jpg

1 REPLY 1
Reshma
Associate II

Sorry for a long post ......We are badly stuck here ....Anyone can help with this?