You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to checksum data that isn't an integer multiple of 8 bits in length.
I'm working on an interface library for a SPI device that uses CRC to validate frames on the SPI bus. The frames are made up of fields that don't start and end on byte boundaries.
Here's a diagram showing what i mean:
The microcontroller performs a SPI transfer of 6+n bytes. The first two bytes sent by the micro contain the command (zero-padded on the left). The next two bytes contain a 15-bit checksum of the command, with a 0 in the LSB.
The device receives the command and validates it with the checksum. If that passes it sends n bytes of data, followed by a two byte trailer consisting of 6 bits of "command count" and 10 bits of checksum covering the n payload bytes and the 6 bits of "command count".
As far as i can tell, there's not a way in crc-rs to compute a checksum that doesn't cover an integer number of bytes.
It's easy enough to implement my own amateurish crc code to do this, but it'd be nice if i could just use your awesome library.
I'd be happy to try to implement this in crc-rs if you think it'd be a useful addition.
The text was updated successfully, but these errors were encountered:
I need to checksum data that isn't an integer multiple of 8 bits in length.
I'm working on an interface library for a SPI device that uses CRC to validate frames on the SPI bus. The frames are made up of fields that don't start and end on byte boundaries.
Here's a diagram showing what i mean:
The microcontroller performs a SPI transfer of
6+n
bytes. The first two bytes sent by the micro contain the command (zero-padded on the left). The next two bytes contain a 15-bit checksum of the command, with a 0 in the LSB.The device receives the command and validates it with the checksum. If that passes it sends
n
bytes of data, followed by a two byte trailer consisting of 6 bits of "command count" and 10 bits of checksum covering then
payload bytes and the 6 bits of "command count".As far as i can tell, there's not a way in
crc-rs
to compute a checksum that doesn't cover an integer number of bytes.It's easy enough to implement my own amateurish crc code to do this, but it'd be nice if i could just use your awesome library.
I'd be happy to try to implement this in
crc-rs
if you think it'd be a useful addition.The text was updated successfully, but these errors were encountered: