In-system programming

Last updated

6- and 10-pin AVR ISP headers Isp headers.svg
6- and 10-pin AVR ISP headers

In-system programming (ISP), or also called in-circuit serial programming (ICSP), is the ability of some programmable logic devices, microcontrollers, chipsets and other embedded devices to be programmed while installed in a complete system, rather than requiring the chip to be programmed prior to installing it into the system. It also allows firmware updates to be delivered to the on-chip memory of microcontrollers and related processors without requiring specialist programming circuitry on the circuit board, and simplifies design work. [1]

Contents

Overview

There is no standard for in-system programming protocols for programming microcontroller devices. Almost all manufacturers of microcontrollers support this feature, but all have implemented their own protocols, which often differ even for different devices from the same manufacturer. In general, modern protocols try to keep the number of pins used low, typically to 2 pins. Some ISP interfaces manage to achieve the same with just a single pin, others use up to 4 for implementing a JTAG interface.

The primary advantage of in-system programming is that it allows manufacturers of electronic devices to integrate programming and testing into a single production phase, and save money, rather than requiring a separate programming stage prior to assembling the system. This may allow manufacturers to program the chips in their own system's production line instead of buying pre-programmed chips from a manufacturer or distributor, making it feasible to apply code or design changes in the middle of a production run. The other advantage is that production can always use the latest firmware, and new features as well as bug fixes can be implemented and put into production without the delay occurring when using pre-programmed microcontrollers.

Microcontrollers are typically soldered directly to a printed circuit board and usually do not have the circuitry or space for a large external programming cable to another computer.

Typically, chips supporting ISP have internal circuitry to generate any necessary programming voltage from the system's normal supply voltage, and communicate with the programmer via a serial protocol. Most programmable logic devices use a variant of the JTAG protocol for ISP, in order to facilitate easier integration with automated testing procedures. Other devices usually use proprietary protocols or protocols defined by older standards. In systems complex enough to require moderately large glue logic, designers may implement a JTAG-controlled programming subsystem for non-JTAG devices such as flash memory and microcontrollers, allowing the entire programming and test procedure to be accomplished under the control of a single protocol.

History

Starting from the early 1990s an important technological evolution in the architecture of the microcontrollers was witnessed. At first, they were realized in two possible solutions: with OTP (one-time programmable) or with EPROM memories. In these technologies, memory-erasing process requires the chip to be exposed to ultraviolet light through a specific window above the package. In 1993 Microchip Technology introduced the first microcontroller with EEPROM memory: the PIC16C84. EEPROM memories can be electrically erased. This feature allowed to lower the realization costs by removing the erasing window above the package and initiate in-system programming technology. With ISP flashing process can be performed directly on the board at the end of the production process. This evolution gave the possibility to unify the programming and functional test phase and in production environments and to start the preliminary production of the boards even if the firmware development has not yet been completed. This way it was possible to correct bugs or to make changes at a later time. In the same year, Atmel developed the first microcontroller with flash memory, easier and faster to program and with much longer life cycle compared to EEPROM memories.

Microcontrollers that support ISP are usually provided with pins used by the serial communication peripheral to interface with the programmer, a flash/EEPROM memory and the circuitry used to supply the voltage necessary to program the microcontroller. The communication peripheral is in turn connected to a programming peripheral which provides commands to operate on the flash or EEPROM memory.

When designing electronic boards for ISP programming it’s necessary to take into account some guidelines to have a programming phase as reliable as possible. Some microcontrollers with a low number of pins share the programming lines with the I/O lines. This could be a problem if the necessary precautions are not taken into account in the design of the board; the device can suffer the damage of the I/O components during the programming. Moreover, it’s important to connect the ISP lines to high impedance circuitry both to avoid a damage of the components by the programmer and because the microcontroller often cannot supply enough current to pilot the line. Many microcontrollers need a dedicated RESET line to enter in the Programming Mode. It is necessary to pay attention to current supplied for line driving and to check for presence of watchdogs connected to the RESET line that can generate an unwanted reset and, so, to lead a programming failure. Moreover, some microcontrollers need a higher voltage to enter in Programming Mode and, hence, it’s necessary to check that this value it’s not attenuated and that this voltage is not forwarded to others components on the board.

