Keeping the serial monitor running while flashing new code or seing println results in setup

I would like to know if there is a way to keep the serial monitor running while flashing new code to my photons. My objective is to use println to trouble shoot code in setup. By the time I get the serial monitor rerunning setup is complete and I don’t see my trouble shooting statements. I have addressed the problem by brute force by introducing a long delay in setup that gives me time to switch to the serial monitor and get it running before the setup statements run. It works but is cumbersome.

Is there a more elegant approach?

Thanks
Chris

use particle serial monitor --follow. You might still need a short delay in setup() to allow the port enough time to reconnect, but it is definitely faster than restarting the monitor by hand.

The workaround mentioned by @picsil is your best bet.

The reason for not being able to keep USB Serial running durning reboot is that the controler itself has to run the USB Serial interface and once the controler is reset it obviously cannot still be running its code that is in charge of the USB connection.
And consequently when the USB device vanishes from the host’s USB port it will need to reestablish the connection which will require some time.

Thanks folks. Worked like a charm. And thanks for the further explanation of why. I am getting a great education from you guys.

Chris

1 Like

I’ve said this before, but I switched from PuTTY to TeraTerm (Windows only specifically because it will automatically reopen a serial connection after device reboot. I like this better than using the CLI serial monitor with --follow, because it’s bi-directional, so you can send commands to the device in either Listening mode, or if you are using serial comms in your code.

1 Like

Thanks @ParticleD. And for Mac/Linux users, search here for nmon. That gives you the same CLI interface to the serial terminal, but also accepts input. It will reconnect automatically as well. I also use CoolTerm on the Mac, but unfortunately it does not reconnect automatically.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.