Friday, December 7, 2012

Customize ChipKit bootloader into PIC32 Chip

Burn the ChipKit bootloader into a PIC32 Chip
1.      Download the bootloader source file.
2.      Download MPLAB 8 or MPLAB X and the C32 v2.02 compiler
3.      Open one of the bootloader project which is closest to your chip. I have opened uno32.mcp and save it to another project named NewProject
4.      Open the BoardConfig.h and copy one block of code and rename the board name as ‘#elif defined(_BOARD_CHIPKIT_PIC440_)’
a.       Change the capabilities, add blCapUSBInterface
b.      Change the bootLED and download LED pin
c.       Comment # define _USE_UART1_FOR_BOOTLOADER
d.      Define the fLoadFromAVRDudeViaProgramButton pin
                        #define fLoadFromAVRDudeViaProgramButton        (PORTEbits.RE4 == 0)
#define fLoadFromAVRDudeViaVirtualProgramButton (LATEbits.LATE4 == 1)    
#define ClearVirtualProgramButton()             (LATECLR = (1 << 4))
e.       Change the Flash Bytes size : 
#define FLASH_BYTES                 0x80000             // 512K
5.      Open the project in mpLab and programe the code into the chip. Then you need to go into the build options and remove the existing preprocessor macro in the MPLAB PIC32 C Compiler tab and add in the new macro you defined (_BOARD_CHIPKIT_PIC440_).  One important thing is to specify the C32 compiler v2.02.
6.      Program the board in mpIDE with arduino code. If you can blink the LED, you are there.

The detailed process is in ChipKit forum.

No comments:

Post a Comment