Difference between revisions of "Using The ISP Shield 2"

From Evil Mad Scientist Wiki
Jump to: navigation, search
(Add avrdude command)
 
(19 intermediate revisions by 7 users not shown)
Line 4: Line 4:
 
== ...To program the Arduino Bootloader onto an ATmega168/ATmega328 ==
 
== ...To program the Arduino Bootloader onto an ATmega168/ATmega328 ==
  
#Attach the ISP Shield 2.0 to the Arduino
+
===  Initial setup: ===
 +
#Begin with your Arduino, with the ISP shield NOT connected.
 
#Connect the Arduino to your computer and bring up the Arduino IDE
 
#Connect the Arduino to your computer and bring up the Arduino IDE
 
#If necessary, configure the Arduino IDE for your Arduino or Arduino clone
 
#If necessary, configure the Arduino IDE for your Arduino or Arduino clone
 
#In the '''File''' menu, select '''Examples''', and open the '''ArduinoISP''' sketch
 
#In the '''File''' menu, select '''Examples''', and open the '''ArduinoISP''' sketch
 
#Upload this sketch to your Arduino or Arduino clone
 
#Upload this sketch to your Arduino or Arduino clone
#At this time place an ATmega168 or ATmega328 into the ZIF socket on the ISP Shield 2.0 and lock it in place
+
#Recommended: Disconnect the Arduino from your computer by unplugging the USB cable.
#In the '''Tools''' menu, select '''Board''', and select either:
+
#Attach the ISP Shield 2.0 to the Arduino. If using Arduino Uno (or other varieties that have metal that can touch the ISP shield), put a piece of insulating tape on top of the USB connector of the Uno to prevent the bottom of the shield from shorting against the connector housing. (Or, use a [[Googly_Shield|Googly Shield]]!)
#* '''Arduino Duemilanove or Nano w/ ATmega328''' if you are programing an ATmega328
+
#Connect the Arduino to your computer.
#* '''Arduino Diecimila, Duemilanove, or Nano w/ ATmega168''' if you are programing an ATmega168
+
 
 +
=== For each AVR that you would like to burn: ===
 +
#Place an ATmega168 or ATmega328 into the ZIF socket on the ISP Shield 2.0 and lock it in place
 +
#Important: The lever of the ZIF socket corresponds to pin 1 on the Atmega328 — the side of the AVR with the "half-moon" indentation.
 +
#In the '''Tools''' menu, select '''Board''', and select the type of board that you are burning the bootloader for. For example,
 +
#* '''Arduino Uno''' if you are programing an ATmega328 for an Uno
 +
#* '''Arduino Duemilanove or Nano w/ ATmega328''' if you are programing an ATmega328 for a Arduino or clone that clone uses an FTDI interface and has an ATmega328.
 +
#Be sure to have J5 jumpered to YUP and J6 jumpered to NO WAY
 
#In the '''Tools''' menu, select '''Burn Bootloader''', and select '''w/ Arduino as ISP'''
 
#In the '''Tools''' menu, select '''Burn Bootloader''', and select '''w/ Arduino as ISP'''
 
  
 
== ...To program the Arduino Bootloader onto an ATmega168/ATmega328 located on an external target board ==
 
== ...To program the Arduino Bootloader onto an ATmega168/ATmega328 located on an external target board ==
Line 33: Line 40:
 
== ...To use the ISP Shield 2.0 in place of an AVR ISP ==
 
== ...To use the ISP Shield 2.0 in place of an AVR ISP ==
  
