Quick Start Guide/Flashing
Contents
Requirements
- the previously selected board, e.g. AVR NET-IO, ready built and (hopefully) tested
- an ISP-Programmer of your choice supported by avrdude
- ISP connector cable
Flashing with avrdude
Avrdude offers several options. We will look on the most important, to make basic flashing of ethersex possible.
- The chip you use, should be m32 for the ATMega32 in most cases: -p m32
- Debug messages: -v
- The protocol spoken with the programmer, for the Evaluation-Board: -c ponyser
- The serial port the programmer is connected to: -P /dev/ttyS0
- The command you want to execute: -U flash:w:ethersex.hex
After you checked all options and adjusted them to your settings you should have a command like this:
avrdude -v -p m32 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex
Writing the Bytes
- Disconnect the power from the NET-IO
- Connect your ISP cable to the programmer and the Net-IO
- Reconnect the power and connect your programmer to the PC
- Execute the command you assembled earlier
- Congratulations! If avrdude finished without any error you successfully flashed ethersex to your Net-IO!
- Disconnect the power and the programmer from the Net-IO
- Reconnect the power, your Net-IO should boot up with ethersex
/* PAGE UNDER CONSTRUCTION */
Since 16c2a388ec the Ethersex makefile supports two new targets, program and fuses, to invoke avrdude. The target program calls avrdude with the options to flash the previously compiled ethersex.hex to the MCU. The fuses target may be used to program the MCUs fuse registers.
AVRDUDE options and MCU fuse register settings may be configured via a menuconfig dialog. All settings will be saved to the current profile .config.
Available settings and choices on the AVRDUDE configuration page depend on the MCU and clock frequency configured on the General Setup dialog. Please go back to the previous step if you haven't done that yet.
AVRDUDE Configuration
If - and only if - the avrdude executable could be found in your PATH, menuconfig's mainmenu will show an option to enter AVRDUDE configuration:
The AVRDUDE configuration page allows to setup the most common options for avrdude:
- Programmer Type
- avrdude option '-c'.
- Use the programmer configuration choosen from the list.
- Refer to the official avrdude documentation if you're in doubt about the correct choice for your programmer (avrdude home).
- NB: The list of choices is generated by calling 'avrdude -c ?' and contains all the programmers your avrdude executable supports.
- Port
- avrdude option '-P'.
- Specify the port the programmer is connected to. Serial devices like ponyprog use for example /dev/ttyS0 (= COM1 under Windows!), most modern programmers use usb.
- Note that most old-style serial programmers will not work properly when connected to an USB-serial-Adapter!
- Extra verbose output
- avrdude option '-v -v'.
- Be more verbose. Default is '-v'. Use this, if you experience problems while flashing or simply want to see in detail whats going on...
- Do NOT verify after programming
- avrdude option '-V'.
- Do NOT verify flash memory after programming. Use with care and only if you're really sure that your setup is perfect. Speeds things up a bit but it's use is generally discouraged.
- Count # of erase cycles in EEPROM
- avrdude option '-y'.
- Tell avrdude to maintain an erase cycle counter in the last four bytes of the eeprom. The counter has to be initialized by calling avrdude with the option '-Y 1' once.
- Do not use this option if your e6 configuration uses the last four bytes of the eeprom.
- Bitclock for ISP or JTAG
- avrdude option '-B'.
- Specify the bit clock period for the JTAG interface or the ISP clock.
- Setting a lower value means higher programming speed. Use higher values if you experience programming errors in your setup.
- The available choices depend on the MCU frequency setting and should not exceed 4/F_CPU in micro seconds:
-
- 4 micro seconds is required for F_CPU < 4 MHz.
- 1 micro second is appropriate for F_CPU < 10 MHz.
- 0.5 micro seconds is appropriate for F_CPU < 16 MHz.
- 0.3 micro seconds is appropriate for F_CPU >= 16 MHz.
- Pass extra options to avrdude
- If your programmer or setup requires any extra options to avrdude you may pass them here.
AVR Fuses
The fuse registers enable/disable or control the basic functionality of the different units of the MCU. One can e. g. enable or disable the Watchdog, the JTAG interface or even the ISP Interface. Configuration of the MCUs clock source or the brown-out detector is also done via the fuse registers.
WARNING: Programming wrong fuse values may render your MCU UNUSABLE (...unless you've access to a JTAG- and/or HV-Programmer.)
There is nothing like the universal correct fuse setting or a default fuse setting. Fuse registers are MCU-specific and their correct settings heavily depend on the circuit and parts in use. Be careful and read the datasheet for the MCU acually in use and think twice what is correct for YOUR hardware!!
- Fuse Low Byte (FLB)
- AVR Fuse Low Byte, two-digit hex value.
- Fuse High Byte (FHB)
- AVR Fuse High Byte, two-digit hex value.
- Extended Fuse Byte (EFB)
- AVR Extended Fuse Byte, two-digit hex value.
The necessary hex values for the fuse registers might be calculated with e.g. an online AVR fuse calculator.
Article on mikrocontroller.net for reference (german only, sorry).