Add to Technorati Favorites Electronics Projects and Articles: May 2009

Thursday, May 7, 2009

Programmers for PICs

I've created this blog to write electronics projects and electronics articles which can be used by any person interested in the electronic design. Your questions, doubts, comments and suggestions are welcome providing that they are written in a courteous and respectful way.

--EspaƱol-----English



PROGRAMMERS FOR PICs

In a previous post on Firmware Category named "PIC Microcontrollers Languages", I described and compared the programming languages for PICs. However, a pending topic is the interface between the computer and the PIC micro. This article describes types of programmers but first I shall explain different development tools to contextualize the reader about the final goal: programmer.

Goals:

  • Clarifying concepts of terminology for development tools for PIC microcontrollers.
  • Understanding the basic concepts about programmer interface.
  • Describing the programmers of Microchip and giving other options for programming PIC microcontrollers.
  • A glance at Microchip’s Emulators and Debuggers tools.
Background

It is very important to explain some concepts for development tools of PIC microcontrollers. Sometimes, there is confusion among the words Compile, Debug, Simulate and Emulate. In electronic design these terms have different meanings.

Compile: It is the process of translating a source code to the language of the machine. Source Code in Assembly language or C language to OPCODES in Hexadecimal or Binary format.

Debug: It is the process to check the source code or program to eliminate possible mistakes from it and at the same time to optimize the program and increasing its velocity of execution. Debug processes are used in both design or development stages.

Simulate: In PIC microcontrollers, simulate is the way to carry out a real experiment into a virtual environment running the source code step by step or by loops to analyze the performance and affected registers in the device. You can even simulate logic states on the pins and check behaviors in your source code. You can do all of this if you have the appropriate software tools.

Emulate: When you have an appropriate interface you can pretend that you have a program memory PIC and run the source code (firmware) from a PC and look at program memory and file registers and at the same time look at the behavior of the source code when real external signals are applied.
We emulate to debug the source code. This emulation can be done in real time and to full speed (speed of PIC). All this not only requires an appropriate hardware interface but also the appropriate software to emulate from the PC.

Microchip classifies its development tools into four groups as follows:
  • Compilers: To compile source codes. In all cases these are software tools.
  • Emulators: To debug and emulate source codes, even to program devices.
  • Debuggers: To debug and develop, some of which also can provide services for programming.
  • Programmers: To program devices exclusively.
Figure 1. Microchip's Development tools classification.

Many development tools interact with the MPLAB Integrated Development Environment but not all need MPLAB IDE or a PC to work because some of them can work standalone mode for programming without a PC.

A programmer is an electronic device that communicates a computer and a PIC micro to transmit data, especially a compiled source code.

The interface block diagram is shown in figure 2.


Figure 2. Programmer interface diagram block.

Some debuggers and emulators can include a programmer interface or internal programmer device to program PIC microcontrollers.

A glance at Microchip's Emulators and Debuggers

In slide 1, I only describe general aspects about Microchip’s Development Tools, Emulators and Debuggers, but if you want to go into the subject in depth you can visit: START NOW WITH MICROCHIP DEVELOPMENT TOOLS page.


Slide 1. Microchip's Emulators and Debuggers.

Microchip's Programmers

The most popular Microchip programmers are detailed below:

1. MPLAB PM3

Definition: The MPLAB PM3 is a Universal Device Programmer which is easy to use and operates with a PC or as a stand-alone unit.



Uses:
  • Programming Microchip's entire line of PIC devices as well as the latest dsPIC DSC devices.
  • Program devices using ICSP. (In-Circuit Serial Programming.) on the target board.
  • Verify that code in the target microcontroller matches your firmware and verify that microcontrollers are blank.
  • Read code from an unprotected microcontroller into MPLAB IDE’s program memory window for debugging and programming into other devices.
  • With an optional MPLAB PM3 Card inserted, which is an SD-MMC memory card, you can store and transport device settings for programming.
  • Using MPLAB IDE as the interface, MPLAB PM3 becomes another tool in MPLAB IDE, allowing you to quickly compile, test and debug your firmware, then download it into MPLAB PM3 to be programmed into your device.
  • Without a PC connection to MPLAB PM3, the unit operates as a stand-alone device programmer. In this mode the main programmer features of MPLAB PM3 are available, including Read, Program and Verify.
Notes:
- Each version of MPLAB IDE has upgrades to support new devices in MPLAB PM3.
- A PC connection is required for operating system updates.
- MPLAB PM3 hardware requires the following software support if you are using a PC running Windows: MPLAB IDE software and USB communications driver.

Communications: MPLAB PM3 has two communication ports, Serial (COM 1-4) or USB (standard). Serial communications are 57.6K (default) or 9.6K baud, 8 data bits, 1 stop bit, no parity.

Components:
• MPLAB PM3 device programmer
• Serial Cable for RS-232 PC connection
• USB cable for USB PC connection
• ICSP cable
• Power supply and power cables
• MPLAB Integrated Development Environment CD
• User’s manual and technical documentation on CD
• Sockets to insert devices to program them.

