Friday 10 April 2015

ICSP custom cables and Arduino

As soon as we start getting familiar with the basics of Arduino, we start noticing some interesting components that are not commonly used on the Arduino. One of these things are the ICSP headers. They are those six pins that stick out, organized in a two-row three-column orientation.
As Arduino enthusiasts become familiar with the concept of microcontroller programming, they realize that programming is not as simple as plugging a USB cable into the microcontroller and pressing upload. However, technology is growing and there are already microprocessors that support USB protocol out of the box, yet they still have to be loaded with a specific firmware or program to run in a desired way. The main controller on the Arduino is a microcontroller that has a specific firmware on it in order to receive serial data and be programmed that way through USB. Without this firmware the code found in the Arduino IDE would not be compatible with the microcontroller. It is the ICSP header that allows the microcontroller to receive the firmware or program that does all the advanced functionalities that are desired.
ICSP stands for In Circuit Serial Programming, it is a standard way to program AVR chips. You may be asking what AVR is? AVR is a standard abbreviation used to classify Atmel microcontrollers. Atmel, a company that manufactures microcontrollers, has created a microcontroller (chip) that Arduino uses in its prototyping boards like Arduino UNO, make sense?


 

All this may seem like great knowledge but what can be done with this knowledge and just an Arduino? The webpage by Arduino explains a way to go from an Arduino UNO to an Arduino clone on a breadboard. Very exciting, we can actually create our own Arduino. Looking at all the wires that are required to connect the Arduino to the microcontroller to upload the boot loader, is disappointing and seems like too much. How about if a USB to serial converter cost too much for us? Are we expected to connect these wires every time we want to program this chip? What a hassle. I have a cheap and easy way to program your chip without much effort.
Enough with the learning let’s get our hands working and build a custom ICSP cable to program/bootload an Arduino, an ATMEGA328P (chip used in Arduino UNO) , or any other AVR microcontroller.
Things you will need:
  • Arduino0
  • IDE cable.
  • Bread Board and an Atmega328p or another Arduino
  • Jumpers and male headers if you are using a Bread board instead of another Arduino
Step 1: The IDE cable has one side that has a red wire coming to it. Count three pins in from the edge of the ide cable and make a mark, there are two rows so three times two will be six pins altogether. Do this on both sides of the cable.
 
Step 2: Cut the IDE Cable connector at the mark do this also on both sides of the cable. When the cable is cut, there will be more than six wires that are still attached to the connector. Count off six wires from the edge and strip the rest away from the connector
Step 3: This requires to gain some knowledge about ICSP pinouts. ISCP uses six pins to program the microcontroller and instead of spending my time, trying to explain what each pin does here (http://en.wikipedia.org/wiki/Incircuit_serial_programming) is a good Wikipedia article that explains it quite well.
Basically there is a power and ground, a clock signal, two signals for data, and most importantly a reset pin. I spent some time going down into the core of how everything is connected from an Arduino to an Arduino for Bootloading and noticed that there are predetermined pins on AVR microcontrollers for each of those pins on the ICSP connector. When doing a Bootloading/programming from Arduino to Arduino every pin is connected directly from chip to chip, meaning the data is connected directly to the data and so one. Only the reset pin is different, that is what makes this so nice. The programming Arduino sends the reset signal from one of its pins (pin 10 if using ArduinoISP sketch) and it connects to the reset of the programmed chip. In order to get the right configurations all we have to do is peel away the fifth wire on our new cable and solder a jumper to it.
\
Step 4: Clean up the connector by adding some heat shrink, plug it into you programming Arduino and you are set to go.
This is the best way to use your Arduino as a programmer. It allows you to use your Arduino for other projects but when you need a program all you have to do it plug in this custom cable. Instead of having 50 Arduinos for all our projects, we have shields that plug in and out making Arduino easy to use, This is a good comparison to an Arduino shield as it allows you to quickly add functionality of your Arduino with not much thought.

No comments:

Post a Comment