arduino / arduino-cli

Arduino command line tool
https://arduino.github.io/arduino-cli/latest/
GNU General Public License v3.0
4.27k stars 371 forks source link

Error uploading to STM32 Ladybug L432KC board #1084

Open eloquentarduino opened 3 years ago

eloquentarduino commented 3 years ago

Bug Report

When uploading to the Ladybug L432KC board with the arduino-cli, I sometimes get an error.

Current behavior

This is the output from the cli:

arduino-cli upload -b grumpyoldpizza:stm32l4:Ladybug-L432KC -p /dev/tty.usbmodem1411 --verify
Open On-Chip Debugger 0.10.0-dev-00272-gf17dc4a (2016-10-10-09:57)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 500 kHz
adapter_nsrst_delay: 100
none separate
none separate
Error: open failed
in procedure 'program'
in procedure 'init' called at file "embedded:startup.tcl", line 473
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked

Expected behavior

I expect the upload to succeed.

Environment

Additional context

This happens most often after I read the serial output from the board via Python's pySerial library.

ubidefeo commented 3 years ago

@eloquentarduino this might very well be an issue with a serial port not being released properly. I run Mac OS myself and have learned over the years that Darwin gets very possessive of UARTs to the point that sometimes I had BSOD when unplugging a board.

Make sure you dispose of your Serial connections properly. Sometimes resetting a board might do the trick for you, forcing PySerial to throw an exception if it's still hung on the port.

I doubt this is a bug on arduino-cli, but keep us posted with your findings. u.