Platformio difficult to configure

I am using a teensy 3.2 on a linux system. Teensyduino is installed and works great.

Never having used json before I have had to learn a new utility language.
It took a few hours to figure out how to make PIO work with my teensy. Then I need to manually designate my serial monitor directory (/dev/ttyACMO). Which still doesn’t work :hot_face:

I encountered the expected problems with finding libraries. I somehow got that working.

After finding out I needed a paid membership to use the debugging features I subscribed. PIO claims their debugger is the best in the whole world. On having a problem with jlink PIO says RTFM. I just want to debug my code. When following your links to j-link I am confronted with a picture of hardware. I figured out that you are using a remote server with this hardware. Why should I have to do that?

I get indications my 99-platformio-udev.rules is out of date. I get the rules and copy them as directed. I restart udev server. Then restart VS for good measure. Lo and behold, the same problem.

I realize you are covering multiple operating systems, multiple platforms, and boards. Never the less your product is difficult to use. I am not a newbie. I am a former Sysadmin and DBA. I am no stranger to the command line and linux file system. I shouldn’t have to read several manuals, blog posts, and learn json just to end up with more setting up.

99-platformio-udev.rules is out of date

This is a recent issue, which is being looked into. It appears to be entirely cosmetic… I have it myself and it doesn’t seem to be stopping anything from working. As long as you have installed the udev rules, restarted udev so they are being applied, and have ensured your username is a member of the relevant groups(dialout, plugdev), you can ignore it. i.e. you’ve followed the instructions in the FAQ on this warning message.

After finding out I needed a paid membership to use the debugging features I subscribed.

Not to niggle, but did you try the 30 day trial first?

Best place to start when looking for info on a particular board is the documentation page for that board. i.e. go to the Boards page, search for your board, and then click on it to get to it’s specific documentation page. Like the one for the Teensy 3.1/3.2. Similar thing for debugging… i.e. seeing what specific configuration options are needed for the debugger. In this case, it’s just a matter of copying the debug_tool = jlink line. And the GDB Server will be used because it allows for both local and remote debugging capabilities, among other things.

For the Teensy 3.5 (as I don’t have a teensy3.0/3.1 anymore)… it seems like there are some issues which run deeper than just PlatformIO… a simple configuration such as

platform = teensy
board = teensy35
framework = arduino
upload_protocol = teensy-cli
debug_tool = jlink

(I’m using a Teensy 3.5, and switched to the CLI uploader, instead of the default GUI, simply so I don’t have something else popping up over the screen - it doesn’t change any other behaviours).

… and the following code …

#include <Arduino.h>

void setup() {

void loop() {
  Serial.print("Elapsed millis ");

… it upload fine - PlatformIO auto detects the Teensy 3.5 programming port, and works fine. If I try to monitor that port… it also auto detects it… and either fails with could not open port '/dev/ttyACM0': [Errno 16] could not open port /dev/ttyACM0: [Errno 16] Device or resource busy: '/dev/ttyACM0' or opens the serial monitor, but there’s no output.

Thinking it could be a gremlin in the platformio serial monitor, I opened minicom instead (minicom -D /dev/ttyACM0 -b 9600)… and no cigar… either the same error, or nothing. Checked permissions… /dev/ttyACM0 is in the dialout group, so shouldn’t be a problem… unplugged the teensy whilst minicom was running… plugged it back in… immediately got output… for all of five seconds.

Will have to dig deeper… and reinstall Teensyduino… to see if there is something wrong with the teensy stuff, or with the compiled platformio code.

However, PlatformIO is not always ‘easy’ … especially when you’re getting started… partly because it is supporting all the different OSs and processor frameworks, etc and trying to bring it all under one roof… but once you get over the learning curve of searching the docs for stuff - either libraries, board configurations or settings for stuff, and get comfortable with that platformio.ini I think you’ll like it. And don’t be afraid to post on the forum! :slight_smile:

Right, after banging my head against this ‘only works for five seconds… sometimes… else it gives device in use errors’… both with code compiled with platformio and the Teensyduino, as well as the fact Teensyduino wasn’t faring any better with the serial monitor barely working at all… I realised the udev rules supplied with platformio are different to those of teensyduino… so I edited the /etc/udev/rules.d/99-platformio-udev.rules file to update the Teensy block of rules… (included below), and it seems to be working fine now. The ID_MM_PORT_IGNORE is the critical extra flag… it seems to stop the device being inspected, and hence being ‘in use’… :man_facepalming:

i.e. if the below code was run, without the update udev rules, the teensy would start blinking a couple of seconds after uploading, because it was probed - as opposed to only starting blinking when the serial monitor connects.

#include <Arduino.h>

uint32_t SFirst = 0;
uint32_t SFound = 0;

void setup() {
  SFirst = millis();
  digitalWrite( LED_BUILTIN, HIGH );
  while ( !Serial );
  SFound = millis();
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);
  Serial.printf("Setup Entry: %d\n", SFirst);
  digitalWrite( LED_BUILTIN, LOW );
  Serial.printf("Serial Online: %d\n", SFound);

void loop() {
  Serial.print("Elapsed millis ");

I’ve submitted a pull request to update the udev rules, so it should get updated in the next few days.

Teensy udev rules

ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", ENV{ID_MM_DEVICE_IGNORE}="1", ENV{ID_MM_PORT_IGNORE}="1"
ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789A]?", ENV{MTP_NO_PROBE}="1"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789ABCD]?", MODE:="0666"
KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789B]?", MODE:="0666"