cancel
Showing results for 
Search instead for 
Did you mean: 

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

mr_vineet
Associate II

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!!


22 REPLIES 22

>>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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

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.


SofLit
ST Employee

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.

 

 

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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.

To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

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

If you have any reference for connection video or code?

Yes, I am setting clock to HSE with Crystal oscillator.

Hello,

It seems they are a purchased modules. But anyway you need to:

  1. Check the Rs pin connection continuity: Pin 8 connected to the ground?
  2. Are you sure about the correct GPIOs? are the GPIO pins connected to the transceiver are the ones configured in your code (CAN_TX/CAN_RX alternate functions)?
  3. Are you sure about the correct connections CAN_TX/CAN_RX with the transceivers?
  4. Check if there are some activity on CAN_TX/CAN_RX pins with an oscilloscope or a logic analyzer.
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.

It needs to connect Rs to Ground for both the transreceiver??

And All the other point I have checked properly.


@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.