AVRDUDE verification error content mismatch when flashing atmega328p

I thought I'd finally learn rust and what better than to do it on the trusted 328.

I followed the AVR-Rust guidebook:

rustup toolchain install nightly
rustup component add rust-src --toolchain nightly
git clone https://github.com/avr-rust/blink.git
cd blink

rustup override set nightly

export AVR_CPU_FREQUENCY_HZ=16000000

cargo build -Z build-std=core --target avr-atmega328p.json --release

Then I try to flash it:

avrdude -patmega328p -c avrispmkii -P usb:69:98 -b115200 -D -Uflash:w:target/avr-atmega328p/release/blink.elf:e

And I get the following error:

avrdude: verification error, first mismatch at byte 0x0006
         0x10 != 0x51
avrdude: verification error; content mismatch
  • I tried to flash a equivalent C program and it works.
  • I tried another board, same result.

Also ELF?

1 Like

Thank you!

I went back and double checked and now I couldn't get anything flashed.

I went and got another avrdude command( from here Simple AVR Makefile template · GitHub) and now it works for C and Rust.


I suspect the -D option, prevent auto chip erase, in the avr-rust example could've been the problem.

1 Like

Ooh. Yeah. That should basically never be used with a processor that stores the program in Flash (all AVR processors). Each write is essentially the bitwise-and of whatever happens to be already in memory. Good catch.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.