As discussed in my last post, I intended to make up a prototype shield in order to supply three main functions - ICSP programmer, breakout to allow ICSP programming off-board, and FTDI serial input to allow comms with the inserted Atmel chip. This post will discuss how I went with the schematics and breadboarding of the planned device.
The Schematic
ArduinoISP-Shield Schematic |
You can get the Eagle schematic and PDF at my GoogleCode Repository here. In essence, this shield is intended to function in a couple of modes;
- Onboard ICSP Programming - In order to do this, plug the shield into an Arduino, then put an Atmel chip into the ZIF socket, and run ArduinoISP as you usually would. FTDI and the ICSP outbound header should be disconnected. The LEDs will indicate programming status.
- Offboard ICSP Programming - Plug the shield into an Arduino, then hook up an ICSP programming cable to the ICSP outbound header. Run ArduinoISP as you usually would, and the LEDs will indicate programming status. FTDI should be disconnected and the ZIF socket should be empty. Note, this mode is for outbound ICSP (ie, the shield is burning a bootloader on something else), and you shouldn’t have a chip in the ZIF socket.
- FTDI Link to ZIF Socket - Plug an FTDI cable into the FTDI header, and make sure an Atmel chip is in the ZIF socket. Make sure that the shield is not plugged into an Arduino. You can connect an external ICSP programmer if you want. You can now use the FTDI cable to communicate to the Atmel on the shield and upload sketches to it.
I’m not entirely sure what would happen if you plug in the FTDI link and the Arduino at the same time, since the VCC lines are tied together. It might be bad, so don’t do it. If you are gonig to, then the power sources must come from the same place so they’re at the same potential. At any rate, there are a number of LED’s and items on the shield, namely;
- Pin13 - Connected to Digital Pin 13 on the ZIF socket. This is so if you upload the Blink sketch, you can see the Atmel blink the LED if the programming worked.
- Prog - Lights up when the underlying ArduinoISP is burning a bootloader.
- Error - Lights up and stays on when the underlying ArduinoISP had some kind of problem burning the bootloader. This may blink when you first start a burn.
- HBeat - Heartbeat. When the ArduinoISP programmer is running, this light will fade on and off.
- RESET - Reset for the ZIF socket. Pressing this will reboot the Atmel in the ZIF socket.
Right, now the schematic’s done, time to assemble the prototype!
The Prototype
** **
I’ve greatly shortened the development cycle here, but essentially what I did was assemble the prototype in three parts - first assemble the Atmel onto a breadboard with the connecting components (capacitors, reset switch, LED, resonator). Once that was verified to work, I then assembled the FTDI cable parts onto the board using the FTDI Adapter I wrote about earlier;
Arduino Breadboard & FTDI Adapter |
The Arduino-on-a-breadboard is at the top and the FTDI adapter is on the bottom breadboard. Note that the upper breadboard is missing the reset switch - I wired that up later. To start with I only had the 10k pullup and the 0.1uF capacitor on the reset line. Running that, I verified that I could upload a sketch and have it work - for starters I used the Blink sketch. All worked. Great.
Next up is to disconnect the FTDI cable and set up the ArduinoISP to be able to burn the bootloader. For this, I cheated a little. Because it’s on a breadboard, I just hooked up the Arduino direct to the ZIF socket as the schematic shows and ran it;
Arduino Breadboard & ArduinoISP |
Notice the three LEDs on the breadboard on the left - that’s the ISP status LEDs. You’ll also notice that the reset switch is in place on the right breadboard. Anyway, running that showed it all worked. I was able to burn the bootloader through the Arduino GUI, and also by running AVRDUDE by hand like this;
C:\arduino\hardware\tools\avr\bin>avrdude -pm328p -cstk500v1 -b19200 -PCOM3 -v -C ..\etc\avrdude.conf</p>
avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/System wide configuration file is "..\etc\avrdude.conf"
Using Port : COM3
Using Programmer : stk500v1
Overriding Baud Rate : 19200
AVR Part : ATMEGA328P
Chip Erase delay : 9000 us
PAGEL : PD7
BS2 : PC2
RESET disposition : dedicated
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :Block Poll Page
Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW Max
W ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
eeprom 65 5 4 0 no 1024 4 0 3600 36
00 0xff 0xff
flash 65 6 128 0 yes 32768 128 256 4500 45
00 0xff 0xff
lfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
efuse 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
lock 0 0 0 0 no 1 0 0 4500 45
00 0x00 0x00
calibration 0 0 0 0 no 1 0 0 0
0 0x00 0x00
signature 0 0 0 0 no 3 0 0 0
0 0x00 0x00Programmer Type : STK500
Description : Atmel STK500 Version 1.x firmware
Hardware Version: 2
Firmware Version: 1.18
Topcard : Unknown
Vtarget : 0.0 V
Varef : 0.0 V
Oscillator : Off
SCK period : 0.1 usavrdude: AVR device initialized and ready to accept instructions
Reading | ################################################## | 100% 0.05s
avrdude: Device signature = 0x1e950f
avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5avrdude: safemode: lfuse reads as FF
avrdude: safemode: hfuse reads as DE
avrdude: safemode: efuse reads as 5
avrdude: safemode: Fuses OKavrdude done. Thank you.</span>
</blockquote>
Note that when using the Arduino IDE version of AVRDUDE, you need to point it at the config file, hence the command line above. Anyway, that all worked. I wanted to run AVRDUDE by hand because the Arduino IDE gives you no feedback besides "Yay, it worked!", which doesn't tell me quite enough. I wanted to be really sure it actually worked.
Next Steps
Well, the prototype on breadboard works. The next thing to do is to arrange all the parts onto a prototype shield to make sure it'll all fit, and then start assembly.
Photos and blog post when it's done.