Avrdude

From Attie's Wiki
(Difference between revisions)
Jump to: navigation, search
m
m
 
(9 intermediate revisions by 3 users not shown)
Line 2: Line 2:
 
<pre>
 
<pre>
 
$ man avrdude
 
$ man avrdude
 +
</pre>
 +
 +
<h2>See Also</h2>
 +
[[avr-gcc]]<br>
 +
[[bus pirate]]<br>
 +
[[atmega328p]]<br>
 +
http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/
 +
 +
<h2>Useful Lines</h2>
 +
<h3>For using the Arduino bootloader</h3>
 +
<pre>
 +
$ avrdude -c stk500v1 -P /dev/ttyUSB1 -p m328p -y -U flash:w:main.hex
 +
$ avrdude -c stk500v1 -P /dev/ttyUSB1 -p m328p -y -U flash:r:main.hex:i
 +
$ avrdude -c stk500v1 -P net:localhost;27015 -p m328p -y -U flash:r:main.hex:i
 +
</pre>
 +
<h3>For using the buspirate</h3>
 +
<pre>
 +
$ avrdude -c buspirate -P /dev/ttyUSB1 -p m328p -y -U flash:w:main.hex
 +
$ avrdude -c buspirate -P /dev/ttyUSB1 -p m328p -y -U flash:r:main.hex:i
 
</pre>
 
</pre>
  
 
<h2>Parameters</h2>
 
<h2>Parameters</h2>
 
Parameters marked with a <span style="color:red">*</span> are required.
 
Parameters marked with a <span style="color:red">*</span> are required.
<h3><span style="color:red">*</span>Programmer Type</h3>
+
<h3><span style="color:red">*</span> Programmer Type</h3>
 
* <code>-c buspirate</code> - for use with the buspirate
 
* <code>-c buspirate</code> - for use with the buspirate
 
* <code>-c stk500v1</code> - for use with the Arduino bootloader
 
* <code>-c stk500v1</code> - for use with the Arduino bootloader
 
* other (see the man page)
 
* other (see the man page)
  
<h3><span style="color:red">*</span>Programmer Port</h3>
+
<h3><span style="color:red">*</span> Programmer Port</h3>
 
* <code>-P /dev/ttyUSB1</code> - the most likely for my systems
 
* <code>-P /dev/ttyUSB1</code> - the most likely for my systems
  
<h3><span style="color:red">*</span>Part Identifier</h3>
+
<h3><span style="color:red">*</span> Part Identifier</h3>
 
* <code>-p m168</code> - for use with an ATMega168
 
* <code>-p m168</code> - for use with an ATMega168
 
* <code>-p m328p</code> - for use with an ATMega328p
 
* <code>-p m328p</code> - for use with an ATMega328p
 
* <code>-p m1280</code> - for use with an ATMega1280
 
* <code>-p m1280</code> - for use with an ATMega1280
  
<h3><span style="color:red">*</span>Burn Counter</h3>
+
<h3><span style="color:red">*</span> Burn Counter</h3>
 
Not technically required, but a good idea. The burn counter is stored in the last 4 bytes of eeprom
 
Not technically required, but a good idea. The burn counter is stored in the last 4 bytes of eeprom
 
* <code>-y</code> - to increment the burn counter each burn
 
* <code>-y</code> - to increment the burn counter each burn
Line 29: Line 48:
  
 
<h3>Terminal Mode</h3>
 
<h3>Terminal Mode</h3>
* <code>-t</code> - see [#terminal_mode] for mode
+
* <code>-t</code> - see [[#terminal_mode]] for mode
  
 
<h3>Memory Access</h3>
 
<h3>Memory Access</h3>
Line 52: Line 71:
 
* other (see the man page)
 
* other (see the man page)
  
<h2>Terminal Mode</h2>
+
<h2 id="terminal_mode">Terminal Mode Commands</h2>
 +
<h3><code>dump</code></h3>
 +
* <code>dump <i>memtype</i> <i>address</i> <i>nBytes</i></code> - dump <i>nBytes</i> from <i>address</i> in hex and ASCII
 +
* <code>dump</code> - continue for another <i>nBytes</i>
  
For ATMega168:
+
<h3><code>write</code></h3>
<pre>
+
* <code>write <i>memtype</i> <i>address</i> <i>byte1</i> <i>...</i> <i>byteN</i></code> - write to memory by hand, currently doesn't work with flash :(
$ avrdude -c buspirate -P /dev/ttyUSB1 -x speed=3 -p m168
+
</pre>
+
 
+
For ATMega328p:
+
<pre>
+
$ avrdude -c buspirate -P /dev/ttyUSB1 -x speed=3 -p m328p
+
</pre>
+
  
Terminal mode: <code>-t</code>. Use command <code>part</code> to see detailed part information.<br>
+
<h3><code>parm</code></h3>
To upload file: <code>-U memtype:op:filename[:format]</code><br>
+
* <code>part</code> - display information on the connected part
To use the arduino bootloader: <code>-c stk500v1</code>
+

Latest revision as of 20:25, 15 March 2012

For detailed info:

$ man avrdude

Contents

See Also

avr-gcc
bus pirate
atmega328p
http://doswa.com/blog/2010/08/24/avrdude-5-10-with-ftdi-bitbang/

Useful Lines

For using the Arduino bootloader

$ avrdude -c stk500v1 -P /dev/ttyUSB1 -p m328p -y -U flash:w:main.hex
$ avrdude -c stk500v1 -P /dev/ttyUSB1 -p m328p -y -U flash:r:main.hex:i
$ avrdude -c stk500v1 -P net:localhost;27015 -p m328p -y -U flash:r:main.hex:i

For using the buspirate

$ avrdude -c buspirate -P /dev/ttyUSB1 -p m328p -y -U flash:w:main.hex
$ avrdude -c buspirate -P /dev/ttyUSB1 -p m328p -y -U flash:r:main.hex:i

Parameters

Parameters marked with a * are required.

* Programmer Type

  • -c buspirate - for use with the buspirate
  • -c stk500v1 - for use with the Arduino bootloader
  • other (see the man page)

* Programmer Port

  • -P /dev/ttyUSB1 - the most likely for my systems

* Part Identifier

  • -p m168 - for use with an ATMega168
  • -p m328p - for use with an ATMega328p
  • -p m1280 - for use with an ATMega1280

* Burn Counter

Not technically required, but a good idea. The burn counter is stored in the last 4 bytes of eeprom

  • -y - to increment the burn counter each burn
  • -Y value - to initialise the burn counter

Baud Rate

Required for stk500v1

  • -b 57600 - for most of mine

Terminal Mode

Memory Access

There are others, but these are the most common

  • -U flash:operation:filename[:format] - where the firmware lives
  • -U eeprom:operation:filename[:format] - non-volatile memory
  • -U lfuse:operation:filename[:format] - low fuse byte
  • -U hfuse:operation:filename[:format] - high fuse byte
  • -U efuse:operation:filename[:format] - extended fuse byte

operation can be:

  • r - read
  • w - write
  • v - verify

filename points to the file to use

format can be:

  • a or omitted - for auto-detection
  • i - Intel Hex (output from obj-dump)
  • r - Raw binary
  • other (see the man page)

Terminal Mode Commands

dump

  • dump memtype address nBytes - dump nBytes from address in hex and ASCII
  • dump - continue for another nBytes

write

  • write memtype address byte1 ... byteN - write to memory by hand, currently doesn't work with flash :(

parm

  • part - display information on the connected part
Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox