gnupic: Re: [gnupic] [PIC] Pickit 2 firmware available from the shipped CD
Subject:
RE: [gnupic] [PIC] Pickit 2 firmware available from the shipped C
D
From:
Chen Xiao Fan ####@####.####
Date:
24 Aug 2005 07:37:59 +0100
Message-Id: <3B8AEFFADD3DD4118F8100508BACEC2C0A2890B3@spex>
This is the API for the PICkit 2. It is quite the same as PICkit 1
except the bootloader function.
To get it work under Linux, there are several step.
1) Port usb_pickit (for PICKit 1 only) to PICkit 2.
2) fix the remaining problem of usb_pickit (save OSCCAL value, etc)
3) Port the bootloader to Linux
4) extend the chip support. The 1st thing to do is to implement
"8" (Write 8 words to program memory) to support new PIC16 and PIC18 device.
dsPIC support may not be so easy. :(
Now I am trying step 1. I will report back the progress.
Regards,
Xiaofan
/*********************************************************************
*
* Microchip PICkit 2 Flash Starter Kit
*
*********************************************************************
* FileName: pickit.h
* Dependencies: See INCLUDES section below
* Processor: PIC18
* Compiler: C18 2.30.01+
* Company: Microchip Technology, Inc.
*
* Software License Agreement
*
* The software supplied herewith by Microchip Technology Incorporated
* (the "Company") for its PICmicro® Microcontroller is intended and
* supplied to you, the Company's customer, for use solely and
* exclusively on Microchip PICmicro Microcontroller products. The
* software is owned by the Company and/or its supplier, and is
* protected under applicable copyright laws. All rights are reserved.
* Any use in violation of the foregoing restrictions may subject the
* user to criminal sanctions under applicable laws, as well as to
* civil liability for the breach of the terms and conditions of this
* license.
*
* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT NOT LIMITED
* TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE COMPANY SHALL NOT,
* IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL OR
* CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
*
* Author Date Comment
*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Steven Bible 2004-11-04 Initial Write
* Steven Bible 2005-04-20 Version 1 Released
********************************************************************/
#ifndef PICKIT_H
#define PICKIT_H
/** D E F I N I T I O N S
****************************************************/
#define MAJORVERSION 1
#define MINORVERSION 0
#define DOTVERSION 1
#define BUF_SIZE 64
#define WRITECONFIG 'C' // Set Program Counter to 0x2000 (Config
Mem)
#define CMDTABLE 'c' // Download command table
#define WRITEDATA 'D' // Write data memory
#define ERASEPGM 'E' // Bulk erase program memory
#define ERASEDATA 'e' // Bulk erase data memory
#define RECEIVE 'g' // Get n bytes from flash device
#define INCADDRESS 'I' // Increment address
#define ENTERPROGVDD1ST 'O' // Enter programming mode
#define ENTERPROG 'P' // Enter programming mode
#define EXITPROG 'p' // Exit programming mode
#define READPGM 'R' // Read program memory
#define READDATA 'r' // Read EE data memory
#define CHECKSUM 'S' // Calculate checksum
#define TRANSFER 't' // Transfer n bytes to flash device
#define POWERCTRL 'V' // Turn Vdd on/off; turn 5kHz square
wave on/off
#define GETVERSION 'v' // Get firmware version number
#define WRITEPGM 'W' // Write program memory
#define WRITEPGMEXT 'w' // Write 1 word to program memory,
externally timed
#define WRITE4WORDS '4' // Write 4 words to program memory
#define BOOTMODE 'B' // Enter bootloader mode
#define LOADCONFIG CommandTable[0]
#define LOADPGM CommandTable[1]
#define LOADDATA CommandTable[2]
#define READPGMMEM CommandTable[3]
#define READDATAMEM CommandTable[4]
#define INCRADDRESS CommandTable[5]
#define BEGINPROG CommandTable[6]
#define BEGINPROGEXT CommandTable[7]
#define ENDPROG CommandTable[8]
#define BULKERASEPGM CommandTable[9]
#define BULKERASEDATA CommandTable[10]
#define UNDEFINEDCMD1 CommandTable[11]
#define UNDEFINEDCMD2 CommandTable[12]
#define UNDEFINEDCMD3 CommandTable[13]
#define UNDEFINEDCMD4 CommandTable[14]
#define UNDEFINEDCMD5 CommandTable[15]
/** P U B L I C P R O T O T Y P E S
*****************************************/
void PICkitInit(void);
void ProcessIO(void);
#endif // PICKIT_H