platform-nordicnrf52 icon indicating copy to clipboard operation
platform-nordicnrf52 copied to clipboard

Upload and Monitor fails: miniterm.py can't find port

Open mday64 opened this issue 4 years ago • 0 comments

Using VSCode on macOS 10.15.3 (Catalina) with Adafruit Feather nRF52840 Express, if I use the "Upload and Monitor" item from the PlatformIO pane, my program builds and uploads, then miniterm.py is launched, but miniterm.py fails to open the serial port with ENOENT.

Note that the nRF52840 has built-in USB, so there is no external USB chip involved. I'm wondering if when the nRF52840 restarts after programming, it takes a brief amount of time for USB to come back up and for the host to re-enumerate. It seems like there needs to be a small delay before launching miniterm.py.

The failure also happens from the command line via:

platformio run -t upload -t monitor

But if I do

platformio run -t upload; platformio run -t monitor

(two separate commands) it does find the serial port and connect, but it loses the initial serial output from my program. Apparently, the separate program invocations introduce too much of a delay. I could work around that with an explicit delay in my program, but that's annoying.

Partial output from failure:

CONFIGURATION: https://docs.platformio.org/page/boards/nordicnrf52/adafruit_feather_nrf52840.html
PLATFORM: Nordic nRF52 4.2.0 > Adafruit Feather nRF52840 Express
HARDWARE: NRF52840 64MHz, 243KB RAM, 796KB Flash
...
Checking size .pio/build/adafruit_feather_nrf52840/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.8% (used 7028 bytes from 248832 bytes)
Flash: [=         ]   7.3% (used 59348 bytes from 815104 bytes)
Configuring upload protocol...
AVAILABLE: jlink, nrfjprog, nrfutil, stlink
CURRENT: upload_protocol = nrfutil
Looking for upload port...
Auto-detected: /dev/cu.usbmodem141401
Forcing reset using 1200bps open/close on port /dev/cu.usbmodem141401
Waiting for the new upload port...
Uploading .pio/build/adafruit_feather_nrf52840/firmware.zip
Upgrading target on /dev/cu.usbmodem141401 with DFU package /Users/mark/Documents/PlatformIO/Projects/Hello OLED/.pio/build/adafruit_feather_nrf52840/firmware.zip. Flow control is disabled, Single bank, Touch disabled
########################################
########################################
####################################
Activating new firmware
Device programmed.
========================================== [SUCCESS] Took 8.87 seconds ==========================================
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
could not open port u'/dev/cu.usbmodem141401': [Errno 2] could not open port /dev/cu.usbmodem141401: [Errno 2] No such file or directory: '/dev/cu.usbmodem141401'

PlatformIO, version 4.3.1

mday64 avatar Apr 13 '20 20:04 mday64