#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# CAN message

Could someone confirm the bit order for little endian used in the equation please? Do we count from the left most bit as One or Right most bit as One?

• the endianess of the CAN message is whatever the vehicle manufacturer defines.

RaceChrono does the math in whatever the device native endianess is, so for iOS/iPhone, it is little. when you read the CAN frame, you need to know whether the source is big or little and use the the correct bytesToUintLe() or bytesToUint() methods from https://racechrono.com/support/equations
• IT WAS NOT ACTUALLY AN ANSWER TO MY QUESTION.
• edited September 2023
OKAY. are you asking what is the definition of little/big endian?

and again, from an equation standpoint, the answer is it depends on the architecture of the device racechrono is running in. your original statement is sort of wrong, it that it implies that equations are done in little endian. equations are done in native endian.

iOS and android mostly using the same ARM chips are little endian, so yea equations are are in little endian on those architectures.

big endian is more "human" readable, it that the most significant byte, is on the left to right, ie, the most significant byte of a word at the smallest memory address and the least significant byte at the largest.

for example the number 1234567
big is stored: 0x01234567
little is stored 0x67452301

CAN messages themselves could be little or big, so you need to convert them to the native format (which is little endian for things racechrono runs on currently)

finally to your question about left most bit vs right most bit, its neither, its right most byte vs left most byte. byte not bits. the byte ordering is different with big vs little, not the bit ordering.
• There's functions for both endianness. The definition of endianness is complicated, so please just try which works for you. Much easier that way.