Difference between revisions of "CanServo/Protocol/LongMessage"

From HITEC_HELP
Jump to navigation Jump to search
 
(36 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Long Message ==
== Long Message ==
* 각 패킷마다 Tail Byte가 있어서, 1개 혹은 여러개의 패킷으로 보낼 수 있는 방식입니다.
* This content refers to the message format of UAVCAN.
** Thanks to UAVCAN


* Note:
* Note:
** ID2, CRC16 : byte order : low byte first, little endian
** CRC16 : byte order : low byte first, little endian


* Reference:
* Reference:
Line 9: Line 14:
=== CAN 2.0 ===
=== CAN 2.0 ===


* The first step is to calculate the CRC16 of the message and add it to the end to create the content to be sent.
* Packaging the message to be sent.
* Send (maximum) 7 bytes extracted from the content to be sent and a Check Byte.
** If the message to be sent is 8 bytes or more, CRC16 is added.
 
* Packet's Data Format
** < Data : max 7 byte, cut from packed Message >, <Tail Byte>
 
* Messages less than 8 bytes long are transmitted as one packet.
 
* CRC starting value is 0xFFFF (-1)
 
=== CAN-FD ===
 
* CAN-FD는 data가 64바이트까지 확장됩니다.
** 0~8, 12, 16, 20, 24, 32, 48, 64
 
* Packaging the message to be sent.
** If the message to be sent is 63 bytes or more, CRC16 is added.
** 메시지의 길이가 62바이트 이하이면, crc16을 붙이지 않고, single packet으로 전송


* Multi Packet's Data Format
* packet data format:
** < Data : max 7 byte, cut from 'Message + CRC16' >, <Check Byte>
** 8바이트를 초과하는 경우에는 첫 바이트에 전송 데이터 길이가 들어갑니다.
** Check Byte
** data len <= 7: < data: max 7 bytes >, < tail byte >
*** bit 7 = 1, if first packet
** data len >= 8, len <= 62: < data len : 1 byte >, < data: len byte >, < tail byte >
*** bit 6 = 1, if last packet
*** bit 5 = Toggle, first packet = 1, toggle bit on each packet
*** bit 4:0 = Seq, 0 ~ 31, inc 1 on each message


=== FD-CAN ===
=== Tail Byte ===


* Under construction !
* Tail Byte
** bit 7 = first packet
** bit 6 = last packet
** bit 5 = 1 if first packet, toggle bit on each packet
** bit 4:0 = Seq, 0 ~ 31, inc 1 on each message

Latest revision as of 07:35, 5 June 2025

Long Message

  • 각 패킷마다 Tail Byte가 있어서, 1개 혹은 여러개의 패킷으로 보낼 수 있는 방식입니다.
  • This content refers to the message format of UAVCAN.
    • Thanks to UAVCAN
  • Note:
    • CRC16 : byte order : low byte first, little endian

CAN 2.0

  • Packaging the message to be sent.
    • If the message to be sent is 8 bytes or more, CRC16 is added.
  • Packet's Data Format
    • < Data : max 7 byte, cut from packed Message >, <Tail Byte>
  • Messages less than 8 bytes long are transmitted as one packet.
  • CRC starting value is 0xFFFF (-1)

CAN-FD

  • CAN-FD는 data가 64바이트까지 확장됩니다.
    • 0~8, 12, 16, 20, 24, 32, 48, 64
  • Packaging the message to be sent.
    • If the message to be sent is 63 bytes or more, CRC16 is added.
    • 메시지의 길이가 62바이트 이하이면, crc16을 붙이지 않고, single packet으로 전송
  • packet data format:
    • 8바이트를 초과하는 경우에는 첫 바이트에 전송 데이터 길이가 들어갑니다.
    • data len <= 7: < data: max 7 bytes >, < tail byte >
    • data len >= 8, len <= 62: < data len : 1 byte >, < data: len byte >, < tail byte >

Tail Byte

  • Tail Byte
    • bit 7 = first packet
    • bit 6 = last packet
    • bit 5 = 1 if first packet, toggle bit on each packet
    • bit 4:0 = Seq, 0 ~ 31, inc 1 on each message