Industrial application

In-System Programming process takes place during the final stage of production of the product and it can be performed in two different ways based on the production volumes.

In the first method, a connector is manually connected to the programmer. This solution expects the human participation to the programming process that has to connect the programmer to the electronic board with the cable. Hence, this solution is meant for low production volumes.

The second method uses test points on the board. These are specific areas placed on the printed board, or PCB, that are electrically connected to some of the electronic components on the board. Test points are used to perform functional tests for components mounted on board and, since they are connected directly to some microcontroller pins, they are very effective for ISP. For medium and high production volumes using test points is the best solution since it allows to integrate the programming phase in an assembly line.

In production lines, boards are placed on a bed of nails called fixture. The latter are integrated, based on the production volumes, in semiautomatic or automatic test systems called ATE (automatic test equipment). Fixtures are specifically designed for each board - or at most for few models similar to the board they were designed for – therefore these are interchangeable in the system environment where they are integrated. The test system, once the board and the fixture are placed in position, has a mechanism to put in contact the needles of the fixture with the Test Points on the board to test. The system it’s connected to, or has directly integrated inside, an ISP programmer. This one has to program the device or devices mounted on the board: for example, a microcontroller and/or a serial memory.

Microchip ICSP

For most Microchip microcontrollers, ICSP programming is performed using two pins, clock (PGC) and data (PGD), while a high voltage (12 V) is present on the Vpp/MCLR pin. Low voltage programming (5 V or 3.3 V) dispenses with the high voltage, but reserves exclusive use of an I/O pin. However, for newer microcontrollers, specifically PIC18F6XJXX/8XJXX microcontrollers families from Microchip Technology, entering into ICSP modes is a bit different. [2] Entering ICSP Program/Verify mode requires the following three steps:

  1. Voltage is briefly applied to the MCLR (master clear) pin.
  2. A 32-bit key sequence is presented on PGD.
  3. Voltage is reapplied to MCLR.
Microchip PICkit ICSP programmer Pic Icsp programmer.jpg
Microchip PICkit ICSP programmer

A separate piece of hardware, called a programmer is required to connect to an I/O port of a PC on one side and to the PIC on the other side. A list of the features for each major programming type are:

  1. Parallel port - large bulky cable, most computers have only one port and it may be inconvenient to swap the programming cable with an attached printer. Most laptops newer than 2010 do not support this port. Parallel port programming is very fast.
  2. Serial port (COM port) - At one time the most popular method. Serial ports usually lack adequate circuit programming supply voltage. Most computers and laptops newer than 2010 lack support for this port.
  3. Socket (in or out of circuit) - the CPU must be either removed from circuit board, or a clamp must be attached to the chip-making access an issue.
  4. USB cable - Small and light weight, has support for voltage source and most computers have extra ports available. The distance between the circuit to be programmed and the computer is limited by the length of USB cable - it must usually be less than 180 cm. This can make programming devices deep in machinery or cabinets a problem.

ICSP programmers have many advantages, with size, computer port availability, and power source being major features. Due to variations in the interconnect scheme and the target circuit surrounding a micro-controller, there is no programmer that works with all possible target circuits or interconnects. Microchip Technology provides a detailed ICSP programming guide [3] Many sites provide programming and circuit examples.

PICs are programmed using five signals (a sixth pin 'aux' is provided but not used). The data is transferred using a two-wire synchronous serial scheme, three more wires provide programming and chip power. The clock signal is always controlled by the programmer.

Typical programming communication Icsp communication.jpg
Typical programming communication

Signals and pinout

Pic icsp.jpg

RJ11 pinout

