Skip to main content
Associate
Jan 11, 2025 5:20 AM UTC
Solved

stm32f469i CAN Not Working

Hi all,

               I am trying to establish a CAN communication between stm32f469i and PC.  I have used Cube MX to generate CAN driver.  I am not getting any data from the stm32f469i. I have also attached code for the reference.

This topic has been closed for replies.
MHoll.2
MHoll.2Best answer
Senior III
Jan 11, 2025 2:42 PM UTC

This is not a setting that is recommended. The sample point is between Seg1 and Seg2, and should be at about 75% to 90% (CanOpen has normaly 87.5%). Please us a Can Bus timing calculator (for example http://www.bittiming.can-wiki.info/ ) to get better timing parameters.

Did you check with a oscilloscope if the STM32 is transmitting anything?

Wenn debugging your code, did it enter the error handler? if yes were?

4 replies

MHoll.2
Senior III
Jan 11, 2025 2:03 PM UTC

Did You set the apropriet bitrate in CubeMX?

in MX_CAN2_Init() the settings are strange:

 hcan2.Instance = CAN2;
 hcan2.Init.Prescaler = 120;
 hcan2.Init.Mode = CAN_MODE_NORMAL;
 hcan2.Init.SyncJumpWidth = CAN_SJW_1TQ;
 hcan2.Init.TimeSeg1 = CAN_BS1_1TQ;
 hcan2.Init.TimeSeg2 = CAN_BS2_1TQ;
mvpAuthor
Associate
Jan 11, 2025 2:10 PM UTC

Hello,

 

              Thanks for your response. Yes the bit rate was configured as 125000 bps.

 

mvp_0-1736604567345.png

 

MHoll.2
MHoll.2Best answer
Senior III
Jan 11, 2025 2:42 PM UTC

This is not a setting that is recommended. The sample point is between Seg1 and Seg2, and should be at about 75% to 90% (CanOpen has normaly 87.5%). Please us a Can Bus timing calculator (for example http://www.bittiming.can-wiki.info/ ) to get better timing parameters.

Did you check with a oscilloscope if the STM32 is transmitting anything?

Wenn debugging your code, did it enter the error handler? if yes were?

mvpAuthor
Associate
Jan 11, 2025 3:40 PM UTC

Hi,

    Thanks for your valuable support. As you have suggested configured Seg1 and Seg2 from http://www.bittiming.can-wiki.info/

mvp_0-1736609629127.png

mvp_1-1736609689903.png

mvp_3-1736609987327.png

 

Now it is working Perfectly :

mvp_2-1736609748129.png

Also attached the updated code. Thank you once again .