crsf-wg / crsf

MIT License
114 stars 7 forks source link

Definition of an extended package #8

Closed boris-gu closed 7 months ago

boris-gu commented 7 months ago

Your wiki says:
Extended Packet Format
[sync] [len] [type] [[ext dest] [ext src] [payload] [crc8-ba]] [crc8]

But CRSF_FRAMETYPE_DEVICE_PING does not use crc8-ba.

HOST: EE 04 28 00 EA 54
EE = dest
04 = len
28 = type
00 EA = extended packet
        00 = CRSF_ADDRESS_BROADCAST (extended destination)
        EA = CRSF_ADDRESS_RADIO_TRANSMITTER (extended source)
54 = CRC

Where is the truth?

sk8board commented 7 months ago

According to this webpage, the message is extended format which should use CRC poly 0xBA. https://github.com/crsf-wg/crsf/wiki/Message-Format

But according to this CRC calculator, the example uses CRC poly 0xD5 https://crccalc.com/

I have spent quite a bit of time to understand the material in this Wiki and have determined either there are errors, the work is incomplete, or both. Since this is a work in progress, I assume both.

Therefore, until this work is complete, I recommend to reverse engineer the messages that you receive to verify the CRC info that is provided on this Wiki.

boris-gu commented 7 months ago

Thank you. I plan to implement a library for ESP-IDF. I have already worked on this, but only RC_CHANNELS_PACKET, now I want to include other packages in the library.

I used to use the old ELRS wiki and this file, I don't remember where I found it anymore. CRSF_Rev07.pdf

CapnBry commented 7 months ago

The documentation in the wiki has been copied over from my page on the ExpressLRS wiki and much of it was written before I knew as much as I do now (docs show how things are instead of how they should be). Specifically, the packets starting with 0xEE are wrong (should be 0xC8) and all the extended frames should have the extra CRC but they do not. I am bringing them up to date as I have time.

I am not sure there are any implementations that check the extended CRC, usually implementations just check the frame CRC and only pull the bytes they need from the extended part (which is good because ExpressLRS does not include them). New implementations should be aware that there should be a CRC-BA there, but tolerant if the frame does not include it I guess?