The ArduinoISP sketch mimics the [http://www.atmel.com/ Atmel] [http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2726 AVRISP] programmer. The Arduino IDE won't let you use it to upload sketches, but you can use [http://savannah.nongnu.org/projects/avrdude avrdude] to upload compiled programs to an ATmega168/ATmega328 via the ISP Shield 2.0 ZIF socket or either of the ISP headers.
+
The ArduinoISP sketch mimics the [http://www.atmel.com/ Atmel] [http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2726 AVRISP] programmer. You can use [http://savannah.nongnu.org/projects/avrdude avrdude] to upload compiled programs to an ATmega168/ATmega328 via the ISP Shield 2.0 ZIF socket or either of the ISP headers. With the Arduino IDE, you can upload sketches with the ISP Shield by pressing and holding the shift key before clicking the Upload icon.  Normally when you hover the mouse over the icon you will see "Upload".  When holding the shift key it will show "Upload Using Programmer."
  
 
When using an Arduino and ArduinoISP in this capacity the avrdude programmer type should be set to 'avrisp'. If you are using Windows avrdude may not be able to use the Arduino unless it is attached to COM port 9 (COM9) or lower. To change the port number that a device is attached to first locate it in the Device Manager: in the '''System Properties''' control panel, select the '''Hardware''' tab, then click the '''Device Manager''' button, and finally expand the '''Ports (COM & LPT)''' item. Right click the appropriate device for your Arduino and select '''Properties''' option, select the '''Port Settings''' tab, and click the button labeled '''Advanced...'''. Select a new unused port in the '''COM Port Number''' drop-down selection box.
 
When using an Arduino and ArduinoISP in this capacity the avrdude programmer type should be set to 'avrisp'. If you are using Windows avrdude may not be able to use the Arduino unless it is attached to COM port 9 (COM9) or lower. To change the port number that a device is attached to first locate it in the Device Manager: in the '''System Properties''' control panel, select the '''Hardware''' tab, then click the '''Device Manager''' button, and finally expand the '''Ports (COM & LPT)''' item. Right click the appropriate device for your Arduino and select '''Properties''' option, select the '''Port Settings''' tab, and click the button labeled '''Advanced...'''. Select a new unused port in the '''COM Port Number''' drop-down selection box.
 +
 +
 +
 +
Here is the AVRdude command to use to flash a chip using the shield:
 +
<code>
 +
avrdude -c avrisp -p [TARGET CHIP NAME] -P [PORT] -b 19200 -U flash:w:[PATH TO COMPILED HEX FILE]
 +
</code>
  
 
Check the avrdude webpage for complete instructions and documentation regarding the use of avrdude.
 
Check the avrdude webpage for complete instructions and documentation regarding the use of avrdude.
  
 
+
== Known Issue With Auto-Reset  ==
== Know Issue With Auto-Reset  ==
 
  
 
There is a [http://www.arduino.cc/playground/Code/MegaISP known issue] with auto-reset (a common feature on Arduino boards) and the ArduinoISP technique.  You may, for example, get the "not in sync: resp=0x15" error message.  If so, you may need to disable auto-reset.  The ISP Shield 2.0 has a resistor on board for this eventuality.
 
There is a [http://www.arduino.cc/playground/Code/MegaISP known issue] with auto-reset (a common feature on Arduino boards) and the ArduinoISP technique.  You may, for example, get the "not in sync: resp=0x15" error message.  If so, you may need to disable auto-reset.  The ISP Shield 2.0 has a resistor on board for this eventuality.
Line 51: Line 64:
  
 
http://cdn2.evilmadscience.com/wiki/ispshield/assy_v2/29.jpg
 
http://cdn2.evilmadscience.com/wiki/ispshield/assy_v2/29.jpg
 +
 +
== Known Issue With Arduino Uno ==
 +
 +
We have found the ISP shield to work well when situated on top of the Arduino Uno, if you add a small capacitor, 0.1 uF or so, between RST and GND on the ISP shield.  We recommend placing it into header J4, spanning from the leftmost pin (RST) to one of the two GND pins. (You may need to remove this capacitor when initially writing the ArduinoISP sketch).
 +
 +
This is similar to the technique recommended in the [http://arduino.cc/en/Tutorial/ArduinoISP ArduinoISP tutorial] of putting a 10 uF capacitor there, but also editing the ArduinoISP to account for the longer time constant associated with the larger capacitor.
 +
 +
== Recent changes; Arduino variants that (historically) did not work ==
 +
 +
* We have had two reports of the ArduinoISP method not working properly with the Arduino Mega 2560. This is due to a software problem, that may be fixed in future releases of the Arduino and/or ArduinoISP software.  Some software workarounds have been reported to work.
 +
 +
* Arduino IDE version 1.6.6 brings a number of improvements to the ArduinoISP process, which may address these issues. You can read more about that [https://petervanhoyweghen.wordpress.com/2015/07/21/arduinoisp-reliability-and-portability-improvements/ here].
 +
 +
== Arduino variants that probably still will not work ==
 +
 +
* The Arduino Yun does not connect the ArduinoISP control pins to the Digital I/O pins and will not work without custom wiring.

Latest revision as of 11:06, 20 January 2021

This page covers basic usage of the Evil Mad Science ISP Shield 2.0


...To program the Arduino Bootloader onto an ATmega168/ATmega328[edit]

Initial setup:[edit]

  1. Begin with your Arduino, with the ISP shield NOT connected.
  2. Connect the Arduino to your computer and bring up the Arduino IDE
  3. If necessary, configure the Arduino IDE for your Arduino or Arduino clone
  4. In the File menu, select Examples, and open the ArduinoISP sketch
  5. Upload this sketch to your Arduino or Arduino clone
  6. Recommended: Disconnect the Arduino from your computer by unplugging the USB cable.
  7. Attach the ISP Shield 2.0 to the Arduino. If using Arduino Uno (or other varieties that have metal that can touch the ISP shield), put a piece of insulating tape on top of the USB connector of the Uno to prevent the bottom of the shield from shorting against the connector housing. (Or, use a Googly Shield!)
  8. Connect the Arduino to your computer.

For each AVR that you would like to burn:[edit]

  1. Place an ATmega168 or ATmega328 into the ZIF socket on the ISP Shield 2.0 and lock it in place
  2. Important: The lever of the ZIF socket corresponds to pin 1 on the Atmega328 — the side of the AVR with the "half-moon" indentation.
  3. In the Tools menu, select Board, and select the type of board that you are burning the bootloader for. For example,
    • Arduino Uno if you are programing an ATmega328 for an Uno
    • Arduino Duemilanove or Nano w/ ATmega328 if you are programing an ATmega328 for a Arduino or clone that clone uses an FTDI interface and has an ATmega328.
  4. Be sure to have J5 jumpered to YUP and J6 jumpered to NO WAY
  5. In the Tools menu, select Burn Bootloader, and select w/ Arduino as ISP

...To program the Arduino Bootloader onto an ATmega168/ATmega328 located on an external target board[edit]

You can also use the ISP Shield 2.0 to program the Arduino bootloader onto an external target board, providing that the target is Arduino compatible and has a standard 6-pin* AVR ISP programming header.

Follow the instructions above, however instead of placing a microcontroller into the ZIF socket connect the ISP Shield 2.0 to the target board with a 6 pin (2x3 DIL) ribbon cable. Be sure to get the orientation correct; pin 1 is marked with an arrow on the ISP Shield 2.0 circuit board.

In addition, make sure that the target power jumper is set correctly on the ISP Shield 2.0. If your target board has its own power, the jumper (location J5) should be set to 'Nope', like so:

27.jpg

It is important to make sure that your target is genuinely Arduino compatible, and that you select the appropriate target board type from the Arduino Tools menu. If you are programming an ATmega168 your target board will need the appropriate crystal and related capacitors. If you are programming an ATmega328 your target board may have an appropriate crystal and related capacitors. However if you wish to use the internal oscillator instead you need to install support for an additional hardware configuration. Check the From Arduino to a Microcontroller on a Breadboard tutorial by the Arduino Team - under the Minimal Circuit (Eliminating the External Clock) section there are instructions for downloading and installing the ATmega328 on a breadboard (8 MHz internal clock) hardware configuration in the Arduino IDE. Once installed, select this Board type when programming an ATmega328 on an external target board that has no crystal.


...To use the ISP Shield 2.0 in place of an AVR ISP[edit]

The ArduinoISP sketch mimics the Atmel AVRISP programmer. You can use avrdude to upload compiled programs to an ATmega168/ATmega328 via the ISP Shield 2.0 ZIF socket or either of the ISP headers. With the Arduino IDE, you can upload sketches with the ISP Shield by pressing and holding the shift key before clicking the Upload icon. Normally when you hover the mouse over the icon you will see "Upload". When holding the shift key it will show "Upload Using Programmer."

When using an Arduino and ArduinoISP in this capacity the avrdude programmer type should be set to 'avrisp'. If you are using Windows avrdude may not be able to use the Arduino unless it is attached to COM port 9 (COM9) or lower. To change the port number that a device is attached to first locate it in the Device Manager: in the System Properties control panel, select the Hardware tab, then click the Device Manager button, and finally expand the Ports (COM & LPT) item. Right click the appropriate device for your Arduino and select Properties option, select the Port Settings tab, and click the button labeled Advanced.... Select a new unused port in the COM Port Number drop-down selection box.


Here is the AVRdude command to use to flash a chip using the shield: avrdude -c avrisp -p [TARGET CHIP NAME] -P [PORT] -b 19200 -U flash:w:[PATH TO COMPILED HEX FILE]

Check the avrdude webpage for complete instructions and documentation regarding the use of avrdude.

Known Issue With Auto-Reset[edit]

There is a known issue with auto-reset (a common feature on Arduino boards) and the ArduinoISP technique. You may, for example, get the "not in sync: resp=0x15" error message. If so, you may need to disable auto-reset. The ISP Shield 2.0 has a resistor on board for this eventuality.

Locate header J6 on the ISP Shield 2.0 and connect a jumper across the top and middle pins to override auto-reset, like so:

28.jpg

Connecting a jumper across the bottom two pins (or leaving the jumper off entirely) will allow the Arduino board to function normally:

29.jpg

Known Issue With Arduino Uno[edit]

We have found the ISP shield to work well when situated on top of the Arduino Uno, if you add a small capacitor, 0.1 uF or so, between RST and GND on the ISP shield. We recommend placing it into header J4, spanning from the leftmost pin (RST) to one of the two GND pins. (You may need to remove this capacitor when initially writing the ArduinoISP sketch).

This is similar to the technique recommended in the ArduinoISP tutorial of putting a 10 uF capacitor there, but also editing the ArduinoISP to account for the longer time constant associated with the larger capacitor.

Recent changes; Arduino variants that (historically) did not work[edit]

  • We have had two reports of the ArduinoISP method not working properly with the Arduino Mega 2560. This is due to a software problem, that may be fixed in future releases of the Arduino and/or ArduinoISP software. Some software workarounds have been reported to work.
  • Arduino IDE version 1.6.6 brings a number of improvements to the ArduinoISP process, which may address these issues. You can read more about that here.

Arduino variants that probably still will not work[edit]

  • The Arduino Yun does not connect the ArduinoISP control pins to the Digital I/O pins and will not work without custom wiring.