Thursday, November 1, 2012

AVR ISP ScoketBoard

Most Atmel AVR microcontrollers can be programmed via their in-built serial programming interfaces (SPI). This method is ideal for in-situ programming, such as might be used in manufacturing or for firmware development or field upgrades.

In this scenario, the micro remains in its socket on the application board and a low-cost in-system programmer (ISP) is plugged into a dedicated programming header. In other words, the microcontroller does not have to be removed from its socket and plugged into a parallel programmer each time a firmware update is required.

However, in some cases it is desirable to programme a microcontroller stand-alone, such as when the application board is unavailable or doesn’t include an ISP (or JTAG) header. A low-cost method of stand-alone programming might also be useful where a batch of chips is needed for a small prototype run and the cost of a commercial parallel programmer is prohibitive.

This is where the AVR ISP SocketBoard comes in. It provides the minimum of functions necessary to support in-system programming, including a regulated power supply,clock source and microcontroller IC socket. Just connect your in-system programmer to a PC, plug its ISP cable into the SocketBoard’s on-board header and add a DC plugpack. You’re then ready to start programming!

Programming sockets
As you can see from the photos, the SocketBoard contains five programming sockets. Why so many? Well, we’ve provided one programming socket for each group of micros with common SPI pinouts. This allowed us to eliminate the switching logic that would have been required if we’d used just a single, 40-pin socket, so greatly simplifying design and construction.

We expect that many constructors will install just one or two programming sockets (depending on their requirements), to keep costs as low as possible. The overlay diagram (Fig.2) lists specific device types and the sockets (SK1 to SK5) that support them. For example, to program the ATM ega16, socket SK4 must be installed.
For cases where quantities of chips need to be programmed, the board will accept standard zero insertion force (ZIF) sockets as well. There is absolutely no need to install ZIF sockets (as shown in our photos) for occasional programming; this would simply be expensive overkill.

The unit can be powered from a 12V DC 150mA (or higher) unregulated plugpack, which also powers the ISP programmer when it’s plugged into the on-board header.

As mentioned, the SocketBoard provides the minimum of functions necessary to support in-system programming. As stated, this includes a series of programming sockets to accommodate the different types of AVR micros, a regulated power supply, and a clock source.

The power supply is based around two series-connected LM317 adjustable positive regulators (see Fig.1). The first regulator acts as a current limiter. In normal operation, it performs no function. However, should the current through R1 increase to a level where about 1.25V is dropped across it, REG1 begins to reduce the voltage at its OUT terminal. In effect, REG1 then acts as a constant current source, limiting output current to a
maximum of 125mA.
AVR ISP SocketBoard
In normal operation, the complete setup consumes an average of about 20 to 40mA, depending on the type of in-system programmer connected. The remaining capacity (85 to 105mA) leaves a comfortable margin, which in most cases is still low enough to preserve any micro that might be accidentally reversed in a socket. It also protects other components if an internally short-circuited micro is plugged into a socket.

The second regulator (REG2) is configured as a conventional voltage regulator. Without JP1 installed, it produces +5V to power the system. Installing JP1 reduces this to +3V. Some constructors may find this lower voltage useful for verifying the memory in micros that are destined for 3V systems.

As well as power, AVR micros require a clock source for their internal programming circuits to operate. This is provided by a Pierce oscillator, which is composed of a 4MHz crystal (X1), two resistors and one gate of a 74HC04 hex inverter (IC1a). A second gate (IC1b) buffers the clock signal before it is applied to all of the programming sockets. A 47W resistor provides series termination and current limiting.

All that now remains to be described is the ISP interface. This is extremely simple indeed, as it consists only of a 10-pin DIL header (CON2) and five resistors. The four 100W series resistors act as peak current limiters, in case the ISP cable or a chip is accidentally inserted with power applied. These also help to protect the programmer if a faulty micro is inserted in a socket. The remaining resistor (47kW) pulls down the interface’s RESET line, so that the micro is held in the reset state if a programmer is not connected or is non-functional.

Connect a 12V DC source to the DC socket (CON1), noting that the centre pin is the positive input. If the power connections are accidentally reversed, nothing bad will happen as a series diode (D1) provides polarity protection.

Now apply power by sliding switch S1’s actuator towards the edge of the board. The power LED should light immediately. If it doesn’t, either the power connections are reversed or there is an assembly error. Carefully recheck the board against the overlay diagram and look for dry or missed solder joints.

Next, use your multimeter to measure the voltage between pins 7 and 14 of IC1’s socket. Expect a reading of 5V ±5%. Temporarily insert a jumper shunt on JP1 and measure the voltage again. This time, you should get the lower reading of 3V ±5%. When done, remove
the jumper, as in the majority of applications, a 5V supply is preferred for programming.

If the power supply checks out, switch off and insert IC1 into its socket. Naturally, the position of the notched (pin 1) end of this IC must match that
of the IC socket.

Using it
It doesn’t take a lot of grey matter to use the SocketBoard. Simply switch power off, plug your in-system programmer into the AVR ISP connector (CON2), and insert the microcontroller to be programmed into the designated socket. After switching on, the micro can be programmed following the instructions supplied with your ISP.

Important: always switch the power off before inserting or removing a microcontroller from its programming socket.

Note that 8-pin micros present a special case. Instead of a separate socket, all 8-pin devices are programmed in the first 20-pin socket (SK1). In addition, jumper shunts must be installed on JP2 and JP3 to route signals to the correct places for these diminutive

After programming an 8-pin device, the two jumper shunts (JP2 and JP3) should be removed if you also intend to program 20-pin devices in the same socket. This ensures that there is no possibility of damage to the larger devices.

If a faulty micro is inserted in a socket or if a working device is inserted backwards, the current-limit function will swing into action. In most cases, the current passed through the part should not be destructive – if the problem is noticed right away and power is switched off immediately! 

Downloads: PCB layout

No comments:

Post a Comment