6
\$\begingroup\$

Is it possible to write EEPROM bytes via AVRDUDE and an AVRISP mkII directly from the command line without needing an EEPROM file read from another chip? Kind of like how you can specify the fuse bytes directly at the command line.

I need to be able to change a single byte of the EEPROM but would rather not mess with a file.

\$\endgroup\$
1
  • \$\begingroup\$ I'm not an AVRDUDE user so can't test it but try -U eeprom:w:0x55:m and see if you get 0x55 in the first EEPROM byte. \$\endgroup\$
    – PeterJ
    Commented Jul 2, 2013 at 4:27

2 Answers 2

8
\$\begingroup\$

The avrdude write command (-U) knows an 'immediate' mode (see the manual), which allows you to specify the bytes to be written directly.

The syntax is like

avrdude -U eeprom:w:0xff:m

But this mode doesn't allow you to specify the address of the byte to be written, so I presume it will start writing at address zero. This works great for fuses (where instead of 'eeprom' you use 'hfuse', 'lfuse' or 'efuse'), but not so much for real memory.

But you can always create a hex file (e.g. INTEL Hex records containing just the single byte with the address you need to change.

\$\endgroup\$
3
  • \$\begingroup\$ OK... that's what I was hoping. I'll give it a shot. I don't need to specify the address since I only have one byte I need and it will always be at address 0. \$\endgroup\$
    – Adam Haile
    Commented Jul 2, 2013 at 10:42
  • \$\begingroup\$ You might also see if you could (perhaps with shell or /dev tricks) get it to read a pipe as input. Worst case, it's open source so you can add the missing features ;-) \$\endgroup\$ Commented Jul 2, 2013 at 18:47
  • \$\begingroup\$ You can't do it with offsets, the files are small enough that you could put every byte on a long command line with copy and paste, or in a bash script. \$\endgroup\$
    – mckenzm
    Commented Aug 15, 2019 at 6:10
0
\$\begingroup\$

Solution on Linux: write 0x10 to eeprom address 0x50

avrdude -t << END
write eeprom 0x50 0x10
quit
END
\$\endgroup\$
1
  • \$\begingroup\$ Nice - a terminal mode and a here document. Someone like the original poster might prefer instead to pipe the data in from a script generating it and invoking avrdude, but the avrdude mode is the important part. \$\endgroup\$ Commented Jul 14, 2020 at 14:18

Your Answer

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

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