Endianness is a subtle but costly issue in embedded systems, especially when transmitting multi-byte data over serial links. Using an ATmega328P sending 16-bit ADC readings over UART, the post walks through capturing raw bytes with RealTerm, saving them to a binary file, and plotting with Octave. It demonstrates how swapped byte order (big-endian vs. little-endian) can produce plausible-looking but incorrect results — in this case, 10-bit ADC values appearing as ~20K numbers. Practical steps cover configuring RealTerm, verifying the startup sequence, capturing data, and using a preprocessor define to simulate endianness mismatch.

12m read timeFrom embeddedrelated.com
Post cover image
1 Impression