stm32duino/Arduino_Tools

upload-reset timeout for particular sketch in linux

freynder opened this issue · 2 comments

Hi,

When an uploaded sketch contains a while loop waiting for serial usb to connect such as:

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }
}

the stm32duino bootloader does not work anymore. I've isolated the problem to upload-reset which produces the following error:

freynder@desktop:~/$ ./upload-reset /dev/ttyACM0
setDTR: TIOCMSET: Connection timed out
setDTR: TIOCMSET: Protocol error
setRTS(): TIOCMSET: Protocol error
setDTR: TIOCMSET: Protocol error
setDTR: TIOCMSET: Protocol error

OS is Ubuntu 18.04. Board: blue pill.

When I upload a new sketch (using serial upload) without the while loop, the stm32duino bootloader functions as normal again for subsequent uploads.

Other users were unable to reproduce.
New tests show that the problem does not happen when only using Arduino IDE but probably using PlatformIO corrupts something which then affects the uploader in Arduino IDE. Will close for now until the issue can be better identified. Thank you.