RJ11 to ICSP PIC programmer Rj11-4-6 to icsp.jpg
RJ11 to ICSP PIC programmer

An industry standard for using RJ11 sockets with an ICSP programmer is supported by Microchip. The illustration represents information provided in their data sheets. However, there is room for confusion. The PIC data sheets show an inverted socket and do not provide a pictorial view of pinouts so it is unclear what side of the socket Pin 1 is located on. The illustration provided here is untested but uses the phone industry standard pinout (the RJ11 plug/socket was original developed for wired desktop phones).

Related Research Articles

<span class="mw-page-title-main">Microcontroller</span> Small computer on a single integrated circuit

A microcontroller or microcontroller unit (MCU) is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs along with memory and programmable input/output peripherals. Program memory in the form of ferroelectric RAM, NOR flash or OTP ROM is also often included on chip, as well as a small amount of RAM. Microcontrollers are designed for embedded applications, in contrast to the microprocessors used in personal computers or other general purpose applications consisting of various discrete chips.

<span class="mw-page-title-main">EEPROM</span> Computer memory used for small quantities of data

EEPROM or E2PROM (electrically erasable programmable read-only memory) is a type of non-volatile memory. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip device, to store relatively small amounts of data by allowing individual bytes to be erased and reprogrammed.

<span class="mw-page-title-main">EPROM</span> Early type of solid state computer memory

An EPROM, or erasable programmable read-only memory, is a type of programmable read-only memory (PROM) chip that retains its data when its power supply is switched off. Computer memory that can retrieve stored data after a power supply has been turned off and back on is called non-volatile. It is an array of floating-gate transistors individually programmed by an electronic device that supplies higher voltages than those normally used in digital circuits. Once programmed, an EPROM can be erased by exposing it to strong ultraviolet (UV) light source. EPROMs are easily recognizable by the transparent fused quartz window on the top of the package, through which the silicon chip is visible, and which permits exposure to ultraviolet light during erasing.

<span class="mw-page-title-main">AVR microcontrollers</span> Family of microcontrollers

AVR is a family of microcontrollers developed since 1996 by Atmel, acquired by Microchip Technology in 2016. These are modified Harvard architecture 8-bit RISC single-chip microcontrollers. AVR was one of the first microcontroller families to use on-chip flash memory for program storage, as opposed to one-time programmable ROM, EPROM, or EEPROM used by other microcontrollers at the time.

<span class="mw-page-title-main">PIC microcontrollers</span> Line of single-chip microprocessors from Microchip Technology

PIC is a family of microcontrollers made by Microchip Technology, derived from the PIC1650 originally developed by General Instrument's Microelectronics Division. The name PIC initially referred to Peripheral Interface Controller, and is currently expanded as Programmable Intelligent Computer. The first parts of the family were available in 1976; by 2013 the company had shipped more than twelve billion individual parts, used in a wide variety of embedded systems.

<span class="mw-page-title-main">PIC16x84</span>

The PIC16C84, PIC16F84 and PIC16F84A are 8-bit microcontrollers of which the PIC16C84 was the first introduced in 1993 and hailed as the first PIC microcontroller to feature a serial programming algorithm and EEPROM memory. It is a member of the PIC family of controllers, produced by Microchip Technology. The memory architecture makes use of bank switching. Software tools for assembler, debug and programming were only available for the Microsoft Windows operating system.

Serial Peripheral Interface (SPI) is a de facto standard for synchronous serial communication, used primarily in embedded systems for short-distance wired communication between integrated circuits.

JTAG is an industry standard for verifying designs and testing printed circuit boards after manufacture.

<span class="mw-page-title-main">BASIC Stamp</span> Microcontrollers

The BASIC Stamp is a microcontroller with a small, specialized BASIC interpreter (PBASIC) built into ROM. It is made by Parallax, Inc. and has been popular with electronics hobbyists since the early 1990s.

<span class="mw-page-title-main">Programmer (hardware)</span> Device that configures programmable integrated circuits

