cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f469i CAN Not Working

mvp
Associate II

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.

1 ACCEPTED SOLUTION

Accepted Solutions

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?

View solution in original post

4 REPLIES 4
MHoll.2
Senior

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;
mvp
Associate II

Hello,

 

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

 

mvp_0-1736604567345.png

 

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?

mvp
Associate II

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 .