PlatformIO Community

Serial Monitor could not connect

When I try to start the Serial Monitor, I get the following message:
> Executing task: platformio device monitor <
TimeoutError: Could not automatically find serial port based on the known UART bridges

This is new behavior.

  • Core 6.0.3a7
  • Home 3.4.2
    Teensy 4.0
    MacBook Air M1

In PlatformIO Home → Devices, what devices are recognized?

Thanks so much for helping me with this. I am rather new to this. Here is what I think you are looking for:

 |/dev/cu.wlan-debug |n/a|n/a|
 |---|---|---|
 |/dev/cu.Bluetooth-Incoming-Port |n/a|n/a|
 |/dev/cu.usbmodem86031401 |USB Serial|USB VID:PID=16C0:0483 SER=8603140 LOCATION=1-1.3|

Also, here is full message I get back from the monitor window:

Executing task: platformio device monitor <

 TimeoutError: Could not automatically find serial port based on the known UART bridges
 --- Terminal on /dev/cu.usbmodem86031401 | 9600 8-N-1
 --- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, 

nocontrol, printable, send_on_enter, time
— More details at Redirecting...
— Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H

PlatformIO Core 6.0.3 has received an improved serial port finder. It now uses HWID metadata from a board manifest. If they are not declared, then the first “suitable” USB/UART port will be picked (PlatformIO Core <6.0.3 behavior).

I’ve just updated the Teensy 4.0 manifest

Could you try the development version of the Teensy platform? Does it work now?

Sorry, Ivan. I don’t know how to do this. Could you explain the steps I must go through to try the development version? Thanks.

If you have your Teensy project open in VSCode, there is a platformio.ini file in the file explorer sidebar (left) that, when opened, shoud look something like this

[env:teensy40]
platform = teensy
board = teensy40
framework = arduino

the documentation wants you to replace the value platform with the git link to the platform so that the latest development version is used. I.e., your platformio.ini should now look like

[env:teensy40]
platform = https://github.com/platformio/platform-teensy.git
board = teensy40
framework = arduino

The other part is that at least PlatformIO core 6.0.3 should be used. In this screenshot you can see the button for “Upgrade PlatformIO Core”.

Once you’ve changed both the platformio.ini (and saved it) and upgraded the core, I’d recommend a restart of the VSCode window, then try to use the “Monitor” command again.

1 Like

Getting following message on startup:

Could not load recent projects

Server error: {“type”:“AttributeError”,“args”:[“module ‘platformio.platform.platform’ has no attribute ‘PlatformPlatform’”],“message”:“module ‘platformio.platform.platform’ has no attribute ‘PlatformPlatform’”}

Also get the following when compiling:

> Executing task: platformio run <

