MCUdude / microUPDI

DIY UPDI programmer with open source hardware!
66 stars 11 forks source link

Flashing firmware times out, then bricks board #8

Open maxgerhardt opened 3 years ago

maxgerhardt commented 3 years ago

Using a brand new Pro Micro 5V board from here, plugging it into the computer and following the instructions from here give me a timeout after maybe 60 seconds.

Der Sketch verwendet 0 Bytes (0%) des Programmspeicherplatzes. Das Maximum sind 28672 Bytes.
Globale Variablen verwenden 0 Bytes (0%) des dynamischen Speichers, 2560 Bytes für lokale Variablen verbleiben. Das Maximum sind 2560 Bytes.
Erzwinge Reset durch öffnen/schließen mit 1200 bps auf dem Port COM30
PORTS {COM1, COM30, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, COM31, } => {COM31, }
Found upload port: COM31
C:\Users\Max\AppData\Local\Arduino15\packages\microUPDIcore\hardware\avr\1.0.1/scripts/avrdude-wrapper.bat C:\Users\Max\Desktop\Programming Stuff\arduino-1.8.13\hardware\tools\avr/bin/avrdude C:\Users\Max\Desktop\Programming Stuff\arduino-1.8.13\hardware\tools\avr/etc/avrdude.conf atmega32u4 avr109 COM31 57600 C:\Users\Max\AppData\Local\Arduino15\packages\microUPDIcore\hardware\avr\1.0.1 C:\Users\Max\AppData\Local\Temp\arduino_build_545881 
Beim Hochladen des Sketches ist ein Fehler aufgetreten

The lines saying

Sketch uses 0 Bytes of program memory. The maximium is 28672 bytes.
Global variables use 0 Bytes..
Forcing reset by opening/closing at 1200bps on COM30
[...]
Found upload port: COM31
[command]
An error occured while uploading the sketch.

^After that I still have COM31 but consequent upload attempts yield

Erzwinge Reset durch öffnen/schließen mit 1200 bps auf dem Port COM31
processing.app.debug.RunnerException
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:152)
    at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
    at processing.app.SketchController.upload(SketchController.java:732)
    at processing.app.SketchController.exportApplet(SketchController.java:703)
    at processing.app.Editor$UploadHandler.run(Editor.java:2071)
    at java.lang.Thread.run(Thread.java:748)
Caused by: processing.app.SerialException: Fehler beim Ansprechen des seriellen Ports "COM31".
    at processing.app.Serial.touchForCDCReset(Serial.java:107)
    at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:136)
    ... 5 more
Caused by: jssc.SerialPortException: Port name - COM31; Method name - openPort(); Exception type - Port busy.
    at jssc.SerialPort.openPort(SerialPort.java:164)
    at processing.app.Serial.touchForCDCReset(Serial.java:101)
    ... 6 more

I then have to manually kill the avrdude.exe process.

After that, my board isn't recognized by my PC anymore.

Trying to connect a button between RST and GND and pressing it once or twice after the USB plug is inserted also doesn't make a difference. (Or holding RST during insertion and then releasing it).

I'll try and recover my board using an external programmer, but I at least want to document that this was happening to a stock board.

MCUdude commented 3 years ago

I've bought my Pro Micro clones from China, and I've never had any issues. Maybe the bootloader is slightly different. In the past, I've had issues with my Olimex Leonardo board that would only accept the Arduino Micro bootloader, and not the Leonardo one. Perhaps this is something that may relate to this as well? I don't know...

You can always re-flash the Pro micro bootloader again using an external programmer, so it isn't really "bricked". What happens if you re-burn the bootloader and just run the avrdude command shown in the IDE output window?

Bottom line: The reason why I don't use the Pro Micro or the Leonardo for tinkering is that the bootloader tends to be very picky sometimes. It's definitely not as reliable as an Arduino UNO (or any AVR microcontroller running the Optiboot bootloader).