Skip to main content
Explorer
January 11, 2025
Solved

stm32f469i CAN Not Working

  • January 11, 2025
  • 3 replies
  • 956 views

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.
    Best answer by MHoll.2

    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?

    3 replies

    Graduate II
    January 11, 2025

    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
    Explorer
    January 11, 2025

    Hello,

     

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

     

    mvp_0-1736604567345.png

     

    MHoll.2Answer
    Graduate II
    January 11, 2025

    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
    Explorer
    January 11, 2025

    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 .