Processing teensy40 (platform: https://github.com/platformio/platform-teensy.git; board: teensy40; framework: arduino)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Error: Traceback (most recent call last):
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/__main__.py", line 102, in main
    cli()  # pylint: disable=no-value-for-parameter
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/cli.py", line 71, in invoke
    return super().invoke(ctx)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/run/cli.py", line 142, in cli
    process_env(
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/run/cli.py", line 197, in process_env
    result = {"env": name, "duration": time(), "succeeded": ep.process()}
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/run/processor.py", line 83, in process
    install_project_env_dependencies(
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/package/commands/install.py", line 131, in install_project_env_dependencies
    _install_project_env_platform(project_env, options),
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/package/commands/install.py", line 148, in _install_project_env_platform
    PlatformPackageManager().install(
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/package/manager/platform.py", line 52, in install
    p = PlatformFactory.new(pkg)
  File "/Users/bob/.platformio/penv/lib/python3.10/site-packages/platformio/platform/factory.py", line 77, in new
    platform_cls = getattr(
AttributeError: module 'platformio.platform.platform' has no attribute 'PlatformPlatform'

============================================================

An unexpected error occurred. Further steps:

* Verify that you have the latest version of PlatformIO using
  `pip install -U platformio` command

* Try to find answer in FAQ Troubleshooting section
  https://docs.platformio.org/page/faq/index.html

* Report this problem to the developers
  https://github.com/platformio/platformio-core/issues

============================================================

I cannot reproduce that with the same platformio.ini I posted above.

>pio run
Processing teensy40 (platform: https://github.com/platformio/platform-teensy.git; board: teensy40; framework: arduino)
------------------------------------------------------------------------------------------------------------------------
Tool Manager: Installing platformio/framework-arduinoteensy @ ~1.156.0
Downloading  [####################################]  100%
Unpacking  [####################################]  100%
Tool Manager: framework-arduinoteensy@1.156.0 has been installed!
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy40.html
PLATFORM: Teensy (4.16.0+sha.5cf7431) > Teensy 4.0
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 1.94MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES:
 - framework-arduinoteensy @ 1.156.0 (1.56)
 - tool-teensy @ 1.155.0 (1.55)
 - toolchain-gccarmnoneeabi @ 1.50401.190816 (5.4.1)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 92 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio\build\teensy40\src\main.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\AudioStream.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\CrashReport.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\DMAChannel.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\EventResponder.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial1.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial2.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial3.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial4.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial5.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial6.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial7.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\HardwareSerial8.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\IPAddress.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\IntervalTimer.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\Print.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\Stream.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\Time.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\Tone.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\WMath.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\WString.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\analog.c.o
Compiling .pio\build\teensy40\FrameworkArduino\bootdata.c.o
Compiling .pio\build\teensy40\FrameworkArduino\clockspeed.c.o
Compiling .pio\build\teensy40\FrameworkArduino\debugprintf.c.o
Compiling .pio\build\teensy40\FrameworkArduino\delay.c.o
Compiling .pio\build\teensy40\FrameworkArduino\digital.c.o
Compiling .pio\build\teensy40\FrameworkArduino\eeprom.c.o
Compiling .pio\build\teensy40\FrameworkArduino\extmem.c.o
Compiling .pio\build\teensy40\FrameworkArduino\fuse.c.o
Compiling .pio\build\teensy40\FrameworkArduino\interrupt.c.o
Compiling .pio\build\teensy40\FrameworkArduino\keylayouts.c.o
Compiling .pio\build\teensy40\FrameworkArduino\main.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\memcpy-armv7m.S.o
Compiling .pio\build\teensy40\FrameworkArduino\memset.S.o
Compiling .pio\build\teensy40\FrameworkArduino\new.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\nonstd.c.o
Compiling .pio\build\teensy40\FrameworkArduino\pwm.c.o
Compiling .pio\build\teensy40\FrameworkArduino\rtc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent1.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent2.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent3.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent4.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent5.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent6.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent7.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEvent8.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEventUSB1.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\serialEventUSB2.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_alloc_valid.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_calloc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_free.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_hash.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_malloc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_malloc_stats.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_pool.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_realloc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_realloc_i.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_realloc_move.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_szalloc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_util.c.o
Compiling .pio\build\teensy40\FrameworkArduino\sm_zalloc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\startup.c.o
Compiling .pio\build\teensy40\FrameworkArduino\tempmon.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_audio.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_desc.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_flightsim.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_inst.cpp.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_joystick.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_keyboard.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_midi.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_mouse.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_mtp.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_rawhid.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_seremu.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_serial.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_serial2.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_serial3.c.o
Compiling .pio\build\teensy40\FrameworkArduino\usb_touch.c.o
Compiling .pio\build\teensy40\FrameworkArduino\yield.cpp.o
Archiving .pio\build\teensy40\libFrameworkArduino.a
Indexing .pio\build\teensy40\libFrameworkArduino.a
Linking .pio\build\teensy40\firmware.elf
Checking size .pio\build\teensy40\firmware.elf
Calculating size .pio\build\teensy40\firmware.elf
Building .pio\build\teensy40\firmware.hex
teensy_size: Memory Usage on Teensy 4.0:
teensy_size:   FLASH: code:8116, data:1944, headers:8368   free for files:2013188
teensy_size:    RAM1: variables:2464, code:6416, padding:26352   free for local variables:489056
teensy_size:    RAM2: variables:12384  free for malloc/new:511904
=========================[SUCCESS] Took 27.41 seconds =========================

Can you please remove the folders

  • /Users/<user>/.platformio/packages/framework-arduinoteensy
  • /Users/<user>/.platformio/platforms/teensy*

and retry?

Same result after removing these directories. Here is my platform.ini:

[env:teensy40]
platform = https://github.com/platformio/platform-teensy.git
board = teensy40
framework = arduino
lib_deps =
  pololu/Tic@^2.1.1
  sparkfun/SparkFun 9DoF IMU Breakout - ICM 20948 - Arduino Library@^1.2.9

I uninstalled PlatformIO from VSCode, deleted platformIO.ini and .platformio. I then reinstalled PlatfromIO and re-created the project. Everything seems to work now.

We improve PlatformIO Core serial port finder. Could you re-run pio upgrade --dev and remove /Users/<user>/.platformio/platforms/teensy* folders? Also, revert back platform to the stable teensy.

Does it work now?