Difference between revisions of "Quick Start Guide/Flashing"

From Ethersex_Wiki
Jump to: navigation, search
(Created page with "{{i18n|Flashing}} = AVR Net-IO mit dem ATMEL Evaluations-Board von Pollin flashen= Als Einsteiger hat man es immer wieder schwer alle Information zu finden. Ich habe lange gesu…")
 
Line 1: Line 1:
 
{{i18n|Flashing}}
 
{{i18n|Flashing}}
  
= AVR Net-IO mit dem ATMEL Evaluations-Board von Pollin flashen=
+
= Flash AVR Net-IO with "ATMEL Evaluations-Board" made by Pollin=
  
Als Einsteiger hat man es immer wieder schwer alle Information zu finden.
+
As a beginner it's difficult to understand everything in terms of flashing.
Ich habe lange gesucht bis ich das mit dem Flashen kapiert habe.
+
And it's also difficult to find all information.
  
== Benötigt wird: ==
+
== What's needed? ==
 
* AVR Net-IO
 
* AVR Net-IO
* ATMEL Evaluations-Board
+
* ATMEL Evaluation-Board
* ein 1:1 Kabel für den [[ISP]]-Port (10-poliger Pfostenstecker).  
+
* a 1 on 1 Cable for the [[ISP]]-Port (10-pin Connector).
  
=== Andere ISP-Programmer ===
+
=== Other ISP Programmers ===
Wer über einen ISP-Programmer mit 6-poligem Ausgang verfügt, kann sich ein Adapterkabel bauen. Zu den Pinbelegungen siehe Figure 4-1 auf Seite 5 von [http://www.atmel.com/dyn/resources/prod_documents/doc2521.pdf AVR042: AVR Hardware Design Considerations].
 
  
Achtung, Pin 4 des 10-poligen Steckers ist auf dem AVR Net-IO nicht belegt! GND muss daher an einen der anderen Pins (6, 8 oder 10) angeschlossen werden.
+
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].
  
== Flashen unter Linux ==
+
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)
Das 10-polige Kabel in die ISP-Buchse stecken.
 
Nun das AVR Net-IO Board mit Strom versorgen.
 
