You’re performing complex operations directly within the UART interrupt handler.
When `processBootloaderCommand()` is called from `HAL_UART_RxCpltCallback()`, you’re executing it in interrupt context. If this function uses `HAL_Delay()` or jumps to the application, it causes problems because HAL_Delay() relies on SysTick interrupts which can’t execute properly when you’re already in an interrupt handler. Additionally, jumping to the application from within an interrupt leaves the system in an inconsistent state.
The solution is to use a flag-based approach: set a flag in the interrupt handler when a command is received, then check and process that flag in your main loop. This way, `processBootloaderCommand()` and any subsequent application jumps happen in the main program flow rather than interrupt context, allowing HAL_Delay() to work properly.
You should also disable all interrupts before jumping to the application to ensure a clean transition, and add buffer overflow protection to prevent the rxBuffer from overrunning if too much data is received.
This explains why the button method works (it’s processed in main loop) but the UART method fails (it’s processed in interrupt context).