Duplicate of --upload-port flag has no effect · Issue #44 · platformio/platform-teensy · GitHub. There are also tested workarounds available.
The general problem here that the standard uploader program (which I assume you use),
teensy_loader_cli, cannot be given a target device. The uplaod port is ignored and not even given to the program because it doesn’t process it anyways.
See PlatformIO invocation line here and available program options here.
There’s no option to specify a target USB device.
So fundamentally this is a problem of the uploader, and it was already reported as issue in https://github.com/PaulStoffregen/teensy_loader_cli/issues/56.
There are also multiple PRs open that address this, all in different styles and with different options. As linked above e.g.
But not one got merged yet because… well read the author’s comment.
What you can do is e.g. just
- try out the workaround I first linked to which uses tycmd or,
- try out one of the PRs by compiling that fork, replacing then using that as a replacement for
~/.platformio/packages/tool-teensy/teensy_loader_cli and add extra configuration options in the environment of the
platformio.ini to give the program the new flag.
This first one e.g. adds the option of
“\t–serial-number=SERIAL_NUMBER : Serial number to use in conjunction with soft reboot (UNIX only).\n”
to the program which should solve your problem.
On the Rasberry Pi, you can e.g. try
sudo apt-get install libusb-dev gcc
git clone https://github.com/hmaarrfk/teensy_loader_cli.git
git checkout serial_number
cp teensy_loader_cli ~/.platformio/packages/tool-teensy/.
to compile and replace the loader executable. Then read out the USB serial number of both teensies (e.g. per here and using the
/dev/ttyACMx device), then add
upload_flags = -t <serial number> in the environment of the
platformio.ini. You might want to duplicate the environments.