Wenn das ISP-Kabel richtig gesteckt ist, leuchtet auf dem Evalutions-Board die (gelbe) LED
 
  
Nach dem Erzeugen der [[:Kategorie:StepByStep#Firmware_kompilieren|ethersex.hex]] kann man mit avrdude das Ganze flashen. Das nachfolgende Kommando ist bei einigen Parametern vom ISP-Programmer abhängig. Das nachfolgende Beispiel gilt für einen ISP-Programmer der über die serielle Schnittstelle arbeitet:
+
== Flashing with Linux ==
 +
*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:
  
 
   avrdude -v -p m32 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex  
 
   avrdude -v -p m32 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex  
  
Für eine USB-ISP-Programmer wäre statt dessen der folgende Befehl zu verwenden:
+
For a USB-ISP-Programmer this command should be used:
  
 
   avrdude -v -p m32 -c stk500v2 -P /dev/ttyACM0 -U flash:w:ethersex.hex
 
   avrdude -v -p m32 -c stk500v2 -P /dev/ttyACM0 -U flash:w:ethersex.hex
  
Für ein paralleles ISP-Kabel:
+
For a parallel ISP-Cable:
  
 
   avrdude -p m32 -e -c stk200 -U flash:w:ethersex.hex
 
   avrdude -p m32 -e -c stk200 -U flash:w:ethersex.hex
  
Nach dem Flashen das ISP-Kabel entfernen und kurz die Stromversorgung unterbrechen um das Board zu rebooten.
+
After flashing remove the ISP-Cable and interrupt the power connection for a short time to reboot the board.
  
   * -p m32 steht für den ATMega32; -p m644 wäre der ATMega644
+
   * -p m32: ATMega32; -p m644: ATMega644
   * -v erweiterte Ausgaben
+
   * -v: display debug messages
   * -c ponyser ist das Verfahren wie das Evalutions-Board die Daten flasht
+
   * -c ponyser: the way avrdude speaks with the Evaluation Board; -c stkk500v2 for the Atmel board
   * -P ist die Serielle Schnittstelle an dem das Evalutions-Board angeschlossen ist (bei USB /dev/ttyUSB0)
+
   * -P /dev/tty.serial the serial port your programmer is connected to; -P COM1 for windows machines
   * -U was man machen möchte. In unserem Fall wollen wir das File ethersex.hex flashen (-U flash:w:ethersex.hex)
+
   * -U the command you want to execute. In our case we want to flash: -U flash:w:ethersex.hex
  
Es kann sein das man für den ATMega32 die FUSE Bits setzen muss.
+
In some cases you have to set the FUSE Bits, which is possible with this command:
  
   avrdude -p m32 -c ponyser -P /dev/ttyS0 -U lfuse:w:0xCF:m -U hfuse:w:0xDC:m
+
   * -U lfuse:w:0xCF:m -U hfuse:w:0xDC:m
  
Um die korrekte Fuse-Einstellung rauszufinden, ist es sinnvoll http://www.engbedded.com/fusecalc/ zu benutzen.
+
To get the correct FUSE-Settings you should visit http://www.engbedded.com/fusecalc/
  
Die Parameter für MyAVR mySmartusb light (Insbesondere das -e war nötig):
+
Parameters for MyAVR mySmartusb light (the -e is important):
 
   avrdude -p m32 -e -c stk500v2  -P /dev/ttyUSB0 -U flash:w:ethersex.hex
 
   avrdude -p m32 -e -c stk500v2  -P /dev/ttyUSB0 -U flash:w:ethersex.hex
  
== Umbau von einem ATMega32 auf den ATMega644 / ATMega644p ==
+
== 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.
  
Der Vorteil von ATMega644 und ATMega644p ist vor allem der doppelt so große Speicher gegenüber dem serienmäßigen ATMega32.
+
=== 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.
  
=== Mikrocontroller tauschen ===
+
=== Setting the FUSE-Bits ===
* Stromversorgung abschalten und ISP-Stecker abziehen.
+
* Reconnect the ISP and the power.
* Den ATMega32 aus seinem Sockel auf dem AVR Net-IO ziehen.
+
* Set the FUSE-Bits.
* Den ATMega644 oder ATMega644p einbauen. (ACHTUNG: Kerbe im Sockel muss mit Kerbe in der CPU übereinstimmen)
+
* '''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.
  
=== Fuse-Bits setzen ===
 
* ISP wieder einstecken und Stromversorgung einschalten.
 
* Fuse-Bits setzen
 
* '''Wichtig:''' im Auslieferungszustand ist der ATMega644 programmiert auf 8MHz interner RC-Oszillator '''und''' der Takt wird durch 8 geteilt; also 1MHz Takt. Wenn ein externer Quarz verwendet wir, muss das Bit CKDIV8 (Takt geteilt durch 8) auf null gesetzt werden.
 
  
* (Übernommen von dinus) Der ATMega wird dabei mit 1Mhz getaktet, kein JTAG.
+
* (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
 
   avrdude -p m644 -c ponyser -P /dev/ttyS0 -U lfuse:w:0xE7:m -U hfuse:w:0xDC:m -U efuse:w:0xFF:m
* bzw.
 
  avrdude -p m644p -c ponyser -P /dev/ttyS0 -U lfuse:w:0xE7:m -U hfuse:w:0xDC:m -U efuse:w:0xFF:m
 
  
Fuse-Bits wie sie "DiDi" einsetzt. Der JTAG ist eingeschaltet.
+
Fuse-Bits from "DiDi". JTAG is turned ON.
  
 
   * -U lfuse:w:0xf7:m -U hfuse:w:0x99:m -U efuse:w:0xfc:m
 
   * -U lfuse:w:0xf7:m -U hfuse:w:0x99:m -U efuse:w:0xfc:m
  
Fuse-Bits wie "loddel" sie einsetzt. Der JTAG ist ausgeschaltet.
+
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: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
 
   * -U lfuse:w:0xe7:m -U hfuse:w:0xd9:m -U efuse:w:0xff:m
  
Fuse-Bits wie "gregor" sie einsetzt. "Damit läuft der 644 auf 16MHz Quarz und der Takt wird nicht durch 8 geteilt." Der JTAG ist eingeschaltet.
+
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
 
   * -U lfuse:w:0xef:m -U hfuse:w:0x99:m -U efuse:w:0xff:m
  
=== Ethersex reinflashen===
+
=== flash Ethersex ===
* in der Config von Ethersex (make menuconfig) von ATmega32 auf ATMega644 umstellen
+
* change Config of Ethersex (make menuconfig) to ATMega644 and build (make)
* Flashen mit
+
* flash with
avrdude -p m644 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex -v
+
  avrdude -p m644 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex -v
* bzw.
 
avrdude -p m644p -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex -v
 
  
=== Unterschiede zwischen ATMega32, ATMega644, ATMega644p und ATMega1284p===
+
=== Differentes bettween ATMega32, ATMega644, ATMega644p and ATMega1284p===
  
 
{| border=1 cellspacing=0 padding=4 class=wikitable "
 
{| border=1 cellspacing=0 padding=4 class=wikitable "
 
!          !! ATMega32 !! ATMega644 !! ATMega644p !! ATMega1284p
 
!          !! ATMega32 !! ATMega644 !! ATMega644p !! ATMega1284p
 
|-
 
|-
| Gehäuse || DIL-40  || DIL-40    || DIL-40    || DIL-40
+
| Housing || DIL-40  || DIL-40    || DIL-40    || DIL-40
 
|-
 
|-
 
| MHz   || max. 16  || max. 20  || max. 20    || max. 20
 
| MHz   || max. 16  || max. 20  || max. 20    || max. 20
Line 119: Line 117:
 
* [http://www.atmel.com/dyn/resources/prod_documents/8059S.pdf ATMega1284p]
 
* [http://www.atmel.com/dyn/resources/prod_documents/8059S.pdf ATMega1284p]
  
== Flashen unter Windows ==
+
== Flashing with Windows ==
Es gibt mindestens zwei Möglichkeiten:
+
There a two main possibilities:  
#Flashen mit avrdude
+
#Flash with avrdude
#Flashen mit AVR Studio
+
#Flash with AVR Studio
  
Wer keines der beiden Programme auf seine Festplatte legen möchte, weil er sein Windows-System nicht ändern möchte, kann auch die [[Live CD]] verwenden.
+
If you don't want to install one of those programs, there is a [[Live CD]] to use.
  
===Flashen mit avrdude===
+
===Flashing with avrdude===
Das Flashen mit avrdude erfolgt prinzipiell genauso wie unter Linux (siehe oben).
+
The flashing with avrdude is just like in Linux.
  
Ein Windows-Binary von avrdude erhält man am einfachsten als Bestandteil von [http://sourceforge.net/projects/winavr/ WinAVR]. (Ansonsten findet man ein Windows-Binary von avrdude auch auf [http://yuki-lab.jp/hw/avrdude-GUI/index.html dieser japanischen Seite], wo man auch eine GUI für avrdude bekommen kann. Google-Translate hilft den japanischen Text zu verstehen.)
+
You can get the Windows-Binary as a part of [http://sourceforge.net/projects/winavr/ WinAVR]
  
In der Kommandozeile muss natürlich die Bezeichnung des seriellen Ports angepasst werden, also "COMx" anstelle von "/dev/ttyS0", z.B.
+
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  
 
  avrdude -v -p m32 -c ponyser -P com3 -U flash:w:ethersex.hex  
  
Sofern der Programmer per USB angeschlossen ist, benötigt man
+
If the programmer is connected via USB you need:
* bei echten USB-Programmern die libusb0.dll (bei WinAVR enthalten),
+
* for real USB-Programmers: libusb0.dll (Part of WinAVR)
* bei Verwendung eines USB-nach-seriell-Adapters mit FTDI-Chip (dieser kann auch manchmal bereits in den Programmer mit USB-Anschluss eingebaut sein!) einen passenden Treiber, siehe http://www.ftdichip.com/Drivers/VCP.htm.
+
* USB-to-Serial Converter a matching Driver: [http://www.ftdichip.com/Drivers/VCP.htm]
 
 
===Flashen mit AVR Studio===
 
Das [[AVR Studio]] von Atmel bietet eine grafische Oberfläche zur Bedienung von ISPs.
 
  
Beim AVR Studio werden USB-Treiber für USB-Programmer mitgeliefert, die optional zusammen mit dem AVR Studio installiert werden können.
+
===Flashing with AVR Studio===
 +
[[AVR Studio]] from Atmel offers a GUI to Controll the ISPs.
  
Für USB-nach-seriell-Adapter mit FTDI-Chip benötigt man einen passenden Treiber, siehe  http://www.ftdichip.com/Drivers/VCP.htm.
+
AVR Studio also brings USB-Drivers for the Programmers with it, which can be installed together with it.
  
=== Links zu Erfahrungsberichten ===
+
For USB-to-Serial converters you need a matching Driver: [http://www.ftdichip.com/Drivers/VCP.htm]
*http://www.saschakimmel.de/2010/02/ethersex-auf-avr-net-io-installieren-mittels-pollin-atmel-evaluationsboard-2-0-und-windows/ , jedoch nicht mit ISP-Kabel sondern mit Umstecken des Controllers.
 
  
 
== Live-CD ==
 
== Live-CD ==
Diese hat den Vorteil, dass man sein vorhandenes System nicht ändern muss.
+
You don't have to worry about your System if you use a Live CD to flash your build.
 
 
*  http://www.ethersex.de/index.php?title=Live_CD
 
* apt-get install libncurses5-dev
 
* update und installier software fuer ethersex wie beschrieben http://www.ethersex.de/index.php/Download
 
* wenn help in menuconfig nicht geht: apt-get install dialog
 
* weiter wie in "Flashen unter Linux" beschrieben.
 
  
[[Category:Ethersex]]
+
* Download and burn the CD: [http://www.ethersex.de/index.php?title=Live_CD]
[[Category:StepByStep]]
+
* Get the libncurses5 Package: apt-get install libncurses5-dev
[[Category:AVR Net-IO]]
+
* 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:10, 4 June 2012

Flash AVR Net-IO with "ATMEL Evaluations-Board" made by Pollin

As a beginner it's difficult to understand everything in terms of flashing. And it's also difficult to find all information.

What's needed?

  • AVR Net-IO
  • ATMEL Evaluation-Board
  • a 1 on 1 Cable for the ISP-Port (10-pin Connector).

Other ISP Programmers

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 AVR042: AVR Hardware Design Considerations.

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)

Flashing with Linux

  • 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:

 avrdude -v -p m32 -c ponyser -P /dev/ttyS0 -U flash:w:ethersex.hex 

For a USB-ISP-Programmer this command should be used:

 avrdude -v -p m32 -c stk500v2 -P /dev/ttyACM0 -U flash:w:ethersex.hex

For a parallel ISP-Cable:

 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

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

Flashing with Windows

There a two main possibilities:

  1. Flash with avrdude
  2. 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 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: [1]

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: [2]

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: [3]
  • Get the libncurses5 Package: apt-get install libncurses5-dev
  • Update and install the software for ethersex just like described here: [4]
  • If menuconfig fails try this command: apt-get install dialog
  • Flash like described in the "Flashing with Linux" section is described.