Big-Endian CAN mapping
-
- Posts: 235
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 20 times
- Been thanked: 56 times
Big-Endian CAN mapping
I'm looking at the big-endian CAN RX support with the intention of adding TX mapping support. The way the RX mapping doesn't make a lot of sense to me. It seems that the bit-order is reversed for the entire frame. If I look at Savvy CAN it is a lot more rational in that the byte order is reversed for the field itself but the position within a frame remains standard and unchanged. If there was a mix of big and little endian mappings on a device it would be easy to get in a muddle especially when working with established tools like Savvy CAN.
- johu
- Site Admin
- Posts: 6027
- Joined: Thu Nov 08, 2018 10:52 pm
- Location: Kassel/Germany
- Has thanked: 203 times
- Been thanked: 1161 times
- Contact:
Re: Big-Endian CAN mapping
Hmm, the bit order shouldn't be changed at all, just the byte order:
I think it should be consistent with SavvyCAN that the position now specifies the "end" of the data item.
So little endian bit 0, length 16 becomes big endian bit 16, length -16
Or am I overlooking something?
viewtopic.php?t=4468
Code: Select all
word = (bptr[0] << 24) | (bptr[1] << 16) | (bptr[2] << 8) | bptr[3];
So little endian bit 0, length 16 becomes big endian bit 16, length -16
Or am I overlooking something?
viewtopic.php?t=4468
Support R/D and forum on Patreon: https://patreon.com/openinverter - Subscribe on odysee: https://odysee.com/@openinverter:9
-
- Posts: 235
- Joined: Mon Jan 18, 2021 12:39 pm
- Location: Edinburgh, Scotland, UK
- Has thanked: 20 times
- Been thanked: 56 times
Re: Big-Endian CAN mapping
The arithmetic reversing the position was confusing me...and I hadn't even started drinking. Sorry.