Hi,
I myself never implement a USB bootloader but I did several other MCU bootloaders.
from my understanding of your question, when your MCU running is standlaone mode, sometimes your application code can't run normal, seems like stuck in bootloader code. correct?
Normally when I implement bootloader, I will set up two leds in both bootloader code and app code to indicate me where the code is running currently. if only bootloader led on, thus we can confirm currently MCU is in bootloader mode.
normally the bootloader defines some conditions to allow code jump from bootloader codde to app code. if these conditions are not satisfied, bootloader can't jump to app mode. if it can't jump from bootloader to app successfully, you need have to check the bootloader code why those conditions are not meet.
when developing bootloader, if you want force bootloader jump to app, you can use "jmp" instruction to just to app entrance directly.
Have a great day,
Jennie Zhang
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------