10.4.4.1 Stack Pointer Limit Check

The Stack Pointer Limit (SPLIM) register can be programmed with the lower stack limit, meaning the lowest SRAM address location for the stack. The Stack Pointer (SP) is compared continuously to the SPLIM. Whenever SP < SPLIM, a limit check signal is asserted, and the Stack Pointer Limit Error (SPLIM) flag in the Interrupt Flags (INTFLAGS) register is set.

The Stack Pointer Limit Check will also detect a stack underflow, which occurs when a POP instruction makes the SP wrap around from address 0xFFFF to address 0x0000 (the POP instruction increases the SP by one, as described previously).

The Stack Pointer Limit Error (SPLIM) flag is also routed to the Error Controller.