Script keeps halting (on MEGA via USB link)

I also have a large (10% program space) testbed project running on a MEGA via a USB link. It will also tend to “stall” at random times. Sometimes I need to stop and restart the blynk-ser.bat file (which reboots the MEGA), but usually I just start pressing buttons on the app and eventually (in a few seconds) it just stutters awake and catches up as if nothing is wrong.

I personally think it has something to do with the USB link, as occasionally I see only one-way communication. E.g. Uptime counter and Hardware → App displays are working, but App → Hardware commands are not responding… until again like above, a few seconds of button/slider poking and everything just starts working as if nothing was wrong.

I use another TTL-USB adapter on the MEGA’s Serial1 to allow debugging on a serial terminal monitor; Blynk’s Debug at times, but usually just #define BLYNK_PRINT Serial1 and my own print markers to indicate function activities.

Sometimes I see flooding warnings on some heavy action functions, but usually not. I have Local Server and have fiddled with various adjustments, but none of them have seemed to affect the issue one way or another.

Try something like that debugging for your own sketch.

That is an option you can try to program in, via a combo of Blynk’s connection management and sync commands.