Difference between revisions of "PG302"
Line 1: | Line 1: | ||
The PG302 is a flash programmer produced by the now-defunct Iguana Labs, who provided kits and tutorials for learning how to program micro-controllers in the early 2000s. I use the programmer to write programs onto Atmel 89C2051 chips that cost less than two dollars each. | The PG302 is a flash programmer produced by the now-defunct Iguana Labs, who provided kits and tutorials for learning how to program micro-controllers in the early 2000s. I use the programmer to write programs onto Atmel 89C2051 chips that cost less than two dollars each. | ||
+ | ===Using the PG302 with a computer=== | ||
Iguana Labs provided a program for Windows that communicated with the programmer, allowing us not only to program chips, but to read programs from the chips, lock them, erase them, or verify their contents. There being good open-source tools for developing 8051 programs *nux, like [[http://mcu8051ide.sourceforge.net MCU 8051 IDE]], I would prefer to use the programmer in Linux or Mac. The three options for this out-of-the-Windows use are | Iguana Labs provided a program for Windows that communicated with the programmer, allowing us not only to program chips, but to read programs from the chips, lock them, erase them, or verify their contents. There being good open-source tools for developing 8051 programs *nux, like [[http://mcu8051ide.sourceforge.net MCU 8051 IDE]], I would prefer to use the programmer in Linux or Mac. The three options for this out-of-the-Windows use are | ||
#Use [[http://pg302.sourceforge.net/ PG302-Linux]], a program the author admits is buggy. I haven't had success with it yet. | #Use [[http://pg302.sourceforge.net/ PG302-Linux]], a program the author admits is buggy. I haven't had success with it yet. | ||
− | #Use a program intended for direct serial communication, like GtkTerm. I have had success loading a program, using the protocol provided with PG302-Linux. For example, I open a serial port at 57600 baud, 8 bits, 1 stop bit, no parity, no flow control, to a serial cable connected to the programmer. Then I can issue commands like "3", which requests the chip checksum. For the complete protocol, see http://pg302.sourceforge.net/protocol.html | + | #Use a program intended for direct serial communication, like GtkTerm. I have had success loading a program, using the protocol provided with PG302-Linux. For example, I open a serial port at 57600 baud, 8 bits, 1 stop bit, no parity, no flow control, to a serial cable connected to the programmer. Then I can issue commands like "3", which requests the chip checksum. For an example session, see below. For the complete protocol, see http://pg302.sourceforge.net/protocol.html |
#Write a program to provide a GUI like the original PG302 control program for Windows. This could be done in Cocoa for Mac, with I/O Kit for serial communication, and a window with pull-down menus to select speed, buttons for various commands, and a file selector for reading, writing, and verifying files. | #Write a program to provide a GUI like the original PG302 control program for Windows. This could be done in Cocoa for Mac, with I/O Kit for serial communication, and a window with pull-down menus to select speed, buttons for various commands, and a file selector for reading, writing, and verifying files. | ||
+ | |||
+ | ===Downloading a program via serial=== | ||
+ | Use a program that allows you to send hexadecimal or binary data over the serial line. | ||
+ | #Create a serial session between the computer and the programmer, at 57600 baud, 8 bits, 1 stop bit, no parity, no flow control. | ||
+ | #Reset the programmer by unplugging it and plugging it in. | ||
+ | #Send the letter "P". | ||
+ | #Check for the reply "Y". | ||
+ | #Send the numeral "0". | ||
+ | #Send the hexadecimal value 1 (Use "send hexadecimal data"—It's in the View menu of GtkTerm) | ||
+ | #Send the hexadecimal value 1 again | ||
+ | #Check for the reply "N" which means "send the next line of the program" | ||
+ | #Send the first line of the hex file (which your assembler generated) as text, including the colons, like ":0030A701" | ||
+ | #Check for the reply "N", or "I" which means that line does not have the proper checksum. | ||
+ | #Repeat for each line in the hex file in order, until the last line, which should start with ":00" and end in "FF" is sent | ||
+ | #Check for the final reply, "D" which means no errors, or "C", which means the hex file seems corrupt. | ||
==See also== | ==See also== |
Revision as of 00:35, 7 November 2013
The PG302 is a flash programmer produced by the now-defunct Iguana Labs, who provided kits and tutorials for learning how to program micro-controllers in the early 2000s. I use the programmer to write programs onto Atmel 89C2051 chips that cost less than two dollars each.
Using the PG302 with a computer
Iguana Labs provided a program for Windows that communicated with the programmer, allowing us not only to program chips, but to read programs from the chips, lock them, erase them, or verify their contents. There being good open-source tools for developing 8051 programs *nux, like [MCU 8051 IDE], I would prefer to use the programmer in Linux or Mac. The three options for this out-of-the-Windows use are
- Use [PG302-Linux], a program the author admits is buggy. I haven't had success with it yet.
- Use a program intended for direct serial communication, like GtkTerm. I have had success loading a program, using the protocol provided with PG302-Linux. For example, I open a serial port at 57600 baud, 8 bits, 1 stop bit, no parity, no flow control, to a serial cable connected to the programmer. Then I can issue commands like "3", which requests the chip checksum. For an example session, see below. For the complete protocol, see http://pg302.sourceforge.net/protocol.html
- Write a program to provide a GUI like the original PG302 control program for Windows. This could be done in Cocoa for Mac, with I/O Kit for serial communication, and a window with pull-down menus to select speed, buttons for various commands, and a file selector for reading, writing, and verifying files.
Downloading a program via serial
Use a program that allows you to send hexadecimal or binary data over the serial line.
- Create a serial session between the computer and the programmer, at 57600 baud, 8 bits, 1 stop bit, no parity, no flow control.
- Reset the programmer by unplugging it and plugging it in.
- Send the letter "P".
- Check for the reply "Y".
- Send the numeral "0".
- Send the hexadecimal value 1 (Use "send hexadecimal data"—It's in the View menu of GtkTerm)
- Send the hexadecimal value 1 again
- Check for the reply "N" which means "send the next line of the program"
- Send the first line of the hex file (which your assembler generated) as text, including the colons, like ":0030A701"
- Check for the reply "N", or "I" which means that line does not have the proper checksum.
- Repeat for each line in the hex file in order, until the last line, which should start with ":00" and end in "FF" is sent
- Check for the final reply, "D" which means no errors, or "C", which means the hex file seems corrupt.
See also
Atmel, a manufacturer of 8051 devices: http://www.atmel.com/products/microcontrollers/8051architecture/default.aspx