Communication protocol
Writing or reading data to / from usbpicprog occurs in a binary form. Commands which require no additional data are just single byte instructions (erase, read_id and get_firmware version). All other commands start with a 6-byte header see the table below.
The communication occurs through an usb_interrupt_write (libusb). The device ID of usbpicprog is:
04D8:000E
#define CMD_ERASE 0x10
#define CMD_READ_ID 0x20
#define CMD_WRITE_CODE 0x30
#define CMD_READ_CODE 0x40
#define CMD_WRITE_DATA 0x50
#define CMD_READ_DATA 0x60
#define CMD_WRITE_CONFIG 0x70
#define CMD_SET_PICTYPE 0x80
#define CMD_FIRMWARE_VERSION 0x90
#define CMD_DEBUG 0xA0
typedef union _UppPackage
{
struct _fields
{
unsigned cmd:8;
unsigned size:8;
unsigned addrU:8;
unsigned addrH:8;
unsigned addrL:8;
unsigned blocktype:8;
unsigned char dataField[32];
}fields;
char data[38];
}UppPackage;
| Command | Command Code | Data (PC to Usbpicprog) | Data (Usbpicprog to PC) |
| Bulk erase | 0×10 | - |
|
| Read DEVID | 0×20 | - |
|
| Write CODE memory | 0×30 |
|
|
| Read CODE memory | 0×40 |
|
|
| Write DATA memory | 0×50 |
|
|
| Read DATA memory | 0×60 |
|
|
| Write Config words | 0×70 |
|
|
| Set pic type | 0×80 |
|
|
| Read usbpicprog firmware version | 0×90 | - | “Usbpicprog 0.3.0″ |
| Debug the programmer
(for development purposes only) |
0xA0 |
|
|