Burning the Sanguino Bootloader using DAPA
Note: this isn't limited to the Sanguino, but works on all ATmega (and probably ATtiny) based electronics.
Installing the bootloader on an ATmega644 or ATmega644P via Direct AVR Parallel Access (DAPA)
This will be an instruction set for manually bit-banging the bootloader onto a blank ATmega chip. This method DOES NOT require the purchase of an AVR Programmer or ISP (such as an additional arduino). Much of this is based of the Arduino.cc Parallel Programmer guide, found http://www.arduino.cc/en/Hacking/ParallelProgrammer.
Materials Needed:
- Computer with parallel port
- USB Cable (for powering board)
- Parallel Port male adapter (25 pin DB)
- 5 ft Wire (or 1 ft of 5 strand wire)
- Resistors (1/8 watt) (2)X 470 Ohm; (1)X 220 Ohm (safety option)
- Solder and Soldering Iron
- Completed Arduino, Sanguinololu, Gen6, Gen7, whatever, Board
Parallel Adapter First assemble the parallel port adapter:
- Clip the leads of the resistors to ~ 1 inch
- Solder the 220 Ohm resistor to pin 11 of the adapter
- Solder one wire strand to the other side of the resistor
- Solder one of the 470 Ohm resistors to pin 1 of the adapter
- Solder one wire strand to the other side of the resistor
- Solder the other 470 Ohm resistor to pin 2 of the adapter
- Solder one wire strand to the other side of the resistor
At this point you should have 3 wires, connected to 3 resistors, which are in turn soldered to the parallel adapter.
- Solder one wire strand to pin 16 of the adapter (no resistor on this line)
- Solder one wire strand to pin 18 of the adapter (no resistor on this line either.)
At this point you have everything you physically need for bit-banging your chip. You have two options now:
- Solder the wire ends to the board directly (not recommended if you want to use your board for an ISP for other boards)
- Put a 2X3 connector on the ends (very clean, easy to connect and disconnect many times with different boards)
If you plan to directly solder these wires to the board this is the connection table:
Pin Board ID
1 SCK
2 MOSI
11 MISO
16 RESET
18 GND
OR
If you plan to add the 2x3 connector follow this layout:
[None] [Pin 2] [Pin 18]
[Pin 11] [Pin 1] [Pin 16]
Plug the connected board into parallel port (without USB first). You should have a faint LED glow (not full power). If you do not have a lightly glowing LED check your connections, and make sure no loose wires are touching. Plug in the USB and the LED should go full brightness.
Setting up Windows
To allow connections between your parallel port and board you need to run giveIO http://web.mit.edu/6.115/www/miscfiles/giveio.zip from MIT's Microcomputer Project Laboratory http://web.mit.edu/6.115/www/pic.shtml. The file also exist under ...\arduino-0022\hardware\tools\avr\bin directory called install_giveio.bat.
Win Vista/Win7: giveIO wants to "play" with your paralell port. Win Vista/7 dislikes this idea. To get GiveIO to install, open Control Pannel --> System --> Advanced --> Environment variables. Add the path to giveIO to your system path. You can then run the installer "as administrator"
Install the Arduino IDE
http://arduino.cc
Install the Sanguino set for Arduino IDE http://sanguino.cc
Once your computer is all set we can open up the command prompt.
1. Click Start
2. Click Run
3. Type "cmd" into the text box and hit enter (or click "ok")
4. In the command prompt type "cd [path to arduino\hardware\tools\avr\bin\]"
For example "cd C:\Program Files\Reprap\arduino-0022\hardware\tools\avr\bin\"
Setting Fuses
5. Type this command and hit enter:
"avrdude -p atmega644P -C 'C:[path to avrdude.conf]\avrdude.conf' -c dapa -P lpt1 -U lfuse:w:0xFF:m -U hfuse:w:0xDC:m -U efuse:w:0xFD:m"
-p is the chip (atmega644P), -C is the config file followed by the path to it (search in windows for avrdude.conf to find it if you don't know where it was installed to), -c is the programmer (DAPA for us), -p is the port (lpt1-lpt3 for windows), -U allows write function (avrdude defaults to undoing changes unless this operator is used) followed by the memory type (fuses) and what to write (in our case explicit values)
6. When avrdude asks to confirm write changes hit Y
You should get something similar to this:
1 bytes of efuse verified
safe mode fuses OK
avrdude done OK. Thank you
Writing bootloader to chip:
7. Type this command and hit enter:
"avrdude -p m644P -C 'C:[path to avrdude.conf]\avrdude.conf' -c dapa -P lpt1 -U flash:w:[path to bootloader director]\ATmegaBOOT_644P.hex"
8. When asked if you would like to save changes hit Y and then enter
DONE
You should get something like this:
1 bytes of efuse verified safe mode fuses OK avrdude done OK. Thank you avrdude: AVR device initialized and ready to accept instructions Reading | ################################################## | 100% 0.00s avrdude: Device signature = 0x1e960a avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed To disable this feature, specify the -D option. avrdude: erasing chip avrdude: reading input file "ATmegaBOOT_644P.hex" avrdude: input file ATmegaBOOT_644P.hex auto detected as Intel Hex avrdude: writing flash (65382 bytes): Writing | ################################################## | 100% 19.31s avrdude: 65382 bytes of flash written avrdude: verifying flash memory against ATmegaBOOT_644P.hex: avrdude: load data flash data from input file ATmegaBOOT_644P.hex: avrdude: input file ATmegaBOOT_644P.hex auto detected as Intel Hex avrdude: input file ATmegaBOOT_644P.hex contains 65382 bytes avrdude: reading on-chip flash data: Reading | ################################################## | 100% 18.06s avrdude: verifying ... avrdude: 65382 bytes of flash verified avrdude: safemode: Fuses OK avrdude done. Thank you.