cancel
Showing results for 
Search instead for 
Did you mean: 

Sometimes, data does not flow on the CAN bus.

coffeelover
Associate

Hi.

In my program, I am transmitting the following CAN IDs at a 20ms cycle:

1. 0x080
2. 0x100
3. 0x15B
4. 0x215
5. 0x315
6. 0x415
7. 0x515
8. 0x40D

When continuing the periodic transmission, I have observed that sometimes No 4-8 do not flow on the CAN bus and are not transmitted periodically.
I confirmed that when changing No 4-8 as follows, all data is transmitted periodically on the CAN bus:

1. 0x080
2. 0x100
3. 0x15B
4. 0x215→0x15C *changed
5. 0x315→0x15D *changed
6. 0x415→0x15E *changed
7. 0x515→0x15F *changed
8. 0x40D→0x160 *changed

Could you please explain why changing the CAN IDs allows for successful transmission?

I appreciate your assistance.

2 REPLIES 2
ELABI.1
ST Employee

Hi @coffeelover,

 

The problem you encountered is likely related to the priority of messages in the transmission boxes (Tx mailboxes) of the CAN controller.

According to the CAN protocol, the priority of messages is determined by the message identifier. The message with the lowest identifier has the highest priority:

ELABI1_0-1746022258325.jpeg

By changing the identifiers to lower values, the messages gain higher priority, allowing for successful transmission.

Additionally, the transmission duration of 20 ms might be short, so maybe it's necessary to space out the transmissions also it is recommended to ensure that at least one transmission mailbox (Tx mailbox) is free to transmit a message.

Thank you.

ELABI.1

 

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.

Karl Yamashita
Principal

More than likely due to how you're transmitting, checking HAL return status and if you are queuing your CAN messages. Show your relevant code.

Don't worry, I won't byte.
TimerCallback tutorial! | UART and DMA Idle tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.