Academic Program

Endianness

Endianness

Bytes within larger CPU data formats—halfwordword, and doubleword—can be configured in either big-endian or little-endian order. Endianness defines the location of byte 0 within a larger data structure (in this tutorial, bits are always numbered with 0 on the right). Figures 50.15 and 50.16 (from "Section 50 of the PIC32 MZ Family Reference Manual" DS61192A) show the ordering of bytes within words and the ordering of words within multiple-word structures for both big-endian and little-endian configurations.

endianness.png

Endianness in MIPS CPUs is configurable at design. Byte ordering in PIC32MZ MCUs is set as little-endian.

Endianness can vary between different computing systems.
 
Make sure that multi-byte quantities are converted to the correct endianness before transmission and/or consumption via appropriate PIC32 peripheral configuration (DMA, USB for example), or via software routines.