1

I have a hand-wired keyboard that uses a Pro Micro board, with an ATmega32u4 chip. I can't seem to flash firmware on it. The commands I've been trying are variations of:

avrdude -p m32U4 -P /dev/ttyACM0 -c avr109 -U flash:w:atreus62.hex

The errors I've been getting begin:

Writing | #######avrdude: error: programmer did not respond to command: set addr
####avrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: write block
 ***failed;  
 ***failed;  
 ***failed;  
 ***failed;  

And end:

#avrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
#avrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
avrdude: error: programmer did not respond to command: set addr
# | 100% 0.16s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x0d != 0x0c
avrdude: verification error; content mismatch
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: error: programmer did not respond to command: exit bootloader

I'm on Arch Linux. Any ideas?

  • Enable verbose mode, program it once with the IDE, and copy the command line it uses. – Chris Stratton Jun 16 '18 at 1:30
  • What is the IDE? – Jonathan Jun 16 '18 at 1:53
  • And what do you mean by "program it"? Could you just tell me what the avrdude command is? I don't have any IDE installed. – Jonathan Jun 16 '18 at 1:58
  • Also verbose modes -v, -vv, -vvv, and -vvvv don't really seem to affect anything. – Jonathan Jun 16 '18 at 2:02
  • 1
    You are asking a question on the Arduino site, presumably you are familiar with the Arduino tools? If not, give that a try first to validate your hardware and tools setup (before you try to do things the hard way. Use the avrdude and configuration file for it that ships with a modern Arduino IDE version, and let the IDE drive it the first time, with verbose mode selected in the dropdown menu, so you see the suitable command. – Chris Stratton Jun 16 '18 at 2:04
2

I had the same issue, and it was caused by udev, I found the answer here

It's some obscure bug

Tweaking udev rules solved the problem for me, now all is good, here is the procedure: https://learn.adafruit.com/adafruit-arduino-ide-setup/linux-setup#udev-rules

  • Had the same issue, and this fixed it for me! (mostly - I still had to use the stty commands from Majenko's answer, and run the upload a couple of times in order to get it working... but it worked!) It's a bit difficult to find this answer... – codermonkeyfuel Feb 24 at 3:25
1

There's two stages to uploading a hex file to a USB-based Arduino - and you're only doing the second stage.

The first stage is to reset the board into the bootloader so it can accept the instructions from the second stage. The IDE normally does that manually for you when you hit the UPLOAD button.

The way these boards are reset is to first open the CDC/ACM port and set the baud rate to 1200, then close the port again. That triggers the code to reset the board into the bootloader.

You can probably do it using the stty tool in Linux:

$ stty -F /dev/ttyACM0 speed 1200
$ stty -F /dev/ttyACM0 speed 115200
$ avrdude -p m32U4 -P /dev/ttyACM0 -c avr109 -U flash:w:atreus62.hex

The second stty may not actually be needed, but it's good to reset the baud rate to a normal value ready for uploading. I don't have a board to hand right now to test it though.

  • Those commands don't seem to help, sadly. They both return 9600, if that's at all helpful. I'm still getting "programmer did not respond" errors. – Jonathan Jun 16 '18 at 13:41
  • The return value is the value it was before changing it. The second should return 1200 not 9600. You can try using stty -F /dev/ttyACM0 ospeed 1200 ispeed 1200 instead. – Majenko Jun 16 '18 at 13:42
  • That doesn't seem to help either, I'm afraid. – Jonathan Jun 16 '18 at 20:09
  • 1
    Have you had it working in the IDE at all? – Majenko Jun 16 '18 at 20:10
  • I'm at a loss for how to upload .hex files to a chip using the IDE. (And furthermore the IDE is almost totally useless to me, since the UI isn't HiDPI-friendly.) – Jonathan Jun 17 '18 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.