Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 9 of 9

Thread: PlatformIO and serial issues

  1. #1
    Junior Member
    Join Date
    Jan 2022
    Posts
    9

    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?))

    Setup:-
    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.

    Thanks.

  2. #2
    Senior Member
    Join Date
    Jul 2014
    Posts
    3,481
    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?

  3. #3
    Junior Member
    Join Date
    Jan 2022
    Posts
    9
    Right so I rebooted the Teensy by pressing and holding the program mode button for 15s, same thing is happening :/

  4. #4
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    11,438
    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

  5. #5
    Junior Member
    Join Date
    Jan 2022
    Posts
    9
    @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

    Thanks

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,670
    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...

  7. #7
    Junior Member
    Join Date
    Jan 2022
    Posts
    9
    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:-

    Code:
    import serial
    ser = serial.Serial('/dev/ttyACM0')
    
    for x in range(1, 100 + 1):
        print(ser.readline())
    Arduino Sketch:-

    Code:
    #include "BMI088.h"
    
    Bmi088Accel accel(Wire,0x18);
    Bmi088Gyro gyro(Wire,0x68);
    
    void setup() 
    {
      /* USB Serial to print data */
      Serial.begin(9600);
      while(!Serial) {}
    
      /* start the sensors */
      accel.begin();
      gyro.begin();
    }
    
    
    void loop() 
    {
      // read the sensors
      accel.readSensor();
      gyro.readSensor();
    
      Serial.println(accel.getAccelX_mss());
    
      /* delay to help with printing */
      delay(20);
    }
    Thanks.

  8. #8
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    27,670
    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.

  9. #9
    Junior Member
    Join Date
    Jan 2022
    Posts
    9
    Alright, thanks Paul!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •