Skip to main content
Visitor II
October 30, 2024
Solved

Two nucleo boards (stm32f446re) and (stm32h723zg) communicate through CAN in Classic mode.

  • October 30, 2024
  • 3 replies
  • 1905 views

Hello, 

I am attempting to have a two stm32 nucleo boards communicate by sending and receiving can messages.  My goal is to have the PA5 LED of the STM32 f446re blink when a can message is received. I know that the canbus must be configured to classical can which the baud rate must match both boards. The two boards I am using are the stm32 f446re and the stm32 h723zg. Currently, I suspect an electrical issue as I have been running a two 220 ohm resistors in parallel with the CAN_H and CAN_L lines, but when in a recessive state the CANH and CANL both read 2.2V and fail to change when in the dominant state. However, I want to ensure that the software is also not the issue. I am also using two waveshare SN65HVD230 can transceivers as well. 


Any help is appreciated, and I have attached a picture of the set up (ignore the 7 segment) as well as each project's codebase. 

    This topic has been closed for replies.
    Best answer by mƎALLEm

    After checking your RCC clock config it seems you are configuring the HSE for Crystal/Resonator while these crystals on both Nucleo boards are not present. And I'm pretty sure your program didn't overpass HAL_RCC_ClockConfig(). See this thread.

    Now, you need to refer to the boards' schematics:

    Nucleo-F446RE schematics:

    SofLit_2-1730390264330.png

    Your HSE config is set to Crystal/Resonator:

    SofLit_3-1730390295556.png

    SofLit_4-1730390345242.png

    Nucleo-H723ZI schematics:

    SofLit_5-1730390462031.png

    Your HSE config is set to Crystal/Resonator:

    SofLit_6-1730390564422.png

     

    So for the Nucleo board you need to use HSE in Bypass mode:

    SofLit_7-1730390661982.png

    As the external crystal is unavailable on these boards, the clock is generated from the STLINK MCO output.

    For Nucleo-H723 (featuring STLINK-V3) you need to review my article in this link to configure STLINK MCO frequency output before going ahead.

    For NucleoF4 there is nothing to configure on the STLINK (STLINK-V2).

    Hope it helps.

    3 replies

    Technical Moderator
    October 31, 2024

    Hello @MichaelRosol and welcome to the community.

    First thing to check is the transceiver RS pin:

    SofLit_0-1730371675282.png

     

    Super User
    October 31, 2024

    The golden rule with this kind of thing is not to try to do both ends of the link at once!

    When you do that, you can't tell whether the problem is with your "sender", or with your "receiver" - or both!

    So make your life easier by concentrating on one end of the link at a time, and using some known-good device as the other end.

     

    PS:

    https://community.st.com/t5/stm32-mcus-boards-and-hardware/i2c/m-p/668411/highlight/true#M18743

    https://community.st.com/t5/automotive-mcus/seeking-guidance-establishing-spi-communication-between/m-p/661736/highlight/true#M6318

    https://community.st.com/t5/stm32-mcus-embedded-software/communication-between-two-stm32-boards/m-p/633879/highlight/true#M44945

    https://community.st.com/t5/stm32-mcus-products/how-to-control-one-stm32-using-another-stm32-via-uart-usart/m-p/83112/highlight/true#M10134

    #BothEnds

    Technical Moderator
    October 31, 2024

    He could start with Loopback mode and validate the communication then move on with Normal mode.

    mƎALLEmAnswer
    Technical Moderator
    October 31, 2024

    After checking your RCC clock config it seems you are configuring the HSE for Crystal/Resonator while these crystals on both Nucleo boards are not present. And I'm pretty sure your program didn't overpass HAL_RCC_ClockConfig(). See this thread.

    Now, you need to refer to the boards' schematics:

    Nucleo-F446RE schematics:

    SofLit_2-1730390264330.png

    Your HSE config is set to Crystal/Resonator:

    SofLit_3-1730390295556.png

    SofLit_4-1730390345242.png

    Nucleo-H723ZI schematics:

    SofLit_5-1730390462031.png

    Your HSE config is set to Crystal/Resonator:

    SofLit_6-1730390564422.png

     

    So for the Nucleo board you need to use HSE in Bypass mode:

    SofLit_7-1730390661982.png

    As the external crystal is unavailable on these boards, the clock is generated from the STLINK MCO output.

    For Nucleo-H723 (featuring STLINK-V3) you need to review my article in this link to configure STLINK MCO frequency output before going ahead.

    For NucleoF4 there is nothing to configure on the STLINK (STLINK-V2).

    Hope it helps.