Getting Started with PIC32

From Mech
Revision as of 07:47, 11 August 2009 by Andrew Long (talk | contribs) (New page: Follow these steps to get started with PIC32. = Software = MPLAB is the software used for editing, compiling, debugging code. This software creates the HEX files to download to the PIC....)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Follow these steps to get started with PIC32.

Software

MPLAB is the software used for editing, compiling, debugging code. This software creates the HEX files to download to the PIC.

Download and Install Microchip MPLAB (Microchip's free IDE for editing, debugging and compiling code)

Download and Install Microchip C32 Compiler (the academic version is free)

Download and Install Microchip Applications Library located at bottom of page. This zip file contains common source code and header files. There is a separate stack for PIC32, but it has been rumored that the PIC32 stack is going to get merged with the applications library therefore the code on this website is based on the application library stack.

  • Header files from the framework do not need to be specifically added to the project in MPLAB, but MPLAB needs to be directed to their location (see getting Directions for Starting New MPLAB Project)
  • Source files from the framework do need to be added to the project

Bootloader

An advantage of the PIC32 is that a bootloader can be installed. This means you do not need to a programmer to put new programs on the PIC. The UBW32 comes preloaded with a bootloader.

The HID bootloader is used to put HEX files on the PIC32. The v2.4 executable can be downloaded here.

NOTE: occassionally, the bootloader will get stuck verifying that the program is running. (There must be a bug in the bootloader application code) It will take 90-100% of CPU. End task manually with the task manager if this happens.

See Programming Bootloader on PIC32 for directions on how to create your own bootloader.

Linker File

When creating new projects to download to the PIC, you must include a linker file. If you have installed a bootloader, the linker file tells the bootloader to put the program after the bootloader memory. The required linker file is called procdefs.ld. The standard linker file is here. linker file is in the project folder. The procdefs.ld for UBW32 is different than the standard procdefs.ld for PIC32 when using the bootloader originally installed on UBW32. Make sure to use the procdefs.ld file here for UBW32.

This website warns that if the procdefs linker file is not in the project the bootloader may be hosed.