Difference between revisions of "CanServo/Protocol/LongMessage"

From HITEC_HELP
Jump to navigation Jump to search
Line 5: Line 5:
== Long Message ==
== Long Message ==


* 1개의 패킷으로 보내지 못할 정도로 긴 메시지를 여러개의 패킷으로 보낼수 있는 방식입니다.
* This is a way to send a message that is too long to be sent in a single packet as multiple packets.
** 물론 1개 패킷으로도 보낼수 있습니다.
** Of course, you can also send it in one packet.


* This content refers to the message format of UAVCAN.
* This content refers to the message format of UAVCAN.
Line 17: Line 17:
** [[Code/CRC16]]
** [[Code/CRC16]]


* 전송
* Transmission method
** 보낼 메시지의 길이를 확인하여, 1개 패킷으로 보낼 수 없다면, CRC16을 계산하여 메시지 끝에 추가합니다.
** Check the length of the message to be sent, and if it cannot be sent in one packet, calculate CRC16 and add it to the end of the message.
*** CRC16 계산 시작 값은 0xFFFF (-1) 입니다.
*** The starting value for CRC16 calculation is 0xFFFF (-1).
** 앞 일부를 잘라, Tail Byte를 붙여 1개의 패킷으로 보내는 것을 반복합니다.
** Repeat the process of cutting from the front, attaching the Tail Byte, and sending it as one packet.
*** 이때, (Tail Byte를 포함한 길이가) 8 바이트를 초과하는 경우에는, 정확한 길이를 첫 바이트에 넣습니다.
*** At this time, if the length (including Tail Byte) exceeds 8 bytes, the exact length is placed in the first byte.
** 주의: FD가 아닌 경우에는, 최대 8바이트이므로, 7 바이트까지 가능합니다.
** NOTE: If it is not an FD, the maximum is 8 bytes, so it can be up to 7 bytes.
*** FD인 경우에는 최대 64바이트이므로, 길이 첫 바이트를 제외하면, 62 바이트까지 가능합니다.
*** In the case of FD, the maximum is 64 bytes, so excluding the first byte of length, it can be up to 62 bytes.


=== CAN 2.0 ===
=== CAN 2.0 ===
Line 29: Line 29:
=== CAN-FD ===
=== CAN-FD ===


* CAN-FD는 data가 64바이트까지 확장됩니다.
* CAN-FD data is expanded up to 64 bytes.
** 0~8, 12, 16, 20, 24, 32, 48, 64
** 0~8, 12, 16, 20, 24, 32, 48, 64



Revision as of 09:53, 26 February 2026

Up

Long Message

  • This is a way to send a message that is too long to be sent in a single packet as multiple packets.
    • Of course, you can also send it in one packet.
  • This content refers to the message format of UAVCAN.
    • Thanks to UAVCAN
  • Note:
    • CRC16 : byte order : low byte first, little endian
  • Transmission method
    • Check the length of the message to be sent, and if it cannot be sent in one packet, calculate CRC16 and add it to the end of the message.
      • The starting value for CRC16 calculation is 0xFFFF (-1).
    • Repeat the process of cutting from the front, attaching the Tail Byte, and sending it as one packet.
      • At this time, if the length (including Tail Byte) exceeds 8 bytes, the exact length is placed in the first byte.
    • NOTE: If it is not an FD, the maximum is 8 bytes, so it can be up to 7 bytes.
      • In the case of FD, the maximum is 64 bytes, so excluding the first byte of length, it can be up to 62 bytes.

CAN 2.0

CAN-FD

  • CAN-FD data is expanded up to 64 bytes.
    • 0~8, 12, 16, 20, 24, 32, 48, 64

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