Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIO doesn't wait long enough for port open/close (SAMD21G) #13

Open
SRGDamia1 opened this issue May 16, 2017 · 6 comments
Open

PIO doesn't wait long enough for port open/close (SAMD21G) #13

SRGDamia1 opened this issue May 16, 2017 · 6 comments

Comments

@SRGDamia1
Copy link

SRGDamia1 commented May 16, 2017

What kind of issue is this?

[*] PlatformIO Core. If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.
Configuration

Operating system: Windows 7 SP1

PlatformIO Version (platformio --version): v3.4.0b2 (within Atom: 2.0.0b.3)
Description of problem

When attempting to upload to an SAMD21 board (Adafruit Feather M0), the upload force closes the port, but does not wait long enough for Windows to actually close and re-open the serial port and so the upload fails. Sometimes Windows is speedy enough with the ports, but other times it misses.
Steps to Reproduce

Create sketch for Adafruit Feather M0
Upload using standard upload button in Atom (pio run --target upload)

Actual Results

Sometimes works without error
Other times, the port is forced closed, but before Windows has close the port, the uploader detects the old port as if it was the new port and attempts to upload to just as it is closing, causing a failure
Expected Results

Successful upload
Additional info

The Arduino IDE does not seem to have trouble with the port open/close and the speed of the port open/close on my system seems to depend some on what code the M0 had been running.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@ivankravets
Copy link
Member

Could you reproduce this issue with the latest upstream version?

@ivankravets
Copy link
Member

Please reopen if you still need help

@jlillest
Copy link

I have this same problem on linux.

Operating system: Ubuntu 18.04 linux 4.15.0-34
PlatformIO Version: 3.6.0

platformio.ini

[env:adafruit_feather_m0]
platform = atmelsam
board = adafruit_feather_m0
framework = arduino

plaformio run --target upload output:

Looking for upload port...
Use manually specified: /dev/ttyACM1
Forcing reset using 1200bps open/close on port /dev/ttyACM1
Waiting for the new upload port...
Uploading .pioenvs/adafruit_feather_m0/firmware.bin
No device found on ttyACM1

The above error happens about 90% of the time, and will upload ok the rest of the time. Getting boards programmed only works by hitting the reset button at random times, and trying the upload at random times and cycling until it actually programs. Then I repeat the process to get the monitor command to see the serial output.

Any help would be appreciated.

@ivankravets ivankravets reopened this Oct 10, 2018
@jlillest
Copy link

This seems to be a problem in the 1200baud sync. Can someone point me in the right direction for making changes to test?

@ivankravets
Copy link
Member

ivankravets commented Oct 16, 2018

How did you install PIO Core? You can try to tune WaitForNewSerialPort.

@sichgeis
Copy link

sichgeis commented Nov 11, 2018

I experience a problem similar to the one reported by @jlillest . But for me it never works. Also random resetting and un- and re-plugging does not help.

I am running PlatformIO from the VSCode in version 3.6.2a2.

When trying to upload a minimal sample to the adafruit_feather_m0 board I get the following error:

Configuring upload protocol...
AVAILABLE: atmel-ice, blackmagic, jlink, sam-ba
CURRENT: upload_protocol = sam-ba
Looking for upload port...
Auto-detected: /dev/ttyUSB0
Forcing reset using 1200bps open/close on port /dev/ttyUSB0
Waiting for the new upload port...
Uploading .pioenvs/adafruit_feather_m0/firmware.bin
No device found on ttyUSB0
*** [upload] Error 1

For now I am resorting to the ArduinoIDE, with which the upload to the board works without problems.

Any help will be highly apreciated.

I have also tried using a windows machine which resulted in the same error:

Looking for upload port...
Auto-detected: COM4
Forcing reset using 1200bps open/close on port COM4
Waiting for the new upload port...
Uploading .pioenvs\adafruit_feather_m0\firmware.bin
No device found on COM4
*** [upload] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants