简体   繁体   中英

Arduino Mega2560 can't be programmed repeatedly using avrdude

I have a sketch for a mega2560 board that I can upload successfully using the Arduino IDE using the upload button but I would prefer to use a script using avrdude. The only problem is if I try to run avrdude more than once to flash the board it get's a stk500v2_ReceivedMessage(): timeout. It doesn't happen every time but enough. The only way the avrdude seems to work again is if I update the same sketch using the Arduino IDE.

I was having trouble finding what the Arduino IDE does to upload a file but all the settings I could find suggest that avrdude is doing it the same way.

Verbose compilation and upload can be enabled in Arduino IDE Settings:

File->Preferences->Show verbose output during:  [] compilation  [x] upload.

It will show complete commands used for upload and the avrdude should be same or you can use the same avrdude.exe . You should see something like:

C:\arduino\hardware\tools\avr/bin/avrdude -CC:\arduino\hardware\tools\avr/etc/avrdude.conf -v -V -patmega2560 -cwiring -PCOM17 -b115200 -D -Uflash:w:C:\Users\kiiv\AppData\Local\Temp\build658cdf44885ca2a8676f164a933c092f.tmp/MAX7219_4x4x4.ino.hex:i 

BTW: I've just started with PlatformIO CLI (command line tool) and I'm loving it.

PlatformIO IDE didn't work well for me, as I'm using czech keyboard layout and keystrokes prevents me to write all essential characters like []{}#& without switching it to english one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM