CRC32 calculation example for serial frame
Payload string (before framing):
command=/check_status&data=eyJkb2N1bWVudEV4dElEIjoiT1JERVItMTAwMSJ9&sign=ZWIyMmVmNWNhY2Q3ZWViZjJmMzc2ZjZlYWQzMWI4ZGM5NDllM2M4Mg==
CRC input rules:
- Encode payload as UTF-8 bytes.
- Compute
CRC32over payload bytes. - Replace CRC bytes
0x03with0x20before writing CRC to frame.
Computed CRC:
crc32_hex=61387ab8CRC32_BEbytes =61 38 7a b8
Final frame layout:
02 <payload_utf8_bytes> 61 38 7a b8 03
Where:
02isSTX03isETX