2
\$\begingroup\$

I've been working with AVR microcontrollers (specifically with ATmega328p's) for a bit and I got an ATmega32u4 that I wanted to program it to be used as a USB peripheral. However there is one problem: when I tried to flash a basic LED blink script to the AVR, AVRDUDE started sending back this weird error message:

avrdude.exe: verifying ... avrdude.exe: verifying ... avrdude.exe: verification error, first mismatch at byte 0x0000 0x00 != 0x0c avrdude.exe: verification error; content mismatch 

Note: before AVRDUDE gets to this point it reads the device signature and writes the hex files that I sent to it. Like normal.

After it does this, it tells me that the lock bit values have changed and I should either leave them alone or restore them to default. (The lock bits are never really the same and not all of them have to be changed.)

I don't know if this is an AVRDUDE issue or a programmer issue. I hope it's not the latter, as it's a new USBasp.

\$\endgroup\$
7
  • \$\begingroup\$ Hi, can you ask a question you want answered? \$\endgroup\$ Commented Jan 24, 2023 at 20:29
  • \$\begingroup\$ Assuming the problem is the verification error (and presumably the programming not sticking either?), try looking at the fuses, especially JTAG and ISP settings, and clock. \$\endgroup\$ Commented Jan 24, 2023 at 21:01
  • \$\begingroup\$ Hi, sorry if I wasn't specific. I just want to know why I was getting this verification error. and @TimWilliams how do I look at the fuses? (Note: I'm using Avrdude 7.1 and I'm using it as an external Atmel studio tool.) \$\endgroup\$ Commented Jan 24, 2023 at 21:27
  • \$\begingroup\$ Use -U lfuse:r:CON:b and hfuse, or whichever locations are applicable to the device. You'll have to look up the bit positions in the manual. Usually Atmel Studio integrates this in the programming dialog (I haven't used it in forever). \$\endgroup\$ Commented Jan 24, 2023 at 23:02
  • 1
    \$\begingroup\$ Always check the manual: nongnu.org/avrdude/user-manual/avrdude_3.html \$\endgroup\$ Commented Jan 24, 2023 at 23:31

2 Answers 2

2
\$\begingroup\$

I figured it out! (after a whole day of troubleshooting) it turns out that the supply current from my programmer was insufficient for programming. resulting in a verification error. I used an external power supply (which I believe has a higher output current) to power the microcontroller instead, and it worked! Thanks to everyone who commented above I'm still new to this site so forgive my incorrect etiquette.

\$\endgroup\$
0
\$\begingroup\$

For me helped changing Vcc from 5V to 3.3V. Perhaps this is because by default Atmega328P runs at 1MHz

\$\endgroup\$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.