send long data stream in smaller data stream / send more than 8 bytes in CAN

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Hi guys

What is the best way to send more than 8 bytes in CAN? I do know I need to send those in multiple frames, and somehow I need to put them together in the receiver. What information I need to encode in the data field so I can re-assemble the data?

Thanks guys
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Or connect a CAN transceiver on a UART and roll my own protocol? Anyone tried that?? That will be interesting...
 

Papabravo

Joined Feb 24, 2006
21,225
The technique you are looking for is called fragmentation. You can check the DeviceNet specification for a description of how they do it. Basically the first byte in the data field consists of a two bit flag and a six bit count. The flag bits are encoded as "First Fragment", "Middle Fragment", "Last Fragment", and "Fragment Acknowledge". The six bit field is a count which starts at zero and rolls over to zero again after 64 fragments. When the consumer consumes a fragment it answers with a "Fragment Ack" and the current fragment counter.

http://www.rtaautomation.com/technologies/devicenet/

Of course you can roll your own protocol, that is what numerous people did. Before you do that it might be worth your while to study one or more previous efforts.

A CAN transceiver on a UART has no particular advantage over an RS-485 transceiver and it has several drawbacks.
 
Last edited:
Top