PlatformIO Community

Serial Monitor Slow Startup (New Issue)

Recently I’ve noticed that the Serial Monitor is very slow to start up. Previously it seemed to start up in 1-2 seconds, but now it takes ~8.5 seconds on a MacBook Pro running macOS Big Sur 11.6.8. The target platform is a Teensy 4.0.

Normally I upload my code using the “Upload” icon at the bottom of the screen, and then (if necessary), immediately press the Serial Monitor icon. With a 3 second delay in my code after Serial.begin(), everything previously worked fine. Now I’ve needed to increase the delay to 10 seconds, which seems eternally long when you’re anxious to see if your code works.

Any ideas on why the Serial Monitor behavior/performance has changed? Is there a different workflow I should be using? Since Teensy 4 doesn’t support debuggers, I rely on printf-style debugging. This has worked fine for me, but sometimes requires lots of iterations, and the 10-second delay adds up…

Thanks!

1 Like

Do you use the latest PlatformIO Core? Please provide an output from pio system info command.

Sorry for omitting that information:
Screen Shot 2022-08-22 at 9.27.58 AM

Same problem on the Windows Platform, here’s my system info

PlatformIO System Info

@randy , @aerokeith, please connect the board that you are going to monitor and run pio device list. Share an output here.

Here’s mine:
Screen Shot 2022-08-23 at 9.31.18 AM

Here’s mine as well, there were a few additional “Bluetooth” serial devices that went off the end but the device I was working with was COM17.

PlatformIO Device List

Could you run pio upgrade --dev. Does it start fast now?

Sorry, it’s still slow after upgrading.
-Keith

Same here, core upgraded and the project still compiles/works but the monitor startup is still delayed 5 seconds or so.

@aerokeith , @randy , thanks for helping us to fix this issue.

I’ve just created a separate branch of PIO Core with debug information. Please open PlatformIO Core terminal in VSCode (terminal icon on the bottom status bar) and type:

pip install -U https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-dev-monitor.zip
pio device monitor

You will see a debug output with time frames. Please share it here.

Hi @ivankravets !
I had the same problems with the serial terminal.
After installing the package you specified, it became much faster.
However, I don’t see any time frames.

Could you provide an output of pio device monitor?

Start device finder 1661457512.5254374
--- Terminal on COM10 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
ets Jun  8 2016 00:22:57

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2    
load:0x3fff0030,len:1184 
load:0x40078000,len:13132
load:0x40080400,len:3036 
entry 0x400805e4

Sorry, I didn’t notice the timestamp before

Ivan,

I’d like to help more, but I’m leaving for Burning Man in a couple of hours. I used PlatformIO to write the LED lighting code for a large art project (25 foot glass/steel shark), and I’m still making tweaks, so I don’t want to mess with my configuration right now. I hope you understand. I’ll be totally off-grid for the next 12 days, so I’ll check in when I get back. I hope the other guys can help you track down the problem.

Thanks!

-Keith

@sivar2311 , you don’t have any issues as you specify the monitor port directly in the platformio.ini file.

Do you see instantly the first line with “Start device finder…”?

I always specify the monitor port in platformio.ini. Even with that, it took a long time to open.

For another reason, I reinstalled Python and PlatformIO yesterday.
Since then, opening the monitor is very fast again.

Unfortunately, I cannot restore the previous state for an analysis.
For me the problem is solved. Thanks for your help :slight_smile:

I tried installing the debug device monitor but I’m not seeing any additional output. Here’s what I got while installing the code and running pio device monitor:

Debug Device Monitor

Just checking a couple of things I noticed that if I specify the port value, either on the command line or in the platform.io then the terminal starts up quite quickly. If I don’t specify a port then it takes the 5 seconds or more to find the port and then start up.

Please remove the manually specified port and run pio device monitor. You should see debug information with all timeframes.