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

Discussion in 'Embedded Systems and Microcontrollers' started by bug13, Oct 13, 2016.

  1. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    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
     
  2. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    Or something like CAN but it can send more data than 8 bytes.
     
  3. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    Or connect a CAN transceiver on a UART and roll my own protocol? Anyone tried that?? That will be interesting...
     
  4. Papabravo

    Expert

    Feb 24, 2006
    10,136
    1,786
    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: Oct 14, 2016
    bug13 and JohnInTX like this.
Loading...