> But that is only applicable for Global variables. In my case digest[] is local variable which is corrupted.
In my experience this depends on the toolchain (and the debugger). Usually, data watchpoints are basically related to addresses.
Perhaps your issues are triggered by an interrupt handler, or another communication-based handler.
I had debugged such a problem last year, and it turned out the main (RT-OS) thread had passed a buffer on the stack to communication handler. This buffer address was (re-)used much later in the next OS cycle when the response from the remote device was processed, corrupting the stack.
Perhaps the values on the stack itself can give you a clue. They are either addresses or data values, which might help you identify the offender.
When you disable interrupts for the runtime of the routine, does the stack corruption still happen ?
As mentioned, I have no experience with LPC55S devices. And I'm no NXP employee, for all intents and purposes.