In PlatformIO how to distinguish two connected Teensy(s) for uploading

ninja2

Well-known member
Good day,

Uploading to one of my Teensy 4.1 fails if a Micromod Teensy is also connected. In my 'platformio.ini' (below) I've specified teensy-cli and the specific Serial number using upload_flags but it still doesn't work, forcing me to disconnect the Micromod before uploading to the T4.1.

Is there a way to around this?
TIA

Code:
[env:teensy41_09]
platform = teensy
board = teensy41
framework = arduino

upload_protocol = teensy-cli

upload_port  = /dev/teensy41-exp-board-2
monitor_port = /dev/teensy41-exp-board-2

lib_deps =
    https://github.com/janelia-arduino/Streaming.git
    https://github.com/milesburton/Arduino-Temperature-Control-Library
    
build_flags =
    -I include
    -I../shared_include
    -D VERBOSE=1
    -D T41EXP-2

# T4.1-1 by its serial no
#upload_flags =
#    -s
#    15807140

# T4.1-2 by its serial no
upload_flags =
    -s
    14582390

# T4.1-3 by its serial no
#upload_flags =
#    -s
#    14582370
 
See if this can work: https://forum.pjrc.com/index.php?threads/teensy-qt.27825/

IIRC it has command line tool for serial number as well see: https://koromix.dev/tytools

For the IDE this file beside the platform.txt file in the install does it to replace the upload pattern:

Try making a "platform.local.txt" file beside the platform.txt in use {with correct path to the .EXE} [then fresh start of the IDE]
Code:
tools.teensyloader.cmd.path=T:\T_Drive\TyComm\TyCommanderC.exe
tools.teensyloader.upload.pattern="{cmd.path}" upload --autostart --wait --delegate "{build.path}/{build.project_name}.hex"
 
hmmm... thanks not I'm not really prepared to invest in a new tool (even though I know its a good tool), I can just unplug one of the Teensys for now, but I'm still hoping for a platformio compatible workaround
 
If you use the normal GUI-based Teensy Loader, you can run teensy_post_compile to initiate upload. It takes a special location string. On Windows that string encodes the Windows Registry numbers for the PCI bus and all USB hub ports to reach the specific USB connector where Teensy is located. You can get that string from the teensy_discovery program, or by just running Arduino IDE 2.3.10 and look for the detected locations in the drop-down list of connected devices.

How exactly you would do this in PlatformIO, I do not know. But again if you run Arduino IDE 2.3.10 just to get more info, turn on verbose output for upload and compile in File > Preferences. That will let you see the command lines Arduino IDE is actually running. Hopefully that gives enough info to do it yourself from command line without any IDE, and then move on to how to make PlatformIO do it.
 
Not sure what is meant by 'the normal GUI-based Teensy Loader' ? and I'm not familiar with 'teensy_post_compile'?
Nevertheless I do still have Arduino IDE 2.3.10 active, so I'll try the verbose option. tks.
 
Back
Top