Fab
Fab

Reputation: 21

How to send 16 bytes hexadecimal value with can-utils cansend?

I'm trying to send a 16 bytes hexadecimal via cansend from the can-utils package on Ubuntu 16.04.3 LTS.

The commands i tried:

cansend can0 100#000a000b000c000d
cansend can0 100#000a.000b.000c.000d

But my canbus logger shows me that 8 bytes values are sent by cansend.

So my Question: Is it even possible to send 16 bytes hexadecimal values per cansend or does someone know a workaround?

Upvotes: 2

Views: 1713

Answers (2)

Andrei Kovacs
Andrei Kovacs

Reputation: 171

You can try sending to two IDs one after the other, in which case the end point should listen to those both and reconstruct the message.

Another solution could be to use CANOpen, which allows for more complex messaging on top of the CAN Bus. Basically it does just what I've said above, but of course at a more complex level.

Upvotes: 0

Benoît
Benoît

Reputation: 416

The CAN standard doesn't allow the transmission of payload of more than 8 bytes. This is why cansend only sent 8 bytes out of 16.

There are a few solutions to your problem:
- Send your payload with two cansend commands
- Use the ISO-TP(a protocol allowing to send packet with a size greater than 8 bytes over CAN) kernel module that allows you to do ISO-TP with SocketCAN (how to)
- Use CAN FD, cansend support this protocol without having anything to install but if your bus only support CAN, you cannot use this solution

Upvotes: 1

Related Questions