2
\$\begingroup\$

I have configured the CAN module in a STM32F207 to transmit at 1 Mbit/s. The program is such that it will transmit the same CAN frame for every 2 ms. I observe that even if the code is not executing the transmit function, the data is continuously coming on the CAN port, unless I clear all the mailboxes.

How can I overcome this situation?

\$\endgroup\$
8
\$\begingroup\$

CAN modules will retransmit until they see an acknowledgement, so you need at least one other CAN device on the same bus with the same baud rate settings in receive mode. In CAN, the acknowledgement is done inside the ACK bit towards the end of the frame, rather than as a separate message.

More details are in the paper Introduction to the Controller Area Network (CAN) from Texas Instruments.

It is also important to follow the rules for the terminating resistors, especially at high data rates and/or long cables, but even at lower rates and shorter cables. For example, I have noticed that I can get away with one terminator with a few meters of cable at 125 kbaud, and it will not work with no terminators. As the cable gets longer, it becomes necessary to have the two usual terminators. Obviously this is more critical at 1 Mbaud.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ Shouldn't the device's error counter shut it up after 16 failed attempts? \$\endgroup\$
    – Nick T
    Jun 29 '12 at 8:48
  • 2
    \$\begingroup\$ I've definitely seen infinite retry from Microchip CAN devices when there's nothing else on the bus (with the same baud rate). \$\endgroup\$
    – Martin
    Jun 29 '12 at 9:12
  • \$\begingroup\$ I have a receiving node connected to the CAN Bus with the same baud rate settings \$\endgroup\$
    – Vivek V
    Jun 29 '12 at 10:21
  • \$\begingroup\$ @Martin what does/does not constitute a failed transmission for the sake of the error counter? Been a while since I dealt with CAN. \$\endgroup\$
    – Nick T
    Jun 29 '12 at 16:20
  • \$\begingroup\$ @NickT it shuts up after error frames. They keep retransmitting until acknowledge or empty mailbox. \$\endgroup\$
    – Jeroen3
    Aug 18 '17 at 11:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.