CAN Transmit Buffer Size

Support forum for users of the M1 Build

CAN Transmit Buffer Size

Postby rntechnologies on Wed Jan 02, 2019 1:39 pm

Hi Guys,
Just wondering if anyone can advise the length of the CAN transmit buffer?
I have managed to hit transmit overrun errors within a project that I have been working on and I can't seem to find the limitations documented anywhere.
Regards,
Ryan
User avatar
rntechnologies
Pro User
 
Posts: 79
Joined: Tue Aug 07, 2018 8:45 am
Location: Australia

Re: CAN Transmit Buffer Size

Postby DarrenR on Tue Mar 17, 2020 3:56 pm

The Tx buffer is 32 messages long per CAN bus.
The 32 messages is regardless of the number of handles you use.

As soon as the TxMessage function is called the message is put on the queue to transmit as soon as the bus is idle.
So if you were to queue up say 40 messages in one script, with a 1Mbit bus and no competing traffic, you'll see about 38 of the 40 messages as the time it takes to load 38 messages, 6 messages have already been transmitted. But you can't rely on this because traffic from other nodes may keep the bus busy while the M1 is trying to empty it's queue.
If you have a bunch of scripts writing messages at different rates, say 100Hz, 50Hz and 10Hz, remember on the cycle when the 10Hz runs, the 50 and 100Hz has also queued up messages before it so the total number of messages on all cycles will be queued on the slowest event. But it is generally safe to go over the 32 message limit in this case and a lot of other code has had to run between the first queued and the last so often the queue clears enough to have 40 - 50 messages in this case. But it's never guaranteed.

Or the correct way to increase the output is to stagger the messages, so run a script at 200Hz, Tx half of the set on one cycle and the other half on the next cycle. This method could Tx 6400 messages/s without risk of overflowing the buffer, provided the bus is not saturated.
Darren Reynolds
MoTeC Research Centre - Melbourne, Australia.
User avatar
DarrenR
MoTeC
 
Posts: 176
Joined: Thu May 01, 2008 1:15 pm
Location: Melbourne, Australia


Return to M1 Build

Who is online

Users browsing this forum: No registered users and 3 guests