union {
float f;
uint32_t i;
} floatToUint;
floatToUint.f = 1.234f; // 0x3f9df3b6
flexcan_frame_t txFrame;
txFrame.id = FLEXCAN_ID_STD(TX_MB_ID);
txFrame.format = (uint8_t)kFLEXCAN_FrameFormatStandard;
txFrame.type = (uint8_t)kFLEXCAN_FrameTypeData;
txFrame.length = sizeof(floatToUint)
txFrame.dataWord0 = floatToUint.i; // 0x3f9df3b6
FLEXCAN_TransferSendBlocking(CAN2, TX_MESSAGE_BUFFER_NUM, &txFrame)
Hello,
To clarify:
All ARM cores are running in little endian, so in the example I posted above `txFrame.dataWord0 = floatToUint.i` the data is passed to the SDK in little endian format however the FlexCAN controller sends it over the CAN bus in big endian format as I showed in the logic analyser trace.
I can translate the endianness of all data sent and received from the FlexCAN controller, however my question was whether there is a way to switch the FlexCAN controller to use little endian across the CAN bus?
Hello,
Peripherals always assume little-endian-aligned data arrives or
departs on their 32-bit APB.
So, maybe ARM core support both big and little ending, but the peripherals only support little ending.
Regards
Hello,
To clarify:
All ARM cores are running in little endian, so in the example I posted above `txFrame.dataWord0 = floatToUint.i` the data is passed to the SDK in little endian format however the FlexCAN controller sends it over the CAN bus in big endian format as I showed in the logic analyser trace.
I can translate the endianness of all data sent and received from the FlexCAN controller, however my question was whether there is a way to switch the FlexCAN controller to use little endian across the CAN bus?