[ ]
 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Homepage FreeRTOS Labs FreeRTOS+TCP FreeRTOS+FAT Contact / Enquiries

FreeRTOS+TCP is still in the lab
FreeRTOS+TCP is already used in commercial products and we encourage you to try it yourself. Be aware however that we are still refining its design, and the source code and documentation do not yet meet Real Time Engineers Ltd's strict quality standards.
Please use the forum for support, feedback and ideas, or contact us directly if you have a specific business interest.

Little Endian, Big Endian

Different MCUs store multi byte values, such as a two byte uint16_t or a four byte uint32_t, in different ways. Microcontrollers that store the most significant byte first are called big endian. Microcontrollers that store the least significant byte first are called little endian. The way bytes are stored on the MCU on which FreeRTOS+TCP is running is called the host byte order.

It is rare for the writer of a non connected application to need to concern themselves with how their target MCU stores data internally. If data is written to memory in little endian order, it will be read back from memory in little endian order - and so the value read back will match the value originally written.

It is more complicated when MCUs are connected, because there are no guarantees that all the MCUs on a connected network will have the same byte order. All the MCUs on the network have to agree the byte order used to send and receive data in advance. The byte order used for data in transit is called the network byte order.

In TCP/IP networks data is sent most significant byte first, making TCP/IP networks effectively big endian. Therefore, a little endian MCU sending to a TCP/IP network must swap the order in which bytes appear within multi byte values before the values are sent onto the network, and must swap the order in which bytes appear in multi byte values received from the network before the values are used. A big endian MCUs does not need to perform any byte swapping because the endian of the MCU (the host byte order) matches the agreed endian of the network (the network byte order).

NOTE: The byte swapping is performed by the TCP/IP stack - the user does not need to swap bytes manually.

Useful links:

Other networking basics pages:

[ Back to the top ]    [ About FreeRTOS ]    [ FreeRTOS Labs Sitemap ]    [ Main FreeRTOS Sitemap ]    [ ]

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.