Upload_port not respected

I have two teensy 4 board that I am trying to upload the same program to, but the upload port is not being respected in my platformio.ini file, all builds are being uploaded to the same device on port COM38.

[env:teensy40_1]
platform = teensy
board = teensy40
framework = arduino
upload_port =  COM35

[env:teensy40_2]
platform = teensy
board = teensy40
framework = arduino
upload_port = COM38

Both devices are available, see ‘pio device list’ below

COM3
----
Hardware ID: PCI\VEN_8086&DEV_9D3D&SUBSYS_225817AA&REV_21\3&11583659&1&B3
Description: Intel(R) Active Management Technology - SOL (COM3)

COM38
-----
Hardware ID: USB VID:PID=16C0:0483 SER=6111290 LOCATION=1-1.4
Description: USB Serial Device (COM38)

COM35
-----
Hardware ID: USB VID:PID=16C0:0483 SER=6111490 LOCATION=1-1.3
Description: USB Serial Device (COM35)

Can you post a verbose upload log?

pio run -t upload > upload.log 2>&1

And then upload to pastebin.com.

The string comes from the teensy_reboot.exe file

C:\Users\Maxi\.platformio\packages\tool-teensy>strings teensy_reboot.exe | grep auto
Found %d Teensy boards, but using auto-search to find board for upload.

This seems in turn to be invoked by the main flasher. Now the question is how that binary can be instructed to use a specific COM port. There is no --help support text. Only the teensy_loader_cli.exe seems to be open-source? GitHub - PaulStoffregen/teensy_loader_cli: Command line Teensy Loader (reference Source for teensyduino utilitues "teensy_post_compile" and "teensy_reboot" ? · Issue #31 · PaulStoffregen/cores · GitHub)

PIO either doesn’t give the port to the flasher tool correctly in the invocation or the tool doesn’t support it, see e.g. invocation which has no port reference.

teensy_post_compile -file=firmware -path="C:\Users\EthanBecker\Documents\PlatformIO\Projects\190826-155108-teensy40\.pio\build\teensy40_2" -tools=C:\Users\EthanBecker\.platformio\packages\tool-teensy -board=TEENSY40 -reboot

Also issue --upload-port flag has no effect · Issue #44 · platformio/platform-teensy · GitHub seems to be related.

@ivankravets do you happen to know if teensy_post_compile supports a path to the device to be flashed, either USB paths or COM port?

I don’t think either of the teensy tools supports specifying the port to use (teensy-cli certainly doesn’t document it anyway)… and that led to some … interesting… results in another thread when multiple boards were connected

I just came across this mini suite of tools again… looks like it supports Linux, Mac and Windows, and can reset / upload / monitor by port, serial number, board type… will have to see how to go about using that instead! :slight_smile:

Oh, I don’t know. Maybe, ask Paul Stoffregen here Issues · PaulStoffregen/teensy_loader_cli · GitHub?

1 Like