> I'm using LPC822 on my 2nd project and I remarked that suddenly the code execution of the MCU stops. It's not predictable but I often find the MCU stopped and an external reset is needed to restart the program execution.
While we can see even less than you, who is supposedly in front of the board, there are some common causes for runtime errors.
In most cases, it is either a stack overflow or an illegal address (no memory or not enable peripheral).
My first recommendation is, try to debug it. When ending up in the hardfault handler (most likely), check the call stack.
If that doesn't help, you can instrument your code, i.e. add log outputs you watch at runtime.
Determining the required stacksize for a project is mostly guesswork, and many toolchains just set an arbitrary default value and leave the rest entirely to the user. Without change, they invariably hardfault at the first try.