Sending Can messages

I need to send Can messages from Jetson Xavier with fixed periodicity for example 100ms.
May anyone explain the steps?

I tried to make a timer to loop on the same command which sends the CAN message each 100ms however, it sends like 17 messages then the CAN freezes.

Hi mahmoud,
You can use watch -n 0.1 cansend …
You said CAN freezes, please tell me what is the output or logs you see during freeze. Also which BSP version you are using on Xavier?


Hello shgarg,

using this command, the lowest periodicity i can get is 100 ms, how can i get 10 ms or 1 ms?.

The BSP version is attached below.

I figured out when the problem happens but i don’t know the solution, the CAN on the kit freezes when i try to send a can message to the vehicle CAN Bus which is flooded with lots of messages.

However, if i send it to a different device; it works as the bus isn’t flooded with messages.

This happens to the kit only and not related to the vehicle bus, if i try to send a message on the bus from a different device, it works.

You can use cangen command with -g option to provide gap in milli-seconds.
Use cangen --help for more info.
For freezing issue, there should be some error log msg if sending from Xavier. If you are not able to find anything, provide me the output of:
ip -d -s link show can0 (if you are using can1 then replace it by can1).


Hello Shubi,

I guess I was sending a message with a conflicting id that is why it froze.

right now, I am trying to send using cangen but i am confused i can’t find where i can put the can ID from the examples.

I want to send a message with ID 555 and data 1122334455667788 for example each 10 ms or 1 ms.

You can use this for 10ms
cangen -I 555 -D 1122334455667788 -g 10

for 1 ms:
cangen -I 555 -D 1122334455667788 -g 1