1

I am flashing a naked ATmega32U4, but the process fails in the end where it is verifying.

avrdude -c dragon_isp -p m32u4 -P usb -U flash:w:Caterina-Micro.hex -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m -U lock:w:0x2f:m -v -B 100
avrdude: Version 6.1, compiled on Mar 23 2014 at 04:42:55
 Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
 Copyright (c) 2007-2014 Joerg Wunsch
 System wide configuration file is "/usr/local/Cellar/avrdude/6.1/etc/avrdude.conf"
 User configuration file is "/Users/SomeUser/.avrduderc"
 User configuration file does not exist or is not a regular file, skipping
 Using Port : usb
 Using Programmer : dragon_isp
 Setting bit clk period : 100.0
avrdude: usbdev_open(): Found AVRDRAGON, serno: 00A200050468
JTAG ICE mkII sign-on message:
Communications protocol version: 1
M_MCU:
 boot-loader FW version: 255
 firmware version: 7.38
 hardware version: 1
S_MCU:
 boot-loader FW version: 255
 firmware version: 7.38
 hardware version: 7
Serial number: 00:a2:00:05:04:68
Device ID: AVRDRAGON
 AVR Part : ATmega32U4
 Chip Erase delay : 9000 us
 PAGEL : PD7
 BS2 : PA0
 RESET disposition : dedicated
 RETRY pulse : SCK
 serial program mode : yes
 parallel program mode : yes
 Timeout : 200
 StabDelay : 100
 CmdexeDelay : 25
 SyncLoops : 32
 ByteDelay : 0
 PollIndex : 3
 PollValue : 0x53
 Memory Detail :
 Block Poll Page Polled
 Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
 ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
 eeprom 65 20 4 0 no 1024 4 0 9000 9000 0x00 0x00
 flash 65 6 128 0 yes 32768 128 256 4500 4500 0x00 0x00
 lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
 hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
 efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
 lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
 calibration 0 0 0 0 no 1 0 0 0 0 0x00 0x00
 signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
 Programmer Type : DRAGON_ISP
 Description : Atmel AVR Dragon in ISP mode
 Vtarget : 5.0 V
 SCK period : 100.37 us
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.16s
avrdude: Device signature = 0x1e9587
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as D8
avrdude: safemode: efuse reads as CB
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
 To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Caterina-Micro.hex"
avrdude: input file Caterina-Micro.hex auto detected as Intel Hex
avrdude: writing flash (32730 bytes):
Writing | ################################################## | 100% 62.28s
avrdude: 32730 bytes of flash written
avrdude: verifying flash memory against Caterina-Micro.hex:
avrdude: load data flash data from input file Caterina-Micro.hex:
avrdude: input file Caterina-Micro.hex auto detected as Intel Hex
avrdude: input file Caterina-Micro.hex contains 32730 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 152.35s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0002
 0x66 != 0x6e
avrdude: verification error; content mismatch
avrdude: safemode: lfuse reads as FF
avrdude: safemode: Verify error - unable to read hfuse properly. Programmer may not be reliable.
avrdude: safemode: lfuse reads as FF
avrdude: safemode: Verify error - unable to read hfuse properly. Programmer may not be reliable.
avrdude: safemode: Sorry, reading back fuses was unreliable. I have given up and exited programming mode
avrdude done. Thank you.

I get another verification error when i program without fuses:

avrdude -c dragon_isp -p atmega32u4 -P usb -U flash:w:Caterina-Micro.hex -u
avrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.16s
avrdude: Device signature = 0x1e9587
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
 To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "Caterina-Micro.hex"
avrdude: input file Caterina-Micro.hex auto detected as Intel Hex
avrdude: writing flash (32730 bytes):
Writing | ################################################## | 100% 69.60s
avrdude: 32730 bytes of flash written
avrdude: verifying flash memory against Caterina-Micro.hex:
avrdude: load data flash data from input file Caterina-Micro.hex:
avrdude: input file Caterina-Micro.hex auto detected as Intel Hex
avrdude: input file Caterina-Micro.hex contains 32730 bytes
avrdude: reading on-chip flash data:
Reading | ################################################## | 100% 178.10s
avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
 0x04 != 0x0c
avrdude: verification error; content mismatch
avrdude done. Thank you.
asked Feb 10, 2015 at 17:16
12
  • can you try without setting the fuses? Commented Feb 10, 2015 at 18:12
  • Have you retried the same command several times? It can happen sometimes that the command fails due to a bad serial connection. Commented Feb 10, 2015 at 22:04
  • @Treesrule14, i tried without the fuses and the result is the same. Verification error. Although it seems like something goes right as the boards LED starts blinking. But i am absolutely not confident with the flashing. Commented Feb 11, 2015 at 8:23
  • @jfpoilpret, i have tried so many times that i stopped counting :-/ Commented Feb 11, 2015 at 8:35
  • Does your board have any additional curcuitry connected to the SPI pins? Commented Feb 11, 2015 at 13:13

2 Answers 2

0

I think you need to pass the option -u to disable safe mode, see the avrdude documentation. Under the -u option the manual states:

If you want to change fuses you will need to specify this option

answered Feb 11, 2015 at 10:30
6
  • I tried to pass avrdude -c dragon_isp -p m32u4 -P usb -u -U flash:w:Caterina-Micro.hex -U lfuse:w:0xff:m -U hfuse:w:0xd8:m -U efuse:w:0xcb:m -U lock:w:0x2f:m with the -u option, but instead i am getting a bunch of avrdude: stk500v2_jtagmkII_recv(): failed. On the SPI line i also have another SPI device connected, which is seperated by 100Ohm resistors, so i am not expecting that its causing any problems? Commented Feb 11, 2015 at 10:38
  • I remember getting that same error programming with the dragon via avrdude. From memory, it was due to some kind of wiring problem. Not sure about the other SPI device, but working with the simplest possible circuit will always make it easier to debug. Commented Feb 11, 2015 at 10:45
  • ISP wiring problem perhaps? The thing is that the bootloader has been uploaded to the MCU once in a while, which is quite odd if theres a wiring error. Commented Feb 11, 2015 at 10:46
  • I meant a bad connection, which may still work intermittently Commented Feb 11, 2015 at 10:56
  • I will try to change the ISP cable and see if it does anything. I have changed USB cables just to verify that its not an issue. Commented Feb 11, 2015 at 11:01
0

I literally gave up and got myself a Atmel-ICE which solved all my problems.

answered Feb 15, 2015 at 10:22

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.