Skip to main content
Explorer II
April 11, 2024
Question

CAN Bus doesn't work in normal mode between two MCUs

  • April 11, 2024
  • 4 replies
  • 6812 views

Hello,
Hope you all doing well..!!

I am using two microcontrollers i.e., for transmitting data I have to use STM32F407VET6 and for receiving I have to use STM32F407VGT6 also I have to connect MCP2551 CAN Transceiver. I am transmitting data from one board and receiving data from another board through CAN Bus Protocol Communication

However, the data is not transmitted and received. I have properly checked the hardware connections and terminated the bus at both ends with 120-ohm resistors.

IDE: STM32CubeIDE

Which step should I follow for communication between boards?

Thank You in advance!!


    This topic has been closed for replies.

    4 replies

    Graduate II
    April 11, 2024

    >>Which step should I follow for communication between boards?

    The F407 hardware side should work.

    Guess you'll want to start debugging things.

    Check register settings and clocks. Perhaps inspect the error/status flags to better understand what IS happening.

    You could test single nodes in Loop-back mode, also check the CAN-TX pin with a scope. Observe data and timing.

    mr_vineetAuthor
    Explorer II
    April 11, 2024

    I can already test the loopback mode with both boards separately and it works properly.

    I am using breakpoints and status flags for debugging but I can't rectify the problems. and also I have crosschecked many times with the configuration and clock.


    Technical Moderator
    April 11, 2024

    Also what is the clock source you set for the system clock? HSI or HSE?

    Need to select HSE with an external crustal otherwise you risk you have some troubles in the communication.

    Technical Moderator
    April 11, 2024

    What about Rs pin voltage level? How did you connect that tranceiver's pin? this pin is to put the tranceiver in a stanby mode. So you can't send/receive anything on the bus.

    So it should be at least tied it to the ground:

    SofLit_0-1712863545784.png

    Read Rs section in the datasheet.

     

     

    mr_vineetAuthor
    Explorer II
    April 12, 2024

    I have connected transreceiver like this. How can I connect Rs Pin to ground?

    If you have any reference for connection video or code?

    Super User
    April 12, 2024

    @mr_vineet wrote:

    I have connected transceiver like this. How can I connect Rs Pin to ground?

     


    So you're using some 3rd-party module?

    Then you need to check the schematic of that module.

    Graduate II
    April 17, 2024

    The RS pin is already grounded through a 4.7k resistor. 

    Show a diagram on how you've connected each of the pins on the CAN module to your STM32F407. Is this a custom board? Do the two STM32F407 have a ground reference between them or are they isolated from each other besides just the 2 CAN wires? 

    Technical Moderator
    April 17, 2024

    The RS pin is already grounded through a 4.7k resistor. 


    According to the schematics? Do you have it?

    mr_vineetAuthor
    Explorer II
    April 26, 2024

    I had to check with the logic analyser it's showing can_error.

    Technical Moderator
    April 26, 2024

    can_error? How?

    Could you please share the analyser CAN frames screenshots of CAN_TX of the transmitter and CAN_RX of the receiver?