Stack pointer is setup to incorrect alignment (STM32)

Technical Note 82023






11/6/2015 11:10 AM


Programming an STM32 device fails with the message:

Warning: Stack pointer is setup to incorrect alignment. Stack addr=0xAAAAAAAA


STM32 devices can be read protected. When read protection is enabled, bytes in flash memory will be read out as 0xAA. When the Cortex-M device starts up, the bytes at 0x00 to 0x03 are read, as they hold the value of the stack pointer, and in that situation the value 0xAAAAAAAA is regarded as invalid.


The flash of the STM32 device needs to be erased. With I-jet, unlock utilities for STM32 devices are provided as C-SPY macros found in the C-SPY Macro Quicklaunch window. With J-Link, arm\bin\JLinkSTM32.exe can be used.

All product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of, we recommend upgrading to a modern browser such as Chrome or Edge.