This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LC4357: BE32 Convertion

Part Number: TMS570LC4357


Greatings,

I'm Using TMS570LC Launch to Communicate with SD Card and storing a .txt file using fat32 

Fat32 Uses Little endian Format, so i'm supposed to convert the Data  every time i receive it from Sd card and whenever i want to send it.

the basic Conversion code some how doesn't work properly, when searching i learned that tms570 uses BE32.



The Question is 
What is the Difference between BE32 and Normal Big Endian(Byte).

is there is any code or reference that helps me Convert from little endian to BE32 and vice Versa.

  • Hello Hamdy,

    In BE32, the byte 0 and byte 3, byte 1 and byte 2 are swapped.

    Please refer to the table in this link:

    You can use this function to swizzle the data before sending and after receiving:

    uint32 SwizzleData(uint32 word)

    {

    #if ((__little_endian__ == 1) || (__LITTLE_ENDIAN__ == 1))

    return word;

    #else

    return __rev(word);

    #endif

    }

  • is This Mean That when Using uint16 , the Byte order is as same as little endian or it's swapped too.

    thank you Wang for Your Quick response .

  • Hi Hamdy,

    Sorry for late response. If using uint16, the byte order should be swapped too.

    For RM57 little-endian device:

    write uint16 (0x1234) to SRAM: 

                       address  offset:        0x00             0x01           0x02           0x03

                       uint16=0x1234         0x34              0x12

    For TMS570LC43x big-endian device:

    write uint16 (0x1234) to SRAM: 

                       address  offset:        0x00             0x01           0x02           0x03

                       uint16=0x1234         0x12             0x34