Microchip Technology TDGL002 - chipKIT Uno32 Development Board TDGL002 TDGL002 Data Sheet

Product codes
TDGL002
Page of 214
© 2011 Microchip Technology Inc.
DS61143H-page 85
PIC32MX3XX/4XX
5.0
FLASH PROGRAM MEMORY
PIC32MX3XX/4XX devices contain an internal
program Flash memory for executing user code. There
are three methods by which the user can program this
memory:
• Run-Time Self Programming (RTSP)
• In-Circuit Serial Programming™ (ICSP™)
• EJTAG Programming
RTSP is performed by software executing from either
Flash or RAM memory. EJTAG is performed using the
EJTAG port of the device and a EJTAG capable
programmer. ICSP is performed using a serial data
connection to the device and allows much faster pro-
gramming times than RTSP. RTSP techniques are
described in this chapter. The ICSP and EJTAG
methods are described in the “PIC32MX Flash
Programming Specification
” (DS61145), which can be
downloaded from the Microchip web site.
EXAMPLE 5-1:
Note 1: This data sheet summarizes the features
of the PIC32MX3XX/4XX family of
devices. It is not intended to be a compre-
hensive reference source. To comple-
ment the information in this data sheet,
refer to Section 5. “Flash Program
Memory”
 (DS61121) of the “PIC32
Family Reference Manual”
, which is
available from the Microchip web site
(
www.microchip.com/PIC32
).
2: Some registers and associated bits
described in this section may not be
available on all devices. Refer to
 in
this data sheet for device-specific register
and bit information.
Note:
Flash LVD Delay (LVDstartup) must be
taken into account between setting up and
executing any Flash command operation.
See 
 for a code example to
set up and execute a Flash command
operation.
NVMCON = 0x4004;
// Enable and configure for erase operation
Wait(delay);
// Delay for 6 µs for LVDstartup
NVMKEY = 0xAA996655;
NVMKEY = 0x556699AA;
NVMCONSET = 0x8000;
// Initiate operation
while(NVMCONbits.WR==1);
// Wait for current operation to complete