MCU - PIC24FV32KA304 - MICROCHIP - Programming Specifications
MCU - PIC24FV32KA304 - MICROCHIP - Programming Specifications
IDE:
...\Microchip\MPLAB IDE\REAL ICE
and then selecting the hex PE file,
RIPE_01b_xxxxxx.hex.
Command Description
SCHECK Sanity check.
READC Read Device ID registers.
READD Read data EEPROM memory.
READP Read Code register.
PROGC Write User ID.
PROGD Program and verify one word of data
EEPROM memory.
PROGP
Program and verify one row of code
memory or one Configuration register.
QBLANK Query if the code memory is blank.
QVER Query the software version.
Start
End
Perform Chip
Erase
Program and Verify
Enter ICSP Mode
Program and Verify
Exit Enhanced ICSP Mode
Program and Verify
Code Memory
Data EEPROM Memory
Configuration Bits
Enter Enhanced ICSP Mode
Exit ICSP Mode
2011 Microchip Technology Inc. Advance Information DS39919B-page 25
PIC24FXXKA1XX/FVXXKA3XX
4.2 Confirming the Presence of the
Programming Executive
Before beginning programming, confirm if the
programming executive is stored in the executive
memory and perform the following:
1. Enter In-Circuit Serial Programming mode
(ICSP).
2. Read the unique Application ID Word stored in
the executive memory.
Figure 4-2 illustrates this procedure.
If the programming executive is resident, the
Application ID Word is CBh, which means
programming can resume as normal. However, if the
Application ID Word is not CBh, the programming
executive must be programmed to executive code
memory using the method described in Section 5.4
Programming the Programming Executive to
Memory.
Section 3.0 Device Programming ICSP describes
the ICSP programming method. Section 3.13 Reading
the Application ID Word describes the procedure for
reading the Application ID Word in ICSP mode.
FIGURE 4-2: CONFIRMING PRESENCE
OF PROGRAMMING
EXECUTIVE
Is
Start
Enter ICSP Mode
Application ID
CBh?
Resident in Memory
Yes
No
Prog. Executive is
Application ID
Read the
be Programmed
Prog. Executive must
from Address
8007F0h
Finish
PIC24FXXKA1XX/FVXXKA3XX
DS39919B-page 26 Advance Information 2011 Microchip Technology Inc.
4.3 Entering Enhanced ICSP Mode
4.3.1 LOW-VOLTAGE ENTRY
Perform the following steps to enter Enhanced ICSP
Program/Verify mode using MCLR:
1. Briefly drive the MCLR pin high and then low.
2. Clock a 32-bit key sequence into PGDx.
3. Drive the MCLR high within a specified period
and continue to hold high.
Figure 4-3 illustrates this procedure.
The programming voltage applied to MCLR is VIH,
which is essentially VDD in the case of
PIC24FXXKA1XX/FVXXKA3XX devices. There is no
minimum time requirement for holding at VIH. After VIH
is removed, an interval of at least P18 must elapse
before presenting the key sequence on PGDx.
The key sequence is a specific 32-bit pattern: 0100
1101 0100 0011 0100 1000 0101 0000(more eas-
ily remembered as 4D434850h in hexadecimal format).
The device will enter Program/Verify mode only if the key
sequence is valid. The MSB of the most significant nibble
must be shifted in first.
Once the key sequence is complete, VIH must be
applied to MCLR and held at that level for as long as
the Program/Verify mode is to be maintained. An
interval of at least P19 and P7 must elapse before
presenting data on PGDx. Signals appearing on PGDx
before P7 has elapsed will not be interpreted as valid.
4.3.2 HIGH-VOLTAGE ENTRY
The procedure for entering Enhanced ICSP
Program/Verify mode using the VPP pin is the same as
entering the mode using MCLR. The only differences
are that the programming voltage applied to VPP is
VIHH, and before presenting the key sequence on
PGDx, an interval of at least P18 should elapse.
Figure 4-4 illustrates this procedure.
Once the key sequence is complete, VIHH must be
applied to VPP and held at that level for as long as the
Program/Verify mode is to be maintained. An interval of
at least P19 and P7 should elapse before presenting
data on PGDx.
Signals appearing on PGDx before P7 has elapsed will
not be interpreted as valid.
On successful entry, the program memory can be
accessed and programmed in serial fashion. While in
the Program/Verify mode, all unused I/Os are placed in
the high-impedance state.
4.3.3 CODE-PROTECT ICSP ENTRY
When code protection is employed on the
PIC24FXXKA3XX devices (BWRP, GSS0 or
GWRP = 0), then the voltage on VDD must be above
VBULK in order to erase, and then program the device.
Care must be taken in the design and layout of a board
so that any parts connected to VDD can withstand what
may be an increase in voltage if the device is running
below VBULK.
2011 Microchip Technology Inc. Advance Information DS39919B-page 27
PIC24FXXKA1XX/FVXXKA3XX
FIGURE 4-3: ENTERING ENHANCED ICSP MODE USING LOW-VOLTAGE ENTRY
FIGURE 4-4: ENTERING ENHANCED ICSP MODE USING HIGH-VOLTAGE ENTRY
MCLR
PGDx
PGCx
VDD
P6
P14
b31 b30 b29 b28 b27 b2 b1 b0 b3
...
Program/Verify Entry Code = 4D434850h
P1A
P1B
P18
P19
0 1 0 0 1 0 0 0 0
P7
VIH VIH
VPP
PGDx
PGCx
VDD
P6
b31 b30 b29 b28 b27 b2 b1 b0 b3
...
Program/Verify Entry Code = 4D434850h
P1A
P1B
P18
0 1 0 0 1 0 0 0 0
VIHH
P7
PIC24FXXKA1XX/FVXXKA3XX
DS39919B-page 28 Advance Information 2011 Microchip Technology Inc.
4.4 Blank Check
The term Blank Check implies verifying if the device
has been successfully erased and has no programmed
memory locations. A blank or erased memory location
is always read as 1.
The Device ID registers (FF0002h:FF0000h) can be
ignored by the Blank Check as this region stores device
information that cannot be erased. The device
Configuration registers are also ignored by the Blank
Check. Additionally, all unimplemented memory space
should be ignored by the Blank Check.
The QBLANK command is used for the Blank Check. It
determines if the code memory is erased by testing
these memory regions. A BLANK or NOT BLANK
response is returned. If it is determined that the device
is not blank, it must be erased before attempting to
program the device.
4.5 Code Memory Programming
4.5.1 PROGRAMMING METHODOLOGY
Code memory is programmed with the PROGP
command. PROGP programs one row of code memory,
starting from the memory address specified in the
command. The number of PROGP commands required
to program a device depends on the number of write
blocks that must be programmed in the device.
Figure 4-5 illustrates an example flowchart for
programming code memory. In this example, all 5.5K
instruction words of a PIC24FXXKA1XX/FVXXKA3XX
device are programmed.
First, the number of commands to send (titled
RemainingCmds in the flowchart) is set to 176,
and the destination address (called
BaseAddress) is set to 0.
Next, one write block in the device is programmed
with a PROGP command. Each PROGP command
contains data for one row of code memory of the
PIC24FXXKA1XX/FVXXKA3XX device.
After the first command is processed successfully,
RemainingCmds is decremented by 1 and
compared with 0.
Since there are more PROGP commands to be sent,
BaseAddress is incremented by 40h to point to the
next row of memory. On the second PROGP command,
the second row is programmed. This process is
repeated until the entire device is programmed. Special
handling should not be performed when a panel
boundary is crossed.
4.5.2 PROGRAMMING VERIFICATION
After the code memory is programmed, the contents of
the memory can be verified to ensure that the
programming is successful. Verification requires the
code memory to be read back and compared with the
copy held in the programmers buffer.
The READP command can be used to read back all of
the programmed code memory.
Alternatively, the programmer can perform the
verification after the entire device is programmed using
a checksum computation.
FIGURE 4-5: FLOWCHART FOR
PROGRAMMING CODE
MEMORY
Is
PROGP response
PASS?
Are
RemainingCmds
0?
BaseAddress = 00h
RemainingCmds = 176
RemainingCmds =
RemainingCmds 1
BaseAddress =
BaseAddress + 40h
No
No
Yes
Yes
Start
Failure
Report Error
Send PROGP
Command to Program
BaseAddress
End
2011 Microchip Technology Inc. Advance Information DS39919B-page 29
PIC24FXXKA1XX/FVXXKA3XX
4.6 Data EEPROM Programming
4.6.1 PROGRAMMING METHODOLOGY
The programming executive uses the PROGD command
to program the data EEPROM. Figure 4.7 illustrates
this process.
First, the number of words to program
(RemainingWords) is based on the device size
and the destination address (DestAddress) is set
to 0. In this example, 256 words of data EEPROM
will be programmed.
The first PROGD command programs the first word
of data EEPROM.
Once the command completes successfully,
RemainingWords is decremented by 1 and
compared with 0.
Since there are 255 more words to program,
BaseAddress is incremented by 02h to point to
the next word of data EEPROM.
This process is then repeated until all 256 words
of data EEPROM are programmed.
4.6.2 PROGRAMMING VERIFICATION
Once the data EEPROM is programmed, the contents
of the memory can be verified to ensure the
programming was successful. Verification requires the
data EEPROM to be read back and compared with the
copy held in the programmers buffer. The READD
command reads back the programmed data EEPROM.
Alternatively, the programmer can perform the
verification once the entire device is programmed using
a checksum computation, as described in
Section 6.1.1 Checksum Computation.
FIGURE 4-6: FLOWCHART FOR
PROGRAMMING DATA
EEPROM
Is
PROGD response
PASS?
Are
RemainingWords
0?
RemainingWords = 256 (100h)
BaseAddress = 0
RemainingWords =
RemainingWords 1
BaseAddress =
BaseAddress + 02h
No
No
Yes
Yes
Start
Failure
Report Error
Send PROGD
Command to Program
BaseAddress
Finish
PIC24FXXKA1XX/FVXXKA3XX
DS39919B-page 30 Advance Information 2011 Microchip Technology Inc.
4.7 Configuration Bits Programming
The PIC24FXXKA1XX/FVXXKA3XX family has eight
Configuration registers. The bits of these registers can
be set or cleared to select various device configura-
tions. There are three types of Configuration bits:
System Operation Bits
These bits determine the power-on settings for
system-level components, such as the oscillator and
Watchdog Timer.
Code-Protect Bits
These bits prevent program memory from being read
and written.
Device ID Bits
These are read-only bits, which are located from
FF0000 to FF0003, and are unique to every device.
Table 4-2 provides the Configuration registers.
4.7.1 PROGRAMMING METHODOLOGY
Configuration bits may be programmed, a single byte at
a time, using the PROGP command. This command
specifies the configuration data and Configuration
register address. When Configuration bits are
programmed, any unimplemented or reserved bits
must be programmed with a 1.
Eight PROGP commands are required to program the
Configuration bits. Figure 4-7 illustrates the flowchart
for Configuration bit programming.
4.7.2 PROGRAMMING VERIFICATION
After the Configuration bits are programmed, the
contents of memory should be verified to ensure that
the programming was successful. Verification requires
the Configuration bits to be read back and compared
against the copy held in the programmers buffer. The
READP command reads back the programmed
Configuration bits and verifies that the programming
was successful.
FIGURE 4-7: CONFIGURATION BIT PROGRAMMING FLOW
Note: If the General Segment Code-Protect bit
(GCP) is programmed to 0, code mem-
ory is code-protected and cannot be read.
Code memory must be verified before
enabling code protection. See
Section 4.7.3 Code-Protect Configura-
tion Bits for more information on
code-protect Configuration bits.
Send PROGP
Command
ConfigAddress = F80000h
Is
PROGP response
PASS?
No
Yes
No
Failure
Report Error
Start
End
Yes
Is
ConfigAddress
F80010h?
ConfigAddress =
ConfigAddress + 2
2011 Microchip Technology Inc. Advance Information DS39919B-page 31
PIC24FXXKA1XX/FVXXKA3XX
4.7.3 CODE-PROTECT CONFIGURATION
BITS
The FBS and FGS Configuration registers are special
Configuration registers which control the code
protection for the boot segment and general segment,
respectively. For each segment, two forms of code
protection are provided. One form prevents code
memory from being written (write protection), while the
other prevents code memory from being read (read
protection).
The BWRP and GWRP bits control write protection and
the BSS0 and GSS0 bits control read protection.
When write protection is enabled, any programming
operation to code memory will fail. When read
protection is enabled, any read from code memory will
cause a 00h to be read, regardless of the actual
contents of code memory. Since the programming
executive always verifies what it programs, attempting
to program code memory with read protection enabled
also results in failure.
It is imperative that all code protection bits should be 1
while the device is being programmed and verified.
Only after the device is programmed and verified
should any of the above bits be programmed to 0 (see
Section 4.7 Configuration Bits Programming).
Note: All bits in the FBS and FGS Configuration
registers can only be programmed to a
value of 0.Bulk Erasing the chip is the
only way to reprogram code-protect bits
from on (0) to off (1).
TABLE 4-2: PIC24F(V)XXKAXXX FAMILY CONFIGURATION BITS DESCRIPTION
Bit Field Register Description
BOREN<1:0> FPOR<1:0> Brown-out Reset Enable bits
11 = Brown-out Reset enabled in hardware; SBOREN bit disabled
10 = Brown-out Reset enabled only while device is active and disabled in
Sleep; SBOREN bit disabled
01 = Brown-out Reset controlled with the SBOREN bit setting
00 = Brown-out Reset disabled in hardware; SBOREN bit disabled
BORV<1:0> FPOR<6:5> Brown-out Reset Voltage bits
For PIC24FXXKA1XX and PIC24FXXKA3XX devices:
11 = VBOR set to 1.8V min
10 = VBOR set to 2.7V min
01 = VBOR set to 3.0V min
For PIC24FVXXKA3XX devices:
11 = VBOR set to 2.0V min
10 = VBOR set to 2.7V min
01 = VBOR set to 3.0V min
For all devices:
00 = Downside protection on POR enabled Zero-power selected
BSS0 FBS<3> Boot Segment Program Flash Code Protection bit
1 = Standard security enabled
0 = High security enabled
BSZ<1:0> FBS<2:1> Boot Segment Program Flash Size Selection bits
(1)
11 = No boot program Flash segment
10 = Boot program Flash segment starts at 200h, ends at 000AFEh
01 = Boot program Flash segment starts at 200h, ends at 0015FEh
For PIC24FV32KA3XX devices:
00 = Reserved
For all other devices:
00 = Reserved
Note 1: Applies only to 28-pin devices.
2: The MCLRE fuse can only be changed when using the VPP-Based Test mode entry. This prevents a user
from accidentally locking out the device from low-voltage test entry.
PIC24FXXKA1XX/FVXXKA3XX
DS39919B-page 32 Advance Information 2011 Microchip Technology Inc.
BWRP FBS<0> Boot Segment Program Flash Write Protection bit
1 = Boot segment may be written
0 = Boot segment is write-protected
DEBUG FICD<7> Background Debugger Enable bit
1 = Background debugger disabled
0 = Background debugger functions enabled
DSWDTEN FDS<7> Deep Sleep Watchdog Timer Enable bit
1 = DSWDT enabled
0 = DSWDT disabled
DSWCKSEL FDS<4> DSWDT Reference Clock Select bit
1 = DSWDT uses LPRC as reference clock
0 = DSWDT uses SOSC as reference clock
DSWDTPS<3:0> FDS<3:0> Deep Sleep Watchdog Timer Postscale Select bits
The DSWDT prescaler is 32; this creates an approximate base time unit of
1 ms.
1111 = 1:2,147,483,648 (25.7 days)
1110 = 1:536,870,912 (6.4 days)
1101 = 1:134,217,728 (38.5 hours)
1100 = 1:33,554,432 (9.6 hours)
1011 = 1:8,388,608 (2.4 hours)
1010 = 1:2,097,152 (36 minutes)
1001 = 1:524,288 (9 minutes)
1000 = 1:131,072 (135 seconds)
0111 = 1:32,768 (34 seconds)
0110 = 1:8,192 (8.5 seconds)
0101 = 1:2,048 (2.1 seconds)
0100 = 1:512 (528 ms)
0011 = 1:128 (132 ms)
0010 = 1:32 (33 ms)
0001 = 1:8 (8.3 ms)
0000 = 1:2 (2.1 ms)
DSBOREN FDS<6> Deep Sleep Zero-Power BOR Enable bit
1 = Zero-Power BOR enabled in Deep Sleep
0 = Zero-Power BOR disabled in Deep Sleep (does not affect operation in non
Deep Sleep modes)
FCKSM<1:0> FOSC<7:6> Clock Switching and Monitor Selection Configuration bits
1x = Clock switching is disabled, Fail-Safe Clock Monitor is disabled
01 = Clock switching is enabled, Fail-Safe Clock Monitor is disabled
00 = Clock switching is enabled, Fail-Safe Clock Monitor is enabled
FNOSC<2:0> FOSCSEL<2:0> Oscillator Selection bits
000 = Fast RC Oscillator (FRC)
001 = Fast RC Oscillator with divide-by-N with PLL module (FRCDIV+PLL)
010 = Primary Oscillator (XT, HS, EC)
011 = Primary Oscillator with PLL module (HS+PLL, EC+PLL)
100 = Secondary Oscillator (SOSC)
101 = Low-Power RC Oscillator (LPRC)
110 = Reserved; do not use
111 = Fast RC Oscillator with divide-by-N (FRCDIV)
TABLE 4-2: PIC24F(V)XXKAXXX FAMILY CONFIGURATION BITS DESCRIPTION (CONTINUED)
Bit Field Register Description
Note 1: Applies only to 28-pin devices.
2: The MCLRE fuse can only be changed when using the VPP-Based Test mode entry. This prevents a user
from accidentally locking out the device from low-voltage test entry.
2011 Microchip Technology Inc. Advance Information DS39919B-page 33
PIC24FXXKA1XX/FVXXKA3XX
FWDTEN FWDT<7> Watchdog Timer Enable bit (PIC24FXXKA1XX devices only)
1 = WDT enabled
0 = WDT disabled (control is placed on the SWDTEN bit)
FWDTEN<1:0> FWDT<7,5> Watchdog Timer Enable bit (all PIC24FVXXKA3XX devices)
11 = WDT enabled in hardware
10 = WDT controlled with the SWDTEN bit
01 = WDT enabled only while device active and disabled in Sleep; SWDTEN
bit disabled
00 = WDT disabled in hardware; SWDTEN bit disabled
GSS0 FGS<1> General Segment Code Flash Code Protection bit
1 = No protection
0 = Standard security enabled
GWRP FGS<0> General Segment Code Flash Write Protection bit
1 = General segment may be written
0 = General segment is write-protected
ICS<1:0> FICD<1:0> ICD Pin Placement Select bit
11 = ICD EMUC/EMUD pins are shared with PGEC1/PGED1
10 = ICD EMUC/EMUD pins are shared with PGEC2/PGED2
01 = ICD EMUC/EMUD pins are shared with PGEC3/PGED3
00 = Reserved; do not use
IESO FOSCSEL<7> Internal External Switchover bit
1 = Internal External Switchover mode enabled (Two-Speed Start-up enabled)
0 = Internal External Switchover mode disabled (Two-Speed Start-up disabled)
I2C1SEL
(1)
FPOR<4> Alternate I2C1 Pin Mapping bit
(1)
0 = Alternate location for SCL1/SDA1 pins
1 = Default location for SCL1/SDA1 pins
MCLRE
(2)
FPOR<7> MCLR Pin Enable bit
(2)
1 = MCLR pin enabled; RA5 input pin disabled
0 = RA5 input pin enabled; MCLR disabled
OSCIOFNC FOSC<2> CLKO Enable Configuration bit
1 = CLKO output signal active on the OSCO pin; primary oscillator must be
disabled or configured for the External Clock mode (EC) for the CLKO to
be active (POSCMD<1:0> = 11 or 00)
0 = CLKO output disabled
POSCMD<1:0> FOSC<1:0> Primary Oscillator Configuration bits
11 = Primary oscillator disabled
10 = HS Oscillator mode selected (4 MHz-25 MHz)
01 = XT Oscillator mode selected (100 kHz-4 MHz)
00 = External Clock mode selected
POSCFREQ<1:0> FOSC<4:3> Primary Oscillator Frequency Range Configuration bits
11 = Primary oscillator/external clock input frequency greater than 8 MHz
10 = Primary oscillator/external clock input frequency between 100 kHz and
8 MHz
01 = Primary oscillator/external clock input frequency less than 100 kHz
00 = Reserved, do not use
PWRTEN FPOR<3> Power-up Timer Enable bit
0 = PWRT disabled
1 = PWRT enabled
TABLE 4-2: PIC24F(V)XXKAXXX FAMILY CONFIGURATION BITS DESCRIPTION (CONTINUED)
Bit Field Register Description
Note 1: Applies only to 28-pin devices.
2: The MCLRE fuse can only be changed when using the VPP-Based Test mode entry. This prevents a user
from accidentally locking out the device from low-voltage test entry.
PIC24FXXKA1XX/FVXXKA3XX
DS39919B-page 34 Advance Information 2011 Microchip Technology Inc.
4.8 Exiting the Enhanced ICSP Mode
To exit the Program/Verify mode, remove VIH from
MCLR/VPP, as illustrated in Figure 4-8. For exiting, an
interval, P16, should elapse between the last clock and
program signals on PGCx and PGDx before removing
VIH.
FIGURE 4-8: EXITING ENHANCED
ICSP MODE
RTCCKSEL FDS<5> RTCC Reference Clock Select bit (PIC24FXXKA1XX devices only)
1 = RTCC uses SOSC as reference clock
0 = RTCC uses LPRC as reference clock
SOSCSEL FOSC<5> Secondary Oscillator Select bit
1 = Secondary oscillator configured for high-power operation
0 = Secondary oscillator configured for low-power operation
FWPSA FWDT<4> WDT Prescaler
1 = WDT prescaler ratio of 1:128
0 = WDT prescaler ratio of 1:32
WDTPS<3:0> FWDT<3:0> Watchdog Timer Postscale Select bits
1111 = 1:32,768
1110 = 1:16,384
0001 = 1:2
0000 = 1:1
WINDIS FWDT<6> Windowed Watchdog Timer Disable bit
1 = Standard WDT selected; windowed WDT disabled
0 = Windowed WDT enabled
TABLE 4-2: PIC24F(V)XXKAXXX FAMILY CONFIGURATION BITS DESCRIPTION (CONTINUED)
Bit Field Register Description
Note 1: Applies only to 28-pin devices.
2: The MCLRE fuse can only be changed when using the VPP-Based Test mode entry. This prevents a user
from accidentally locking out the device from low-voltage test entry.
MCLR/VPP
P16
PGDx
PGDx = Input
PGCx
VDD
VIH/VIHH
VIH
P17
2011 Microchip Technology Inc. Advance Information DS39919B-page 35
PIC24FXXKA1XX/FVXXKA3XX
5.0 THE PROGRAMMING
EXECUTIVE
This section describes the programming executive
communication, programming executive commands,
programming responses, programming the
programming executive to memory and programming
verification.
5.1 Programming Executive
Communication
The programmer and the programming executive have
a master-slave relationship, where the programmer is
the master programming device and the programming
executive is the slave.
Communication is initiated by the programmer in the
form of a command. Only one command at a time can be
sent to the programming executive. The programming
executive, in turn, only sends one response to the
programmer after receiving and processing a command.
The programming executive command set is described
in Section 5.2 Programming Executive
Commands. The response set is described in
Section 5.3 Programming Executive Responses.
5.1.1 COMMUNICATION INTERFACE
AND PROTOCOL
The Enhanced ICSP interface is a two-wire SPI,
implemented using the PGCx and PGDx pins. The
PGCx pin is used as a clock input pin; the programmer
should provide the clock source. The PGDx pin is used
to send the command data to, and receive response
data from, the programming executive.
Data transmits to the device should change on the
rising edge and hold on the falling edge of PGCx.
Data receives from the device change on the falling
edge and holds on the rising edge of PGCx.
The data transmissions are sent to the MSB first using
16-bit mode (see Figure 5-1 and Figure 5-2).
FIGURE 5-1: PROGRAMMING
EXECUTIVE SERIAL
TIMING FOR DATA
RECEIVED FROM DEVICE
As a 2-wire SPI is used and data transmissions are
half-duplex, a simple protocol is used to control the
direction of PGDx. When the programmer completes a
command transmission, it releases the PGDx line and
allows the programming executive to drive this line
high. The programming executive keeps the PGDx line
high to indicate that it is processing the command.
After the programming executive has processed the
command, it brings PGDx low for 15 sec to indicate to
the programmer that the response is available to be
clocked out. The programmer can begin to clock out
the response, 23 sec after PGDx is brought low, and
it must provide the necessary amount of clock pulses to
receive the entire response from the programming
executive.
After the entire response is clocked out, the
programmer should terminate the clock on PGCx until
it is time to send another command to the programming
executive; Figure 5.2 displays this protocol.
5.1.2 SPI RATE
In Enhanced ICSP mode, the
PIC24FXXKA1XX/FVXXKA3XX family devices oper-
ate from the internal Fast RC Oscillator, which has a
nominal frequency of 8 MHz. This oscillator frequency
yields an effective system clock frequency of 4 MHz. To
ensure that the programmer does not clock too fast, it
is recommended that a 4 MHz clock be provided by the
programmer.
FIGURE 5-2: PROGRAMMING
EXECUTIVE SERIAL
TIMING FOR DATA
TRANSMITTED TO DEVICE
PGCx
PGDx
1 2 3 11 13 15 16 14 12
LSb 14 13 12 11
4 5 6
MSb 1 2 3
...
4 5
P2
P3
P1
P1B
P1A
PGCx
PGDx
1 2 3 11 13 15 16 14 12
LSb 14 13 12 11
4 5 6
MSb 1 2 3
...
4 5
P2
P3
P1
P1B
P1A
PIC24FXXKA1XX/FVXXKA3XX
DS39919B-page 36 Advance Information 2011 Microchip Technology Inc.
5.1.3 TIME-OUTS
The programming executive does not use the Watch-
dog Timer or time-out for transmitting responses to the
programmer. If the programmer does not follow the flow
control mechanism using PGCx, as described in
Section 5.1.1 Communication Interface and Proto-
col, it is possible that the programming executive will
behave unexpectedly while trying to send a response
to the programmer. Since the programming executive
does not have a time-out, it is imperative that the pro-
grammer correctly follow the described communication
protocol.
As a safety measure, the programmer should use the
command time-outs identified and listed in Table 5-1. If
the command time-out expires, the programmer should
reset the programming executive and start
programming the device again.
FIGURE 5-3: PROGRAMMING EXECUTIVE PROGRAMMER COMMUNICATION PROTOCOL
5.2 Programming Executive
Commands
The programming executive command set is listed in
Table 5-1. This table contains the opcode, mnemonic,
length, time-out and description for each command.
Section 5.2.4 Command Descriptions provides
functional details on each command.
5.2.1 COMMAND FORMAT
The programming executive commands have a
general format consisting of a 16-bit header and any
required data for the command (see Figure 5-4). The
16-bit header consists of a 4-bit opcode field, which is
used to identify the command, followed by a 12-bit
command length field.
FIGURE 5-4: COMMAND FORMAT
The command opcode must match one of those in the
command set. Any command that is received that does
not match the list in Table 5-1 returns a NACK
response (see Section 5.3.1.1 Opcode Field).
The command length is represented in 16-bit words as
the SPI operates in 16-bit mode. The programming
executive uses the command length field to determine
the number of words to read from the SPI port. If the
value of this field is incorrect, the command will not be
properly received by the programming executive.
1 2 15 16 1 2 15 16
PGCx
PGDx
PGCx = Input PGCx = Input (Idle)
Host Transmits
Last Command Word
PGDx = Input PGDx = Output
P8
1 2 15 16
MSB X X X LSB MSB X X X LSB MSB X X X LSB 1 0
P20
PGCx = Input
PGDx = Output
P9
Programming Executive
Processes Command
Host Clocks Out Response
P21
15 12 11 0
Opcode Length
Command Data First Word (if required)
DSCs, KEELOQ
code hopping
devices, Serial EEPROMs, microperipherals, nonvolatile memory and
analog products. In addition, Microchips quality system for the design
and manufacture of development systems is ISO 9001:2000 certified.
DS39919B-page 54 Advance Information 2011 Microchip Technology Inc.
AMERICAS
Corporate Office
2355 West Chandler Blvd.
Chandler, AZ 85224-6199
Tel: 480-792-7200
Fax: 480-792-7277
Technical Support:
http://www.microchip.com/
support
Web Address:
www.microchip.com
Atlanta
Duluth, GA
Tel: 678-957-9614
Fax: 678-957-1455
Boston
Westborough, MA
Tel: 774-760-0087
Fax: 774-760-0088
Chicago
Itasca, IL
Tel: 630-285-0071
Fax: 630-285-0075
Cleveland
Independence, OH
Tel: 216-447-0464
Fax: 216-447-0643
Dallas
Addison, TX
Tel: 972-818-7423
Fax: 972-818-2924
Detroit
Farmington Hills, MI
Tel: 248-538-2250
Fax: 248-538-2260
Indianapolis
Noblesville, IN
Tel: 317-773-8323
Fax: 317-773-5453
Los Angeles
Mission Viejo, CA
Tel: 949-462-9523
Fax: 949-462-9608
Santa Clara
Santa Clara, CA
Tel: 408-961-6444
Fax: 408-961-6445
Toronto
Mississauga, Ontario,
Canada
Tel: 905-673-0699
Fax: 905-673-6509
ASIA/PACIFIC
Asia Pacific Office
Suites 3707-14, 37th Floor
Tower 6, The Gateway
Harbour City, Kowloon
Hong Kong
Tel: 852-2401-1200
Fax: 852-2401-3431
Australia - Sydney
Tel: 61-2-9868-6733
Fax: 61-2-9868-6755
China - Beijing
Tel: 86-10-8528-2100
Fax: 86-10-8528-2104
China - Chengdu
Tel: 86-28-8665-5511
Fax: 86-28-8665-7889
China - Chongqing
Tel: 86-23-8980-9588
Fax: 86-23-8980-9500
China - Hong Kong SAR
Tel: 852-2401-1200
Fax: 852-2401-3431
China - Nanjing
Tel: 86-25-8473-2460
Fax: 86-25-8473-2470
China - Qingdao
Tel: 86-532-8502-7355
Fax: 86-532-8502-7205
China - Shanghai
Tel: 86-21-5407-5533
Fax: 86-21-5407-5066
China - Shenyang
Tel: 86-24-2334-2829
Fax: 86-24-2334-2393
China - Shenzhen
Tel: 86-755-8203-2660
Fax: 86-755-8203-1760
China - Wuhan
Tel: 86-27-5980-5300
Fax: 86-27-5980-5118
China - Xian
Tel: 86-29-8833-7252
Fax: 86-29-8833-7256
China - Xiamen
Tel: 86-592-2388138
Fax: 86-592-2388130
China - Zhuhai
Tel: 86-756-3210040
Fax: 86-756-3210049
ASIA/PACIFIC
India - Bangalore
Tel: 91-80-3090-4444
Fax: 91-80-3090-4123
India - New Delhi
Tel: 91-11-4160-8631
Fax: 91-11-4160-8632
India - Pune
Tel: 91-20-2566-1512
Fax: 91-20-2566-1513
Japan - Yokohama
Tel: 81-45-471- 6166
Fax: 81-45-471-6122
Korea - Daegu
Tel: 82-53-744-4301
Fax: 82-53-744-4302
Korea - Seoul
Tel: 82-2-554-7200
Fax: 82-2-558-5932 or
82-2-558-5934
Malaysia - Kuala Lumpur
Tel: 60-3-6201-9857
Fax: 60-3-6201-9859
Malaysia - Penang
Tel: 60-4-227-8870
Fax: 60-4-227-4068
Philippines - Manila
Tel: 63-2-634-9065
Fax: 63-2-634-9069
Singapore
Tel: 65-6334-8870
Fax: 65-6334-8850
Taiwan - Hsin Chu
Tel: 886-3-6578-300
Fax: 886-3-6578-370
Taiwan - Kaohsiung
Tel: 886-7-213-7830
Fax: 886-7-330-9305
Taiwan - Taipei
Tel: 886-2-2500-6610
Fax: 886-2-2508-0102
Thailand - Bangkok
Tel: 66-2-694-1351
Fax: 66-2-694-1350
EUROPE
Austria - Wels
Tel: 43-7242-2244-39
Fax: 43-7242-2244-393
Denmark - Copenhagen
Tel: 45-4450-2828
Fax: 45-4485-2829
France - Paris
Tel: 33-1-69-53-63-20
Fax: 33-1-69-30-90-79
Germany - Munich
Tel: 49-89-627-144-0
Fax: 49-89-627-144-44
Italy - Milan
Tel: 39-0331-742611
Fax: 39-0331-466781
Netherlands - Drunen
Tel: 31-416-690399
Fax: 31-416-690340
Spain - Madrid
Tel: 34-91-708-08-90
Fax: 34-91-708-08-91
UK - Wokingham
Tel: 44-118-921-5869
Fax: 44-118-921-5820
Worldwide Sales and Service
02/18/11