A programmer, device programmer, chip programmer, device burner, or PROM writer is a piece of electronic equipment that arranges written software or firmware to configure programmable non-volatile integrated circuits, called programmable devices. The target devices include PROM, EPROM, EEPROM, Flash memory, eMMC, MRAM, FeRAM, NVRAM, PLDs, PLAs, PALs, GALs, CPLDs, FPGAs, and microcontrollers.

<span class="mw-page-title-main">PICAXE</span>

PICAXE is a microcontroller system based on a range of Microchip PIC microcontrollers. PICAXE devices are Microchip PIC devices with pre-programmed firmware that enables bootloading of code directly from a PC, simplifying hobbyist embedded development. PICAXE devices have been produced by Revolution Education (Rev-Ed) since 1999.

<span class="mw-page-title-main">AVR Butterfly</span>

The AVR Butterfly is a battery-powered single-board microcontroller developed by Atmel. It consists of an Atmel ATmega169PV Microcontroller, a liquid crystal display, joystick, speaker, serial port, real-time clock (RTC), internal flash memory, and sensors for temperature and voltage. The board is the size of a name tag and has a clothing pin on back so it can be worn as such after the user enters their name onto the LCD.

Microchip Technology Incorporated is a publicly listed American corporation that manufactures microcontroller, mixed-signal, analog, and Flash-IP integrated circuits. Its products include microcontrollers, Serial EEPROM devices, Serial SRAM devices, embedded security devices, radio frequency (RF) devices, thermal, power and battery management analog devices, as well as linear, interface and wireless products.

<span class="mw-page-title-main">DataFlash</span> Flash memory

DataFlash is a low pin-count serial interface for flash memory. It was developed as an Atmel proprietary interface, compatible with the SPI standard. In October 2012, the AT45 series DataFlash product lines, related intellectual property, and supporting employee teams were purchased by Adesto Technologies.

<span class="mw-page-title-main">PICkit</span>

PICkit is a family of programmers for PIC microcontrollers made by Microchip Technology. They are used to program and debug microcontrollers, as well as program EEPROM. Some models also feature logic analyzers and serial communications (UART) tools.

<span class="mw-page-title-main">Single-board microcontroller</span>

A single-board microcontroller is a microcontroller built onto a single printed circuit board. This board provides all of the circuitry necessary for a useful control task: a microprocessor, I/O circuits, a clock generator, RAM, stored program memory and any necessary support ICs. The intention is that the board is immediately useful to an application developer, without requiring them to spend time and effort to develop controller hardware.

<span class="mw-page-title-main">Bus Pirate</span> Microcontroller programmer and debugger

The Bus Pirate is a universal bus interface device designed for programming, debugging, and analyzing microcontrollers and other ICs. It was developed as an open-source hardware and software project.

<span class="mw-page-title-main">ATmega328</span> 8-bit microcontroller

The ATmega328 is a single-chip microcontroller created by Atmel in the megaAVR family. It has a modified Harvard architecture 8-bit RISC processor core.

<span class="mw-page-title-main">Arduino Uno</span> Microcontroller board

The Arduino Uno is an open-source microcontroller board based on the Microchip ATmega328P microcontroller (MCU) and developed by Arduino.cc and initially released in 2010. The microcontroller board is equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion boards (shields) and other circuits. The board has 14 digital I/O pins, 6 analog I/O pins, and is programmable with the Arduino IDE, via a type B USB cable. It can be powered by a USB cable or a barrel connector that accepts voltages between 7 and 20 volts, such as a rectangular 9-volt battery. It has the same microcontroller as the Arduino Nano board, and the same headers as the Leonardo board. The hardware reference design is distributed under a Creative Commons Attribution Share-Alike 2.5 license and is available on the Arduino website. Layout and production files for some versions of the hardware are also available.

The MPLAB series of devices are programmers and debuggers for Microchip PIC and dsPIC microcontrollers, developed by Microchip Technology.

References

See also