I want to let two STM32 communicate via CAN bus. One as transmitter and the other as receiver. In order to do that, I combined each with a MCP2551 transceiver. As long as the CAN operating Mode was set to LOOPBACK everything seemed to be good: The controller were able to send CAN messages, receive them(their own), and send it via UART to my PC (worked well). As next step I wanted to let them communicate with eachother. I set the operating mode of them to NORMAL. While the transmitter was sending the same messages as in Loopback Mode, and the Receiver was sending nothing (just waiting for any messages to come in), nothing happened. A measurement showed constant 2,5V at the transceivers output (Recessive State), and constant 3,3V at the STM32 TX (PA12). Anyone an idea what I'm doing wrong?
Electronic – Problem with CAN on STM32
canstm32
Related Topic
- Electronic – STM32 HAL_CAN_Transmit always returns TIMEOUT (HAL_CAN_STATE_TIMEOUT)
- Electronic – arduino – Simple CAN bus design, communication issues
- Electronic – STM32F3 CAN Hardware not Entering Init Mode
- Electronic – CAN communication not working
- Electronic – STM32 CAN bus Rx interrupt only triggers in loopback mode
Best Answer
It doesn't work that way. CAN is a peer to peer network. Any node can send a message at any time, and all the other nodes on the network receive the message.
This is clearly a firmware bug. The signal isn't getting to the CAN bus transceiver chip, let alone the CAN bus itself.
Things to be aware of:
On a real bus, this terminates the line to avoid reflections. However, this "termination" is still required even when the whole system is lumped. The resistance functions as a pull-together to keep the bus in the recessive state when not explicitly driven to the dominant state. This termination is not optional, even when it has nothing to do with terminating the transmission line.