Serial Monitor misses setup commands, startup in separate window, always on?

Hello,

In arduino the serial monitor stays up all the time, which is nice. When the application runs, the serial monitor is there to catch in on all the action. In platformio it seems to connect after compile? This takes some time, and it misses the startup commands.

How do I keep the serial monitor open?

How can I separate the serial monitor from the main window (New Window)?

Sorry if this is really basic stuff, I’m just getting started with Platformio because the arduino editor was driving me nuts. But this is confusing me. Thanks for the help.

Jay

Are you using the “Upload and Monitor” task in the project tasks window? There shouldn’t be too much time between uploading and starting the serial monitor. If doing successive runs, PlatformIO will automatically close and re-open the serial monitor (with a configurable delay).

Note that depending on the target board you’re uploading to, PlatformIO needs to close / disconnect from the serial monitor since the firmware is uploaded through the serial connection, so “keeping it open” is not possible - just disconnecting and connecting at the right time to not interfere with the upload.

I don’t think that’s possible.

The “Terminal” tab just has all the different terminal sessions that can be switched to, but I couldn’t find a way to detach it to a new screen. Just resizing and splitting the terminal in two is possible.

Depending on the target MCU I’d recommend to

  • add a small delay() in setup to help PlatformIO catch up
  • if using an MCU which creates the USB-CDC, while(!Serial) {} is an often possible way to wait until the serial connection is established
  • usage of just the “Upload” task and using an external serial monitor program, e.g. HTerm - der-hammer, PuTTY or TeraTerm. Note that you will need to disconnect before uploading though if upload happens over the same serial port