PlatformIO and serial issues


Hi Everyone,

When I try to upload my code to my Teensy 4.0 two things happen:-

1) The code doesn't actually upload
2) I get this error - Disconnected (device reports readiness to read but returned no data (device disconnected or multiple access on port?))

Board - Teensy 4.0
IDE - VS Code with PlatformIO
OS - Ubuntu 22.04

I was experimenting with the python serial library sometime ago, not sure if that causes this error. The teensy works with the Arduino IDE so I don't think multiple ports trying to access the teensy.

most likely is it the python serial library that did not release serial port and act like a zombie.
proof: reboot the system, does it resolve the issue?
Right so I rebooted the Teensy by pressing and holding the program mode button for 15s, same thing is happening :/
What I believe @WMXZ was suggesting was to reboot your computer, such that maybe any lingering Serial issues might be cleared if it was some transient thing.

15 second reset of teensy will simply setup the teensy to be what was on it to what was shipped state.

Sorry I have not used Platform IO much and none on Ubuntu. So probably much help. But for those who do, it might help them to help you to know more information, like
which versions of PlatformIO you are using, and with what version of Teensy stuff.

I don't remember what the VSCode/PlatformIO stuff uses to upload the teensy stuff. The normal Teensy GUI app? or command line version? If GUI, might help to look at the verbose data
to see if any hints.

I assume if it works with Arduino, then the UDEV rules are properly installed, but you may want to doublecheck.

I am assuming a standard Teensy 4 and not a locked Teensy 4, again not sure if PlatformIO is setup to handle locked setup.

Good Luck
@KurtE yep tried rebooting my pc as well, it was a no go.

My Teensy 4.0 is standard I bought it from PJRC. The normal Teensy GUI shows up, I've been using this particular setup for a while and has been working until the encounter with python serial :)

As you suggested this is the PlatformIO version I'm using -
Core - 6.1.4
Home - 3.4.3

Two questions...

Can you reproduce the problem without PlatformIO, only using Arduino IDE with Teensyduino 1.57 installed?

Can you give us the Arduino sketch and Python code and any other needed details to reproduce the problem? I have Ubuntu 20.04 on my desktop, been considering taking the upgrade to 22.04 soon...
Hi Paul, I have no problems with just the Arduino IDE (both versions 1.8.19 and 2.0.0) and Teensyduino 1.57, so the problem only effects PlatformIO.

Just a FYI the Teensy is hooked up to a Bosch BMI088 and a couple other senors on a custom PCB.
This is the Python code that I ran when PlatformIO was working fine:-

import serial
ser = serial.Serial('/dev/ttyACM0')

for x in range(1, 100 + 1):

Arduino Sketch:-

#include "BMI088.h"

Bmi088Accel accel(Wire,0x18);
Bmi088Gyro gyro(Wire,0x68);

void setup() 
  /* USB Serial to print data */
  while(!Serial) {}

  /* start the sensors */

void loop() 
  // read the sensors


  /* delay to help with printing */

If the same code works when built with Arduino+Teensyduino but fails when compiled with PlatformIO, that's an issue you should report to the PlatformIO developers on github. Of course they'll need a copy of the code and precise info about all settings used.