Difference between revisions of "Quick Start Guide/Flashing"

From Ethersex_Wiki
Jump to: navigation, search
(Replaced the copy of "Flashing" with a short summary.)
Line 1: Line 1:
 
{{i18n|Flashing}}
 
{{i18n|Flashing}}
  
= Flash AVR Net-IO with "ATMEL Evaluations-Board" made by Pollin=
+
= Requirements =
  
As a beginner it's difficult to understand everything in terms of flashing.
+
* AVR NET-IO
And it's also difficult to find all information.
+
* ISP-Programmer (we're using a Evaluation-Board made by Pollin)
 +
* 10-pin connector cable (from Evaluation-Board to the NET-IO)
  
== What's needed? ==
+
= Flashing with avrdude =
* AVR Net-IO
 
* ATMEL Evaluation-Board
 
* a 1 on 1 Cable for the [[ISP]]-Port (10-pin Connector).
 
  
=== Other ISP Programmers ===
+
Avrdude offers several options. We will look on the most important, to make basic flashing of ethersex possible.
  
If you have a ISP-Programmer with 6-pin port you can create an adaptor. You can see the pin configuration in figure 4-1 at page 5 [http://www.atmel.com/dyn/resources/prod_documents/doc2521.pdf AVR042: AVR Hardware Design Considerations].
+
  * 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
  
Warning: Pin 4 of the 10-pin connector is not used on the Net-IO. GND has to be connected to one of the other Pins (6, 8 or 10)
+
After you checked all options and adjusted them to your settings you should have a command like this:
  
== Flashing with Linux ==
+
  avrdude -v -p m32 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex
*Connect the 10-pin Cable to the ISP-Connector.
 
*Plug in the power adaptor of the AVR Net-IO.
 
*If everything is connected right, the yellow LED of the Evaluation-Board is shining.
 
  
After compiling the ethersex.hex you can flash it with avrdude. The following commands depend on your ISP-Programmer. This example is for a serial connection:
+
= Writing the Bytes =
  
   avrdude -v -p m32 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex
+
   * Disconnect the power from the NET-IO
 
+
   * Connect your ISP cable to the programmer and the Net-IO
For a USB-ISP-Programmer this command should be used:
+
   * Reconnect the power and connect your programmer to the PC
 
+
   * Execute the command you assembled earlier
  avrdude -v -p m32 -c stk500v2 -P /dev/ttyACM0 -U flash:w:ethersex.hex
+
   * 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
For a parallel ISP-Cable:
+
  * Reconnect the power, your Net-IO should boot up with ethersex
 
 
  avrdude -p m32 -e -c stk200 -U flash:w:ethersex.hex
 
 
 
After flashing remove the ISP-Cable and interrupt the power connection for a short time to reboot the board.
 
 
 
  * -p m32: ATMega32; -p m644: ATMega644
 
   * -v: display debug messages
 
  * -c ponyser: the way avrdude speaks with the Evaluation Board; -c stkk500v2 for the Atmel board
 
   * -P /dev/tty.serial the serial port your programmer is connected to; -P COM1 for windows machines
 
   * -U the command you want to execute. In our case we want to flash: -U flash:w:ethersex.hex
 
 
 
In some cases you have to set the FUSE Bits, which is possible with this command:
 
 
 
   * -U lfuse:w:0xCF:m -U hfuse:w:0xDC:m
 
 
 
To get the correct FUSE-Settings you should visit http://www.engbedded.com/fusecalc/
 
 
 
Parameters for MyAVR mySmartusb light (the -e is important):
 
  avrdude -p m32 -e -c stk500v2  -P /dev/ttyUSB0 -U flash:w:ethersex.hex
 
 
 
== Replace ATMega32 with an ATMega644, ATMega644p or ATMega1284p ==
 
 
 
ATMega644, ATMega644p and ATMega1284p have got a bigger flash then the ATMega32. This gives the possibility to add more modules to your Image.
 
 
 
=== Swapping the Microcontroller ===
 
* Disconnect power and ISP-Connector.
 
* Remove the old processor from your board.
 
* Insert the new processor while the slot is at the same position as in the socket.
 
 
 
=== Setting the FUSE-Bits ===
 
* Reconnect the ISP and the power.
 
* Set the FUSE-Bits.
 
* '''Important: ''' in the condition as supplied the 644 is programmed to 8 MHz internal RC-Oscillator '''and''' the clock is divided by 8 -> 1 MHz clock speed. If an external Quarz is used, the Bit CKDIV8 has to be set to 0.
 
 
 
 
 
* (taken from dinus) The ATMega has a clock speed of 1 MHz, no JTAG.
 
  avrdude -p m644 -c ponyser -P /dev/ttyS0 -U lfuse:w:0xE7:m -U hfuse:w:0xDC:m -U efuse:w:0xFF:m
 
 
 
Fuse-Bits from "DiDi". JTAG is turned ON.
 
 
 
  * -U lfuse:w:0xf7:m -U hfuse:w:0x99:m -U efuse:w:0xfc:m
 
 
 
Fuse-Bits from "loddel". JTAG is turned OFF.
 
 
 
  * -U lfuse:w:0xf7:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
 
  * -U lfuse:w:0xe7:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
 
 
 
Fuse-Bits from "Gregor". "The 644 runs at 16 MHz Quartz and is not divided by 8." JTAG is turned ON.
 
 
 
  * -U lfuse:w:0xef:m -U hfuse:w:0x99:m -U efuse:w:0xff:m
 
 
 
=== flash Ethersex ===
 
* change Config of Ethersex (make menuconfig) to ATMega644 and build (make)
 
* flash with  
 
  avrdude -p m644 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex -v
 
 
 
=== Differentes bettween ATMega32, ATMega644, ATMega644p and ATMega1284p===
 
 
 
{| border=1 cellspacing=0 padding=4 class=wikitable "
 
!          !! ATMega32 !! ATMega644 !! ATMega644p !! ATMega1284p
 
|-
 
| Housing  || DIL-40  || DIL-40    || DIL-40    || DIL-40
 
|-
 
| MHz   || max. 16  || max. 20  || max. 20    || max. 20
 
|-
 
| Flash    || 32 KB    || 64 KB    || 64 KB      || 128 KB
 
|-
 
| EEProm  || 1 KB    || 2 KB      || 2 KB      || 4 KB
 
|-
 
| RAM      || 2 KB    || 4 KB      || 4 KB      || 16 KB
 
|-
 
| I/O      || 32      || 32        || 32        || 32
 
|-
 
| PWM      || 4        || 6        || 6          || 6
 
|-
 
| ext. INT || 3        || 32        || 32        || 32
 
|-
 
| Ser-Port || 1        || 1        || 2          || 2
 
|}
 
 
 
====Datenblätter====
 
* AtMega32
 
* ATMega644
 
* ATMega644p
 
* [http://www.atmel.com/dyn/resources/prod_documents/8059S.pdf ATMega1284p]
 
 
 
== Flashing with Windows ==
 
There a two main possibilities:
 
#Flash with avrdude
 
#Flash with AVR Studio
 
 
 
If you don't want to install one of those programs, there is a [[Live CD]] to use.
 
 
 
===Flashing with avrdude===
 
The flashing with avrdude is just like in Linux.
 
 
 
You can get the Windows-Binary as a part of [http://sourceforge.net/projects/winavr/ WinAVR]
 
 
 
In the command line you have to adjust the name of the serial Ports. (COMx instead of /dev/ttyxx)
 
avrdude -v -p m32 -c ponyser -P com3 -U flash:w:ethersex.hex
 
 
 
If the programmer is connected via USB you need:
 
* for real USB-Programmers: libusb0.dll (Part of WinAVR)
 
* USB-to-Serial Converter a matching Driver: [http://www.ftdichip.com/Drivers/VCP.htm]
 
 
 
===Flashing with AVR Studio===
 
[[AVR Studio]] from Atmel offers a GUI to Controll the ISPs.
 
 
 
AVR Studio also brings USB-Drivers for the Programmers with it, which can be installed together with it.
 
 
 
For USB-to-Serial converters you need a matching Driver: [http://www.ftdichip.com/Drivers/VCP.htm]
 
 
 
== Live-CD ==
 
You don't have to worry about your System if you use a Live CD to flash your build.
 
 
 
* Download and burn the CD: [http://www.ethersex.de/index.php?title=Live_CD]
 
* Get the libncurses5 Package: apt-get install libncurses5-dev
 
* Update and install the software for ethersex just like described here: [http://ethersex.de/index.php/Quick_Start_Guide/Preparation]
 
* If menuconfig fails try this command: apt-get install dialog
 
* Flash like described in the "Flashing with Linux" section is described.
 

Revision as of 20:52, 4 June 2012

Requirements

  • AVR NET-IO
  • ISP-Programmer (we're using a Evaluation-Board made by Pollin)
  • 10-pin connector cable (from Evaluation-Board to the NET-IO)

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