I have an electronics board that uses an ATmega324PB microcontroller that uses SPI communications to communicate with another device on the board.

In a coding function that reads a register through SPI communications, there is a transmission of "0xAA". The application note (excerpt below) regarding SPI communications mentions something, but it implies some kind of check required, which doesn't seem to match what the code is doing.

If I removed that "SPI transmission of 0xAA" line, the function does not work correctly.

Is there a better explanation of what 0xAA does in terms of reading from a register via SPI with the ATmega324PB microcontroller?

enter image description here

enter image description here

  • 3
    \$\begingroup\$ The fact that 0xAA is 0b10101010 might have something to do with it. \$\endgroup\$
    – Hearth
    May 13, 2022 at 21:20

2 Answers 2


Without looking at the other side of the code, it is more important to transfer the third byte than what the value of third byte is.

The value is 0xAA which is an alternating pattern of ones and zeroes, and it might be chosen just because it is quite easy to recognize on oscilloscope and it might be used to check the third byte is actually properly transmitted and received as it can be distinquished from stable pattern of all ones or all zeroes easily.

The code transmits 0xAA to the other device, because it needs to transmit a byte to receive back a response byte from the other device.


It helps provide a visual indication of success or failure. Note the line that says "This can be visually verified on STK600 with the help of onboard LEDs".

If the LEDs represent the register (i.e. PORTD) success is alternating lights, while failure is one half lit, the other half dark.

If it is blinking out the register: Failure will blink the LED at 1/4 the rate of success.

This is because, in binary, 0xAA = 10101010 and 0xF0 = 11110000.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.