Additional parts:
Main Sockets:
• Part Number: AC164301 - 18L/28L/40L DIP Socket Module for MPLAB PM3: This socket module supports 8P, 14P, 18P, 28P, and 40P DIP PICmicro or dsPIC devices on MPLAB PM3 Programmer.
• Part Number: AC164303 - 16L (.150), 18L, 28L (.300) SOIC Socket Module for MPLAB PM3: This socket module supports 64L TQFP PICmicro or dsPIC devices on MPLAB PM3 Programmer.
• Part Number: AC164305 - 44L TQFP Socket Module for MPLAB PM3: This socket module supports 44L TQFP PICmicro or dsPIC devices on MPLAB PM3 Programmer.
• Part Number: AC164306 - 20L TSSOP Socket Module for MPLAB PM3: This socket module supports 20L TSSOP PICmicro or dsPIC devices on MPLAB PM3 Programmer.
• Part Number: AC164307 - 28L SSOP Socket Module for MPLAB PM3: This socket module supports 28L SSOP PICmicro or dsPIC devices on MPLAB PM3 Programmer.
• Part Number: AC164308 - 68L PLCC Socket Module for MPLAB PM3: This socket module supports 68L PLCC PICmicro or dsPIC devices on MPLAB PM3 Programmer.
• Part Number: AC164309 - 44L PLCC Socket Module for MPLAB PM3: This socket module supports 44L PLCC PICmicro or dsPIC devices on MPLAB PM3 Programmer.

Cost: USD 895 Including all components except the sockets. The sockets have additional cost for sockets.

2. PICSTART PLUS

Definition: The PICSTART Plus is a Microchip microcontroller development programmer that enables you to program user software into PICmicro microcontroller devices.




Uses:
  • Using MPLAB IDE as the interface, PICSTART PLUS Programs PICmicro microcontrollers, including program memory, configuration bits and ID locations.
  • You can verify that PICmicro MCUs are blank, verify that code in the target microcontroller matches your firmware and you can read code from an unprotected PICmicro MCU into the MPLAB IDE program memory window for debugging and programming into other PICmicro MCU devices.

Notes:
- Devices in non-DIP packages that are supported by the PICSTART Plus require the use of an adapter. Those currently available are listed on the Microchip web site.
- In the future it is possible a firmware upgrade to include new devices. The firmware is upgradeable using MPLAB IDE

Communications: PICSTART Plus provides communications with the host PC via an RS-232 9-pin, D type connector. PICSTART Plus is Data Communication Equipment (DCE), and hardware handshaking is via Clear-To-Send (CTS) and Request-To-Send (RTS). The unit defaults to a 19.2K baud rate, 8 data bits, 1 stop bit, no parity, Hardware flow control, FIFO Buffers should be disabled.

Components:
• PICSTART Plus development programmer
• RS-232 Interface cable to connect to any standard PC serial port
• 9V power supply
• MPLAB IDE
• Blank chip for programming

Cost: USD 200, This kit contains the programmer, RS-232 serial cable, power supply, user guide, and a copy of MPLAB IDE on CD.

3. PRO MATE II

Definition: The full-featured, modular PRO MATE II device programmer lets you quickly and easily program your software into Microchip’s entire line of PIC MCUs, KEELOQ security products and Serial EEPROMs. PRO MATE II runs under MPLAB IDE and operates as a stand-alone unit or in conjunction with a PC-compatible host system.



Note: This product is no longer in production. It is still supported and accessories can be purchased for the immediate future.

OTHER SOLUTIONS

In addition to Microchip’s programmers there are several programmers that are offered by different manufacturers. Some of these programmers can support several devices and microcontrollers from other manufacturers and also Microchip devices including PIC microcontrollers. To name a few:
  • Conitec Data Systems has two device programming machines: GALEP-5 and GALEP-5D. Each one has its device list supported but Conitec has the free Device on Demand Service for fast implementation of a new chip into the programmer device list.
  • Xeltek has eight SuperPro Universal Programmers: 5000, 5004GP, 501S, 500P, 300U, 9000U, 280U, 580U. Some of them are stand-alone units. Also, whether you have a need for development or volume production purposes some of them allow you program more than one PIC micro simultaneously. Xeltek offers you free software updates available for download at its PIC Programmer software Download Center.
In addition to previously description about programmers, I can tell you that most of PIC Microcontrollers have an In-Circuit Serial Programming (ICSP) incorporated to them. This is important because in this way you can program a specific device. ICSP is an enhanced ISP (In System Programming) technique implemented in Microchip’s PICmicro One-Time-Programmable (OTP) and FLASH RISC microcontrollers (MCU) where a programmable device is programmed both before and after the device is placed in a circuit board. This technique use of only two I/O pins to serially input and output data makes ICSP easy to use and less intrusive on the normal operation of the MCU. Each Datasheet device provides its own specifications to implement ICSP. Remember, ICSP is only useful for a specific PIC micro therefore that ICSP circuitry couldn’t work appropriately for another reference. Additionally you need special software to load the OP CODES into PIC micro.

Finally, If you like do it yourself, on Internet you can find many options to build your own PIC programmer. There, you can find from specific device programmers up to Semi-Professional programmers, each one with its advantages and disadvantages. Also, it is possible that you need additional software to MPLAB IDE to burn a PIC with your firmware. I do not recommend any specific programmer because it depends on your requirements and I would have to build it and test it to recommend it to you.