platform-atmelavr
platform-atmelavr copied to clipboard
Uploading to any ATMega 32u4 based board is still broken
The version of avrdude used by PlatformIO or some of the configuration must be wrong, because it's trivially easy to brick Leonardo and Pro Micro boards by just by uploading to them. I've done this with several different boards. The upload fails, and the board doesn't register as a USB device any more, and it takes an AVRISP to rescue it.
I'm unclear on why this happens, but it's a major issue since it has the potential to stop people who don't own separate programmers from using their boards afterwards, effectively destroying them.
I've been able to "brick" my Leonardo several times through Arduino IDE too.
Can you post the complete Avrdude command that PlatformIO uses to upload? This would be the first step to figure out what's going on.
BTW how many times can you usually upload to it before the bootloader is toast and needs to be reloaded? One time? 20 times?
Are you pushing the reset button right after you click upload? I remember having to do that. Search the net.
I tried resetting my Pro Micro right after uploading, no effect. After many hours searching and trying proposed fixes, I ended up reinstalling VSCode and Platformio, no effect. The workaround that finally worked for me was uploading my code via VSCode and Platformio through an Arduino Uno (configured as ISP).
Here are my 2 cents. My setup is VScode 1.47.1, Windows 10, and am using Arduino Micro bootloader and configuration (Not MegaCore).
I've found on my custom ATmega32u4 board that "Upload" or "Upload and Monitor" can be unreliable for uploading a sketch, sometimes it works for me but most of times it doesn't.
What usually works for me is using "Verbose Upload". I don't know the details of why this would be different from the "Upload" button.
To open the Serial Monitor only the option "Monitor" ever works, "Upload and Monitor" never works for me.
If I can help any further with this issue, please let me know how. 👍
Users are still reporting upload failures for Atmega32U4 (e.g. Leonardo) boards (example). This has to be reinvestigated I think.
Yep. Arduino Leonardo and Micro Pro doesn't upload. Times out and requires manual reset while looking for the new upload port.
Comment from here:
I don’t know why exactly, but on SOME pcs it just waits far too long (until the Arduino goes out of the bootloader) and only THEN tries to upload it, causing it to avrdude: ser_open(): can’t open device “.\COM5”.
A workaround is to manually reset the Arduino multiple times when it’s looking for the “New upload port” and if you do it in the right time, it recognizes it and uploads the firmware.
It’s annoying and only happens on some PCs.
I have had this issue and managed to resolve it by disabling the Bluetooth connection on my laptop, which was using two COM ports. With Bluetooth disabled the upload is as fast/faster than with the Arduino IDE.
I have had this issue and managed to resolve it by disabling the Bluetooth connection on my laptop, which was using two COM ports.
That's interesing! I definitively gonna check that and report back. My computer has Bluetooth and uses some COM ports.
This is still a problem. I used the search and found reports from 2015 so this is going on for a while now :)
The leonardo board setting works for uploading. It locks up the board when you use the Serial. Looking at the LED's I think it locks up sending. If I switch to the Arduino IDE the serial monior also does not work if the code is uploaded by platformio. If I upload in the Arduino IDE and then switch to platformio to monitor it, the monitoring works.
[env:leonardo]
platform = atmelavr
board = leonardo
framework = arduino
Switching to the Arduino IDE it is all smooth and stable from the get-go so it's not the board. I remember the bricking platformio did on the 32U4 but have not experienced it myself this time.
I did some tests with monitor_dtr and monitor_rts but I don't notice any change.
I just brought out my ProMicro (ATMega32U4, 3.3V version, 8MHz clock) and I'm having zero problems.
[env:sparkfun_promicro8]
platform = atmelavr
board = sparkfun_promicro8
framework = arduino
with code
#include <Arduino.h>
void setup() { Serial.begin(9600); }
void loop() { Serial.println("Hello from ATMega32U4!"); delay(1000); }
Upload works just fine
>pio run -t uplaod
...
avrdude: verifying ...
avrdude: 3610 bytes of flash verified
avrdude: safemode: Fuses OK (E:CE, H:D8, L:FF)
avrdude done. Thank you.
And when I
>pio device monitor
--- Available filters and text transformations: colorize, debug, default, direct, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at http://bit.ly/pio-monitor-filters
--- Miniterm on COM19 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
Hello from ATMega32U4!
Hello from ATMega32U4!
--- exit ---
Literally 0 problems.
What exact board do you have @Thijxx?
I use a Arduino Nano clone from the usual Chinese webshop. I see you use an other board setting, maybe I can give that a try.
An Arduino Nano has an ATMega328 (typically), not the USB-enabled ATMega32u4.
Yes I know but these have the 32u4, I can read the text on the chip. They have worked in the past, two years ago I think. I used the same platformio.ini so I was expecting the same results.