0
\$\begingroup\$

I need to read the flash of an atmega8 chip. I program the chip with a working program, verification passes. Then I try to read the chip contents with the command below, and the read fails.

vorac@laptop:~/recorded$ sudo avrdude -p atmega8 -c usbasp -U flash:r:flash-image

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e9307
avrdude: reading flash memory:

Reading | ################################################## | 100% 2.32s

avrdude: writing output file "flash-mage"
avrdude: error opening flash-mage: No such file or directory
avrdude: output file flash-mage auto detected as invalid format
avrdude: invalid output file format: -1
avrdude: write to file 'flash-mage' failed

avrdude: safemode: Fuses OK (H:FF, E:DD, L:E4)

avrdude done.  Thank you.

vorac@laptop:~/recorded$ ll flash-image 
-rw-r--r-- 1 root root 0 ное  5 10:29 flash-image

What is wrong? Something with permissions on my Ubuntu box? The file flash-image does not exist before running avrdude. I tried adding suffixes .bin and even .hex to flash-image, but the error is still there.

Also, no chip locking is programmed.

    # Default for the atmega8 is lfuse:E1, hfuse:D9
    # Low fuse for 8MHz clock: E4
    # High fuse with 512 bytes bootloader, start at application start: DD
\$\endgroup\$
1
\$\begingroup\$
-U memtype:op:filename[:format]

Writing the flash memory does not require specifying the last field, because avrdude can detect it from the input file. However, for reading, there is not input file, so the format must be specified. For example, my command above becomes

sudo avrdude -p atmega8 -c usbasp -U flash:r:flash-image:r

for a raw binary. Silly question indeed, but as the error was un-ggolable, this answer could save someone 1 minute of their lives.

\$\endgroup\$

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.