64
2018 Microchip Technology Inc. DS70005352C-page 1 dsPIC33CK64MP105 FAMILY 1.0 DEVICE OVERVIEW This document defines the programming specification for the dsPIC33CK64MP105 16-bit, Digital Signal Controller (DSC) family. This programming specifica- tion is required only for those developing programming support for the following devices: Customers using only one of these devices should use development tools that already provide support for device programming. Topics covered include: Section 1.0 “Device Overview” Section 2.0 “Programming Overview” Section 3.0 “Device Programming – ICSP” Section 4.0 “Device Programming – Enhanced ICSP” Section 5.0 “The Programming Executive” Section 6.0 “Device ID/Unique ID” Section 7.0 “Checksum Computation” Section 8.0 “AC/DC Characteristics and Timing Requirements” 2.0 PROGRAMMING OVERVIEW The following are the two methods of programming that are discussed in this programming specification: In-Circuit Serial Programming™ (ICSP™) Enhanced In-Circuit Serial Programming The ICSP programming method is the most direct method to program the device; however, it is also the slower of the two methods. It provides native, low-level programming capability to erase, program and verify the device. The Enhanced ICSP protocol uses a faster method that takes advantage of the Programming Executive (PE), as illustrated in Figure 2-1. The PE provides all the neces- sary functionality to erase, program and verify the chip through a small command set. The command set allows the programmer to program a dsPIC33CK64MP105 device without dealing with the low-level programming protocols. FIGURE 2-1: PROGRAMMING SYSTEM OVERVIEW FOR ENHANCED ICSP™ This programming specification is divided into two major sections that describe the programming methods independently. Section 3.0 “Device Programming – ICSP” describes the ICSP method. Section 4.0 “Device Programming – Enhanced ICSP” describes the Enhanced ICSP method. • dsPIC33CK32MP102 • dsPIC33CK64MP102 • dsPIC33CK32MP103 • dsPIC33CK64MP103 • dsPIC33CK32MP105 • dsPIC33CK64MP105 dsPIC33CK64MP105 Programmer Programming Executive On-Chip Memory dsPIC33CK64MP105 Family Flash Programming Specification

dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILYdsPIC33CK64MP105 Family

Flash Programming Specification

1.0 DEVICE OVERVIEWThis document defines the programming specificationfor the dsPIC33CK64MP105 16-bit, Digital SignalController (DSC) family. This programming specifica-tion is required only for those developing programmingsupport for the following devices:

Customers using only one of these devices should usedevelopment tools that already provide support fordevice programming.

Topics covered include:

• Section 1.0 “Device Overview”• Section 2.0 “Programming Overview”• Section 3.0 “Device Programming – ICSP”• Section 4.0 “Device Programming – Enhanced

ICSP”• Section 5.0 “The Programming Executive”• Section 6.0 “Device ID/Unique ID”• Section 7.0 “Checksum Computation”• Section 8.0 “AC/DC Characteristics and

Timing Requirements”

2.0 PROGRAMMING OVERVIEWThe following are the two methods of programming thatare discussed in this programming specification:

• In-Circuit Serial Programming™ (ICSP™)• Enhanced In-Circuit Serial Programming

The ICSP programming method is the most directmethod to program the device; however, it is also theslower of the two methods. It provides native, low-levelprogramming capability to erase, program and verifythe device.

The Enhanced ICSP protocol uses a faster method thattakes advantage of the Programming Executive (PE), asillustrated in Figure 2-1. The PE provides all the neces-sary functionality to erase, program and verify the chipthrough a small command set. The command set allowsthe programmer to program a dsPIC33CK64MP105device without dealing with the low-level programmingprotocols.

FIGURE 2-1: PROGRAMMING SYSTEM OVERVIEW FOR ENHANCED ICSP™

This programming specification is divided into twomajor sections that describe the programming methodsindependently. Section 3.0 “Device Programming –ICSP” describes the ICSP method. Section 4.0“Device Programming – Enhanced ICSP” describesthe Enhanced ICSP method.

• dsPIC33CK32MP102 • dsPIC33CK64MP102• dsPIC33CK32MP103 • dsPIC33CK64MP103• dsPIC33CK32MP105 • dsPIC33CK64MP105

dsPIC33CK64MP105

Programmer ProgrammingExecutive

On-Chip Memory

2018 Microchip Technology Inc. DS70005352C-page 1

Page 2: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

2.1 Required ConnectionsThese devices require specific connections forprogramming to take place. These connections includepower, MCLR and one programming pair (PGEDx/PGECx). Table 2-1 describes these connections (referto the specific device data sheet for pin descriptionsand power connection requirements).

2.2 Power RequirementsAll devices in the dsPIC33CK64MP105 family powertheir core digital logic at a nominal 1.2V and incorpo-rate a capacitor-free, on-chip regulator that allows thedevice to run its core logic from VDD. The regulatorprovides power to the core from the other VDD pins anddoes not require an external CPU Logic Filter Capacitor(VCAP) connection. The specifications for core voltageand capacitance are listed in Section 8.0 “AC/DCCharacteristics and Timing Requirements”.

FIGURE 2-2: CONNECTIONS FOR THE ON-CHIP REGULATOR

TABLE 2-1: PINS USED DURING PROGRAMMING

VDD

VSS

dsPIC33CKXXMP10X3.3V

AVDD

AVSS

Pin Name Pin Type Pin Description

MCLR I Programming EnableVDD and AVDD(1) P Power Supply(1)

VSS and AVSS(1) P Ground(1)

PGECx I Programming Pin Pair: Serial Clock PGEDx I/O Programming Pin Pair: Serial Data Legend: I = Input O = Output P = PowerNote 1: All power supply and ground pins must be connected, including AVDD and AVSS.

DS70005352C-page 2 2018 Microchip Technology Inc.

Page 3: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

2.3 Pin DiagramsFigure 2-3 through Figure 2-5 provide the pin diagramsfor the dsPIC33CK64MP105 family. The pins that arerequired for programming are listed in Table 2-1 and areindicated in bold text in the figures. Refer to the specificdevice data sheet for complete pin descriptions.

2.3.1 PGECx AND PGEDx PIN PAIRSAll devices in the dsPIC33CK64MP105 family havethree separate pairs of programming pins, labeled asPGEC1/PGED1, PGEC2/PGED2 and PGEC3/PGED3.Any one of these pin pairs may be used for device pro-gramming by either ICSP or Enhanced ICSP. Unlikevoltage supply and ground pins, it is not necessary toconnect all three pin pairs to program the device.However, the programming method must use both pinsof the same pair.

FIGURE 2-3: PIN DIAGRAMS

RA0MCLRRB15

RA4 RB14AVDD RB13AVSS RB12

VDD RB11RB10

RB0 VDD

RB1 VSS

RB2

VSS

RA2RA3

28-Pin SSOP

28 27 26 25 24 23 22

8 9 10 11 12 13 14

3

18

17

16

15

4

5

7

1

2 20

19

6

21

RB0

AVD

D

RA4

PGED1/RB8

RB7

PGEC3/RB6

PGED3/RB5

PGED2/RB3

PGEC

1/R

B9

V SS

VDD

RB1

0

RB15

RA0

RA1

RB1

3

RB1

RB1

1

VSS

VDD

AVss

MCLR

RB14

28-Pin UQFN

1234567891011121314

dsPI

C33

CK

XXM

P102

2827262524232221201918171615

RA1

PGED2/RB3PGEC2/RB4PGED3/RB5

PGEC1/RB9PGED1/RB8RB7PGEC3/RB6

RA2

RA3

PGEC2/RB4

RB2

Legend: Bold indicates pins used in device programming.

RB1

2

dsPIC33CKXXMP102

2018 Microchip Technology Inc. DS70005352C-page 3

Page 4: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

FIGURE 2-4: PIN DIAGRAMS (CONTINUED)

36-Pin UQFN

36 35 34 33 32 31 30

10 11 12 13 14 15 16

3

22

21

20

19

4

5

7

1

2

24

23

6

25

8

917 18

26

272829

dsPIC33CKXXMP103

RB14

RB15

MCLR

RC0

RA0

RA1

RA2

RA3

RA4

AVD

D

AVSS

RC

1

RC

2V D

D

VSS

RC

3

RB

0

RB2

PGED2/RB3

PGEC3/RB4

VSS

VDD

PGED3/RB5

PGEC3/RB6

RB7

PGED1/RB8

PGEC

1/R

B9

RC

4

RC

5

V SS

VDD

RB

10

RB

11R

B12

RB

13

RB

1

Legend: Bold indicates pins used in device programming.

DS70005352C-page 4 2018 Microchip Technology Inc.

Page 5: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

FIGURE 2-5: PIN DIAGRAMS (CONTINUED)

48-Pin TQFP, UQFN

46 45 44 43 42 41 40 39 38

13 14 15 16 17 18 19 20 21 22

3

32

31

30

29

28

27

26

25

4

5

7

8

9

10

11

1

2

34

33

6

23

35

3747

1224

36

48

MCLR

dsPIC33CKXXMP105

RB14RB15RC12RC13

RD13RC0RA0RA1RA2RA3RA4

AVD

D

AVSS

RC

1R

C2

RC

6VD

D

VSS

RC

3R

B0

RB

1R

D10

RC

7

RB2PGED2/RB3PGEC2/RB4RC8RC9RD8VSS

VDD

PGED3/RB5PGEC3/RB6RB7PGED1/RB8

PGEC

1/R

B9

RC

4R

C5

RC

10R

C11

V SS

VDD

RD

1R

B10

RB

11R

B12

RB

13

Legend: Bold indicates pins used in device programming.

2018 Microchip Technology Inc. DS70005352C-page 5

Page 6: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

2.4 Program Memory Write/Erase Requirements

The program Flash memory has a specific write/eraserequirement that must be adhered to for proper deviceoperation. The rule is that any given word in memorymust not be written without first erasing the page in whichit is located. Thus, the easiest way to conform to this ruleis to write all the data in a programming block within onewrite cycle. The programming methods specified in thisdocument comply with this requirement.

2.5 Memory MapThe program memory map extends from 0x000000 to0xFFFFFE. User program code storage is located atthe base of the memory map. The last row (128 instruc-tion words) of the last page of implemented programmemory is reserved for the device Configuration bits.Caution should be used when placing code in the lastpage of user memory. When programming the deviceconfiguration, the whole last page must first be erased,including any code located in the last page.

Table 2-3 lists the user memory address limit and avail-able number of instruction words (including the deviceconfiguration area), the number of write blocks and thenumber of erase blocks present in each device variant.

Locations, 0x800000 through 0x800BFE, are reservedfor executive code memory. This region stores the PEand the debugging executive, which is used for deviceprogramming. This region of memory cannot be used tostore user code. See Section 5.0 “The ProgrammingExecutive” for more information.

Locations, 0xFF0000 and 0xFF0002, are reserved forthe Device ID Word registers. These bits can be usedby the programmer to identify which device type isbeing programmed. They are described in Section 6.0“Device ID/Unique ID”. The Device ID registers readout normally, even after code protection is applied.

The locations, 0x801700 to 0x8017FE, are a One-Time-Programmable (OTP) memory area. The user OTPWords can be used for storing product information, suchas serial numbers, system manufacturing dates, manu-facturing lot numbers and other application-specificinformation. They are described in Section 2.7 “UserOne-Time-Programmable (OTP) Memory”.

Figure 2-6 through Figure 2-8 show generic memorymaps for the devices listed in Table 2-3. See the“Memory Organization” chapter in the specific devicedata sheet for exact memory addresses.

Note: A program memory word can beprogrammed twice before an erase, butonly if (a) the same data is used in bothprogram operations or (b) bits containing‘1’ are set to ‘0’, but no ‘0’ is set to ‘1’.

TABLE 2-2: DEVICE ROW AND PAGE SIZEInstruction Words (24 bits)

Row 128Page 1024

TABLE 2-3: FLASH CODE MEMORY SIZE

Device Family User Memory Limit (Instruction Words)

Write Blocks/ No. of Rows

Erase Blocks/No. of Pages

dsPIC33CK64MP10X 0x00AFFE (22528) 176 22dsPIC33CK32MP10X 0x005FFE (12288) 96 12

DS70005352C-page 6 2018 Microchip Technology Inc.

Page 7: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

FIGURE 2-6: PROGRAM MEMORY MAP FOR dsPIC33CKXXMP10X DEVICES(1)

0x000000

Code Memory

0x800000

DEVID

0xFEFFFE0xFF0000

0xFFFFFE

Unimplemented(Read ‘0’s)

Reserved

0x7FFFFE

Con

figur

atio

n M

emor

y Sp

ace

Use

r Mem

ory

Spac

e

Device Configuration

0x00XX000x00XXFE

Reserved0xFF0002

Note 1: Memory areas are not shown to scale.2: Calibration data area must be maintained during programming.3: Calibration data area includes UDID register location.

0xFF0004

Executive Code Memory

0x8018000x8017FE

OTP Memory

0xF9FFFE0xFA00000xFA00020xFA0004

Write Latches

Reserved

0x801700

0x800FFE0x801000

0x8016FE

0x00XXFE0x00XX00 See Figure 2-7 through

Figure 2-8 for details.

CalibrationData(2,3)

2018 Microchip Technology Inc. DS70005352C-page 7

Page 8: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

FIGURE 2-7: PROGRAM MEMORY MAP FOR dsPIC33CK64MP10X DEVICES(1)

FIGURE 2-8: PROGRAM MEMORY MAP FOR dsPIC33CK32MP10X DEVICES(1)

0x000000

User

0x00AF000x00AEFE

Program

Unimplemented(Read ‘0’s)

Device Configuration

0x00B0000x00AFFE

0x7FFFFE

Note 1: Memory areas are not shown to scale.

Memory

0x000000

User

0x005F000x005EFE

Program

Unimplemented(Read ‘0’s)

Device Configuration

0x0060000x005FFE

0x7FFFFE

Note 1: Memory areas are not shown to scale.

Memory

DS70005352C-page 8 2018 Microchip Technology Inc.

Page 9: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

2.6 Configuration Bits2.6.1 OVERVIEWThe Configuration bits are stored in the last row of thelast page location of implemented program memory.These bits can be set or cleared to select various deviceconfigurations. There are two types of Configuration bits:system operation bits and code-protect bits. The systemoperation bits determine the power-on settings forsystem-level components, such as the oscillator and theWatchdog Timer. The code-protect bits prevent programmemory from being read and written.

Table 2-4 list the Configuration register address foreach device memory size and partition configuration.Table 2-5 shows the Configuration register map. Referto the “Special Features” chapter in the specificdevice data sheet for the full Configuration Wordregister descriptions for your device.

Special attention should be taken for the reservedConfiguration bits. The FSIGN<15>, FDEVOPT<8>and FDEVOPT<9> Configuration bits must always beprogrammed (‘0’). The FPOR<5:4>, FICD<7> andFDEVOPT<7> Configuration bits must always stayunprogrammed (‘1’).

TABLE 2-4: dsPIC33CKXXMP10X CONFIGURATION ADDRESSES

Register Name 64k 32k

FSEC 0x00AF00 0x005F00FBSLIM 0x00AF10 0x005F10FSIGN 0x00AF14 0x005F14FOSCSEL 0x00AF18 0x005F18FOSC 0x00AF1C 0x005F1CFWDT 0x00AF20 0x005F20FPOR 0x00AF24 0x005F24FICD 0x00AF28 0x005F28FDMTIVTL 0x00AF2C 0x005F2CFDMTIVTH 0x00AF30 0x005F30FDMTCNTL 0x00AF34 0x005F34FDMTCNTH 0x00AF38 0x005F38FDMT 0x00AF3C 0x005F3CFDEVOPT 0x00AF40 0x005F40FALTREG 0x00AF44 0x005F44

2018 Microchip Technology Inc. DS70005352C-page 9

Page 10: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

TAB

LE 2

-5:

CO

NFI

GU

RA

TIO

N R

EGIS

TER

S M

AP

Regi

ster

Na

me

Bits

23-

16Bi

t 15

Bit 1

4Bi

t 13

Bit 1

2Bi

t 11

Bit 1

0Bi

t 9Bi

t 8Bi

t 7Bi

t 6Bi

t 5Bi

t 4Bi

t 3Bi

t 2Bi

t 1Bi

t 0

FSEC

—AI

VTD

IS—

——

CSS

<2:0

>C

WR

PG

SS<1

:0>

GW

RP

—BS

ENBS

S<1:

0>BW

RP

FBSL

IM—

——

—BS

LIM

<12:

0>

FSIG

N—

r(2)

——

——

——

——

——

——

——

FOSC

SEL

——

——

——

——

—IE

SO—

——

—FN

OSC

<2:0

>

FOSC

——

——

XTBS

TXT

ALC

FG<1

:0>

—PL

LKEN

FCKS

M<1

:0>

——

—O

SCIO

FCN

POSC

MD

<1:0

>

FWD

T—

FWD

TEN

SMW

DT<

4:0>

WD

TWIN

<1:0

>W

IND

ISW

DTC

LKS<

1:0>

RM

WD

T<4:

0>

FPO

R—

——

——

—r(1

)—

——

BIST

DIS

r(1)

r(1)

——

——

FIC

D—

NO

BTSW

P—

——

——

——

r(1)

—JT

AGEN

——

—IC

S<1:

0>

FDM

TIVT

_L—

DM

TIVT

<15:

0>

FDM

TIVT

_H—

DM

TIVT

<31:

16>

FDM

TCN

T_L

—D

MTC

NT<

15:0

>

FDM

TCN

T_H

—D

MTC

NT<

31:1

6>

FDM

T—

——

——

——

——

——

——

——

—D

MTD

IS

FDEV

OPT

——

—SP

I2PI

N—

—SM

B3EN

r(2)

r(2)

r(1)

—AL

TI2C

<3:1

>r(1

)—

FALT

REG

——

CTX

T4<2

:0>

—C

TXT3

<2:0

>—

CTX

T2<2

:0>

—C

TXT1

<2:0

>

Lege

nd:

— =

uni

mpl

emen

ted

bit,

read

as

‘1’;

r = re

serv

ed b

it.No

te1:

Bit r

eser

ved,

mai

ntai

n as

‘1’.

2:Bi

t res

erve

d, m

aint

ain

as ‘0

’.

DS70005352C-page 10 2018 Microchip Technology Inc.

Page 11: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

2.6.2 CODE-PROTECT CONFIGURATION BITS

The device implements intermediate security featuresdefined by the FSEC register. The Boot Segment (BS)is the highest privileged segment and the General Seg-ment (GS) is the lowest privileged segment. The totaluser code memory can be split into BS or GS. The sizeof the segments is determined by the BSLIM<12:0> bits.The relative location of the segments within user spacedoes not change, such that BS (if present) occupies thememory area just after the Vector Space (VS), InterruptVector Table (IVT), and the GS occupies the space justafter BS (or if the Alternate Interrupt Vector Table (AIVT)is enabled, just after AIVT VS). The ConfigurationSegment (CS) is a small segment (less than a page,typically just one row) within user Flash address spacethat contains all user configuration data that is loaded bythe NVM controller during the Reset sequence.

2.7 User One-Time-Programmable (OTP) Memory

dsPIC33CK64MP105 family devices provide 128 words(64 pairs) of One-Time-Programmable (OTP) memory,located at addresses, 0x801700 through 0x8017FE.This memory can be used for persistent storage ofapplication-specific information that will not be erasedby reprogramming the device. This includes manytypes of information, such as:

• Application checksums• Code revision information• Product information• Serial numbers• System manufacturing dates• Manufacturing lot numbers

Customer OTP memory may be programmed in anymode, including user RTSP mode, but it cannot beerased. Data is not cleared by a Chip Erase. SeeSection 3.9 “Writing OTP Words” for moreinformation regarding OTP programming.

2.8 ICSP Write InhibitICSP Write Inhibit is an access restriction feature thatrestricts all of Flash memory when activated. Once acti-vated, ICSP Write Inhibit permanently prevents ICSPFlash programming and erase operations, and cannotbe deactivated. This feature is intended to preventalteration of Flash memory contents with behaviorsimilar to One-Time-Programmable (OTP) devices.

RTSP, including erase and programming operations, isnot restricted when ICSP Write Inhibit is activated;however, code to perform these actions must be pro-grammed into the device before ICSP Write Inhibit isactivated. This allows for a bootloader-type applicationto alter Flash contents when ICSP Write Inhibit isactivated.

Entry into ICSP and Enhanced ICSP modes is notaffected by ICSP Write Inhibit. In these modes, it willcontinue to be possible to read configuration memoryspace and any user memory space regions, which arenot code-protected. With ICSP Write Inhibit, an attemptto set WR (NVMCON<15>) = 1 will maintain WR = 0,and instead, set WRERR (NVMCON<13>) = 1. AllEnhanced ICSP erase and programming commandswill have no effect, with self-checked programmingcommands returning a FAIL response opcode (or aPASS if the destination already exactly matched therequested programming data).

Once ICSP Write Inhibit is activated, it is not possible fora device executing in Debug mode to erase/write Flash,nor can a debug tool switch the device to Productionmode. ICSP Write Inhibit should therefore only beactivated on devices programmed for production.

The JTAG port, when enabled, can be used to mapICSP signals to JTAG I/O pins. All Flash erase/programming operations, initiated via the JTAG port,will therefore also be blocked after activating ICSPWrite Inhibit

2.8.1 ACTIVATING ICSP WRITE INHIBIT

ICSP Write Inhibit is activated by executing a pair ofNVMCON Double-Word Programming commands tosave two 16-bit activation values in the configurationmemory space. The target NVM addresses and valuesrequired for activation are shown in Table 2-6.

Once both addresses contain their activation values,ICSP Write Inhibit will take permanent effect on thenext device Reset. Neither address can be reset,erased or otherwise modified, through any means, afterbeing successfully programmed, even if one of theaddresses has not been programmed.

Only the lower 16 data bits stored at the activationaddresses are evaluated; the upper eight bits and second24-bit word, written by the Double-Word ProgrammingNVMOPx bits, should be ‘0’s. The addresses can beprogrammed in any order and during separate ICSP/Enhanced ICSP/RTSP sessions, but any attempt toprogram an incorrect 16-bit value, or use a RowProgramming operation to program the values, will beaborted without altering the existing data.

Note: It is not possible to deactivate ICSPWrite Inhibit.

TABLE 2-6: ICSP WRITE INHIBIT FUSE ADDRESSES AND CODES

ICSP Write Inhibit Fuse Address Code Value

0x801030 0x006D630x801034 0x006870

2018 Microchip Technology Inc. DS70005352C-page 11

Page 12: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.0 DEVICE PROGRAMMING – ICSPICSP mode is a special programming protocol thatallows you to read and write to the device memory ofthe dsPIC33CK64MP105 devices. The ICSP mode isthe most direct method used to program the device,which is accomplished by applying control codes andinstructions, serially to the device, using the PGECxand PGEDx pins. ICSP mode also has the ability toread the contents of the executive memory to deter-mine if the Programming Executive is present, and towrite the Programming Executive to executive memoryif it is missing, and then, Enhanced ICSP mode will beused.

In ICSP mode, the system clock is taken from thePGECx pin, regardless of the device’s OscillatorConfiguration bits. All instructions are shifted seriallyinto an internal buffer, then loaded into the InstructionRegister (IR) and executed. No program fetchingoccurs from internal memory. Instructions are fed in24 bits at a time. PGEDx is used to shift data in, andPGECx is used as both the serial shift clock and theCPU execution clock.

3.1 Overview of the Programming Process

Figure 3-1 shows a high-level overview of the ICSPprogramming process. After entering ICSP mode, thefirst action is to Bulk Erase the code memory. Next, thecode memory is programmed, followed by the deviceConfiguration bits. Code memory (including the Config-uration bits) is then verified to ensure that programmingwas successful. Then, programming the code-protectConfiguration bits can be done if required.

FIGURE 3-1: HIGH-LEVEL ICSP™ PROGRAMMING FLOW

Note 1: During ICSP operation, the operatingfrequency of PGECx must not exceed5 MHz.

2: ICSP mode is slower than EnhancedICSP mode for programming.

Start

Perform BulkErase of Code Memory

Program Code Memory,

Verify Code Memory,

End

Enter ICSP™

Program Code-Protect

Exit ICSP

Configuration Wordsand OTP Words

Configuration Wordsand OTP Words

Configuration Bits

DS70005352C-page 12 2018 Microchip Technology Inc.

Page 13: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.2 Entering ICSP ModeAs shown in Figure 3-2, entering ICSP Program/Verifymode requires three steps:

1. MCLR is briefly driven high, then low (P21).2. A 32-bit key sequence is clocked into PGEDx.

An interval of at least P18 must elapse beforepresenting the key sequence on PGEDx.

3. MCLR is held low during a specified period, P19,and then driven high.

4. After a P7 + 5 * P1 delay, five clock pulses mustbe generated on the PGECx pin.

The key sequence is a specific 32-bit pattern,‘0100 1101 0100 0011 0100 1000 0101 0001’(more easily remembered as 0x4D434851 inhexadecimal). The device will enter ICSP mode only ifthe sequence is valid. The Most Significant bit (MSb) ofthe most significant nibble must be shifted in first.

On successful entry, the program memory can beaccessed and programmed in serial fashion.

FIGURE 3-2: ENTERING ICSP™ MODE

3.3 ICSP OperationUpon entry into ICSP mode, the CPU is Idle. Executionof the CPU is governed by an internal state machine. A4-bit control code must be clocked in using PGECx andPGEDx, and this control code is used to command theCPU (see Table 3-1).

The SIX control code is used to send instructions to theCPU for execution and the REGOUT control code isused to read data out of the device through the VISIregister.

TABLE 3-1: CPU CONTROL CODES IN ICSP™ MODE

Note: If a capacitor is present on the MCLR pin, thehigh time for entering ICSP mode can vary.

MCLR

PGEDx

PGECx

VDD

P6

P14

b31 b30 b29 b28 b27 b2 b1 b0b3...

Program/Verify Entry Code = 0x4D434851

P1AP1B

P18

P19

0 1 0 0 1 0 0 0 1

P7VDD VDD

P21P1 * 5

1 2 3 4 5

4-Bit Control Code Mnemonic Description

0000 SIX Shift in 24-bit instruction and execute.

0001 REGOUT Shift out the VISIregister.

0010-1111 N/A Reserved.

2018 Microchip Technology Inc. DS70005352C-page 13

Page 14: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.3.1 SIX SERIAL INSTRUCTION EXECUTION

The SIX control code allows execution of thedsPIC33 family assembly instructions. When the SIXcode is received, the CPU is suspended for 24 clockcycles, as the instruction is then clocked into theinternal buffer. Once the instruction is shifted in, thestate machine allows it to be executed over the next

four PGECx clock cycles. While the received instruc-tion is executed, the state machine simultaneouslyshifts in the next 4-bit command (see Figure 3-4).

FIGURE 3-3: SIX SERIAL EXECUTION

3.3.1.1 Differences Between Execution of SIX and a Normal Instruction

There are some differences between executing instruc-tions normally and using the ICSP SIX command. As aresult, the code examples in this specification may notmatch those for performing the same functions duringnormal device operation.

The important differences are:

• Two-word instructions require two SIX operationsto clock in all of the necessary data. Examples of two-word instructions are GOTO andCALL.

• Two-cycle instructions require two SIX operationsto complete. The first SIX operation shifts in the instruction andbegins to execute it. A second SIX operation, whichshould shift in a NOP to avoid losing data, providesthe CPU clocks required to finish executing theinstruction. Examples of two-cycle instructions are Table Read(TBLRD) and Table Write (TBLWT) instructions.

• Must provide NOP instruction during Stall toaccount for pipeline changes.A CPU Stall occurs when an instruction modifies aregister that is used for Indirect Addressing by theinstruction immediately following the CPU Stall.During normal operation, the CPU will automati-cally force a NOP while the new data is read. Whileusing ICSP, the CPU stalls under the same condi-tions, but an instruction needs to be provided to

generate the clocks to get through the Stall cycle.Therefore, any indirect references to a recentlymodified register should be preceded with a NOP.For example, the instructions, MOV #0x0, W0,followed by, MOV[W0], W1, must have a NOPinserted in between. If a two-cycle instruction modifies a register which isused indirectly, it will require two following NOPs: oneto execute the second half of the instruction and theother NOP stalls the CPU to correct the pipeline. For example, instructions such as, TBLWTL [W0++],[W1], should be followed by two NOPs.

• The device Program Counter (PC) continues toautomatically increment during ICSP instructionexecution, even though the Flash memory is notbeing used. As a result, the PC may be incrementedso that it points to invalid memory locations. Examples of invalid memory spaces are unimple-mented Flash addresses or the vector space(location: 0x0 to 0x1FF). If the PC points to these locations, the device willreset, possibly interrupting the ICSP operation. Toprevent this, instructions should be periodicallyexecuted to reset the PC to a safe space. Theoptimal method of achieving this is to perform a“GOTO 0x200” instruction.

Note: Data bits on PGEDx are latched on therising edge of the PGECx clock.

P4

2 3 1 2 3 23 24 1 2 3 4

P1

PGECxP4A

PGEDx

24-Bit Instruction FetchExecute PC – 1,

1

0 0

Fetch SIX

4 5 6 7 8 18 19 20 21 2217

LSb X X X X X X X X X X X X X X MSb

PGEDx = Input

P2

P3P1B

P1A

0 0 0 0

Control Code

4

0 0

Execute 24-BitInstruction, Fetch

Next Control Code

DS70005352C-page 14 2018 Microchip Technology Inc.

Page 15: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.3.2 REGOUT SERIAL INSTRUCTIONEXECUTION

The REGOUT control code allows for data to beextracted from the device in ICSP mode. It is used toclock the contents of the VISI register, out of the device,over the PGEDx pin. After the REGOUT control code isreceived, the CPU is held Idle for eight cycles. Afterthese eight cycles, an additional 16 cycles are requiredto clock the data out (see Figure 3-4).

The REGOUT code is unique as the PGEDx pin is aninput when the control code is transmitted to thedevice. However, after the control code is processed,the PGEDx pin becomes an output as the VISI registeris shifted out.

FIGURE 3-4: REGOUT SERIAL EXECUTION

Note 1: After the contents of VISI are shifted out,the dsPIC33CK64MP105 devices maintainPGEDx as an output until the first risingedge of the next clock is received.

2: Data changes on the falling edge andlatches on the rising edge of PGECx.For all data transmissions, the LeastSignificant bit (LSb) is transmitted first.

1 2 3 4 1 2 7 8PGECx

P4

PGEDx

PGEDx = Input

Execute Previous Instruction, CPU Held in Idle Shift Out VISI Register<15:0>

P5

PGEDx = Output

1 2 3 1 2 3 4

P4A

11 13 15 161412

No Execution Takes Place,Fetch Next Control Code

0 0 0 0 0

PGEDx = Input

MSb1 2 3 41

4 5 6

LSb 141312... 11100

Fetch REGOUT Control Code

0

2018 Microchip Technology Inc. DS70005352C-page 15

Page 16: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.4 Flash Memory Programming in ICSP Mode

3.4.1 PROGRAMMING OPERATIONSFlash memory write and erase operations are controlledby the NVMCON register. Programming is performed bysetting NVMCON to select the type of erase operation(Table 3-2) or write operation (Table 3-3) and initiatingthe programming by setting the WR control bit(NVMCON<15>).

The PGECx clock is required to complete theprogramming operation. The WR control bit is clearedby hardware when the operation is finished. Refer toSection 8.0 “AC/DC Characteristics and TimingRequirements” for detailed information about themaximum time required for various programmingoperations.

TABLE 3-2: NVMCON ERASE OPERATIONS

TABLE 3-3: NVMCON WRITE OPERATIONS

3.4.2 STARTING AND STOPPING A PROGRAMMING CYCLE

For protection against accidental operations, the erase/write initiation sequence must be written to theNVMKEY register to allow any erase or program oper-ation to proceed. The two instructions following thestart of the programming sequence should be NOPs. Tostart an erase or write sequence, the following stepsmust be completed:

1. Write 0x55 to the NVMKEY register.2. Write 0xAA to the NVMKEY register.3. Set the WR bit in the NVMCON register.4. Execute three NOP instructions.

The WR bit can be polled to generate enough clockcycles for the programming operation and to determineif the erase or write cycle has been completed.

NVMCONValue Erase Operation

0x400E Bulk Erase of user memory only (does not erase Device ID, Programming Executive memory and OTP Words).

0x4003 Page Erase of program or Programming Executive memory.

NVMCONValue Write Operation

0x4001 Double-Word Programming operation.

0x4003 Row Programming operation.

DS70005352C-page 16 2018 Microchip Technology Inc.

Page 17: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

REGISTER 3-1: NVMCON: NONVOLATILE MEMORY (NVM) CONTROL REGISTER

R/SO-0(1) R/W-0(1) R/W-0(1) R/W-0 U-0 U-0 R/W-0 R/C-0WR WREN WRERR NVMSIDL(2) — — RPDF(6) URERR(6)

bit 15 bit 8

U-0 U-0 U-0 U-0 R/W-0(1) R/W-0(1) R/W-0(1) R/W-0(1)

— — — — NVMOP3(3,4) NVMOP2(3,4) NVMOP1(3,4) NVMOP0(3,4)

bit 7 bit 0

Legend: C = Clearable bit SO = Settable Only bitR = Readable bit W = Writable bit U = Unimplemented bit, read as ‘0’-n = Value at POR ‘1’ = Bit is set ‘0’ = Bit is cleared x = Bit is unknown

bit 15 WR: Write Control bit(1)

1 = Initiates a Flash memory program or erase operation; the operation is self-timed and the bit iscleared by hardware once operation is complete

0 = Program or erase operation is complete and inactivebit 14 WREN: Write Enable bit(1)

1 = Enables Flash program/erase operations0 = Inhibits Flash program/erase operations

bit 13 WRERR: Write Sequence Error Flag bit(1)

1 = An improper program/erase sequence attempt or termination has occurred (bit is set automaticallyon any set attempt of the WR bit)

0 = The program/erase operation completed normallybit 12 NVMSIDL: NVM Stop in Idle Control bit(2)

1 = Flash voltage regulator goes into Standby mode during Idle mode0 = Flash voltage regulator is active during Idle mode

bit 11-10 Unimplemented: Read as ‘0’

Note 1: These bits can only be reset on a POR.2: If this bit is set, there will be minimal power savings (IIDLE), and upon exiting Idle mode, there is a delay

(TVREG) before Flash memory becomes operational.3: All other combinations of NVMOP<3:0> are unimplemented.4: Execution of the PWRSAV instruction is ignored while any of the NVM operations are in progress.5: Two adjacent words on a 4-word boundary are programmed during execution of this operation.6: Not used in ICSP™ mode.

2018 Microchip Technology Inc. DS70005352C-page 17

Page 18: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

bit 9 RPDF: Row Programming Data Format Control bit(6)

1 = Row data to be stored in RAM is in compressed format0 = Row data to be stored in RAM is in uncompressed format

bit 8 URERR: Row Programming Data Underrun Error Flag bit(6)

1 = Row Programming operation has been terminated due to data underrun error0 = No data underrun error has occurred

bit 7-4 Unimplemented: Read as ‘0’bit 3-0 NVMOP<3:0>: NVM Operation Select bits(1,3,4)

1111 = Reserved1110 = User memory Bulk Erase operation1010 = Reserved1001 = Reserved1000 = Reserved0101 = Reserved 0100 = Reserved0011 = Memory Page Erase operation0010 = Memory Row Program operation(6)

0001 = Memory Double-Word Program operation(5)

0000 = Reserved

REGISTER 3-1: NVMCON: NONVOLATILE MEMORY (NVM) CONTROL REGISTER (CONTINUED)

Note 1: These bits can only be reset on a POR.2: If this bit is set, there will be minimal power savings (IIDLE), and upon exiting Idle mode, there is a delay

(TVREG) before Flash memory becomes operational.3: All other combinations of NVMOP<3:0> are unimplemented.4: Execution of the PWRSAV instruction is ignored while any of the NVM operations are in progress.5: Two adjacent words on a 4-word boundary are programmed during execution of this operation.6: Not used in ICSP™ mode.

DS70005352C-page 18 2018 Microchip Technology Inc.

Page 19: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.5 Erasing Program MemoryFigure 3-5 shows a high-level overview for the BulkErase of code memory.

Table 3-4 provides the ICSP programming process forerasing the program memory.

FIGURE 3-5: BULK ERASE FLOW

Note: Program memory must be erased beforewriting any data to program memory.

Start

End

Set the WR Bit to Initiate Erase

Write 0x400E to NVMCON SFR

Poll the WR Bit Until it is Cleared

TABLE 3-4: SERIAL INSTRUCTION EXECUTION FOR BULK ERASE OF CODE MEMORY

Command(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Set the NVMCON register to erase all user program memory.0000000000000000

2400EA88468A000000000000

MOV #0x400E, W10MOV W10, NVMCONNOPNOP

Step 3: Initiate the erase cycle.00000000000000000000000000000000

2005518846B1200AA18846B1A8F1A1000000000000000000

MOV #0x55, W1MOV W1, NVMKEYMOV #0xAA, W1MOV W1, NVMKEYBSET NVMCON, #WRNOPNOPNOP

2018 Microchip Technology Inc. DS70005352C-page 19

Page 20: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 4: Generate clock pulses for the code memory Bulk Erase operation to complete until the WR bit is clear.0000000000000000000000010000000000000000000000000000

000000804680000000887E60000000<VISI>000000000000000000040200000000000000000000

NOPMOV NVMCON, W0NOPMOV W0, VISINOPClock out contents of the VISI register.NOPNOPNOPGOTO 0x200NOPNOPNOPRepeat until the WR bit is clear.

TABLE 3-4: SERIAL INSTRUCTION EXECUTION FOR BULK ERASE OF CODE MEMORY (CONTINUED)

Command(Binary)

Data(Hex) Description

DS70005352C-page 20 2018 Microchip Technology Inc.

Page 21: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.6 Page EraseFigure 3-6 shows a high-level overview for erasing apage of code memory.

Table 3-5 provides the ICSP programming details forerasing a page of code memory.

FIGURE 3-6: PAGE ERASE FLOW

Note: For Page Erase operations, the NVMCONvalue must be modified as per Table 3-2.The NVMADR/U registers must point toany of the locations of the page to beerased.

Start

End

Set the WR Bit to Initiate Erase

Write 0x4003 to NVMCON SFR

Poll the WR Bit Until it is Cleared

TABLE 3-5: SERIAL INSTRUCTION EXECUTION FOR ERASING A PAGE OF CODE MEMORY

Command(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Set the NVMADRU/NVMADR register pair to point to the correct page to be erased.0000000000000000

2xxxx32xxxx48846938846A4

MOV #DestinationAddress<15:0>, W3MOV #DestinationAddress<23:16>, W4MOV W3, NVMADRMOV W4, NVMADRU

Step 3: Set the NVMCON register to erase the first page of executive memory.0000000000000000

24003A88468A000000000000

MOV #0x4003, W10MOV W10, NVMCONNOPNOP

2018 Microchip Technology Inc. DS70005352C-page 21

Page 22: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 4: Initiate the erase cycle.00000000000000000000000000000000

2005518846B1200AA18846B1A8F1A1000000000000000000

MOV #0x55, W1MOV W1, NVMKEYMOV #0xAA, W1MOV W1, NVMKEYBSET NVMCON, #WRNOPNOPNOP

Step 5: Generate clock pulses for the Page Erase operation to complete until the WR bit is clear.0000000000000000000000010000000000000000000000000000

000000A8F1A1000000887E60000000<VISI>000000000000000000040200000000000000000000

NOPMOV NVMCON, W0NOPMOV W0, VISINOPClock out contents of the VISI register.NOPNOPNOPGOTO 0x200NOPNOPNOPRepeat until the WR bit is clear.

TABLE 3-5: SERIAL INSTRUCTION EXECUTION FOR ERASING A PAGE OF CODE MEMORY (CONTINUED)

Command(Binary)

Data(Hex) Description

DS70005352C-page 22 2018 Microchip Technology Inc.

Page 23: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.7 Writing Code MemoryFigure 3-8 shows a high-level overview for writing thecode memory.

Table 3-6 provides the ICSP programming details forwriting the code memory.

Code memory is written two instruction words at a time.Two words are loaded into the write latches, located at0xFA0000 and 0xFA0002, using the packed data for-mat shown in Figure 3-7. The destination address isloaded into the NVMADR and NVMADRU registers.Next, the write cycle is initiated by setting the WREN bitin the NVMCON register. The WR bit in NVMCON willbe cleared in hardware once the double-word write iscomplete. This process is repeated for all memorylocations to be programmed.

FIGURE 3-7: PACKED INSTRUCTION WORD FORMAT

FIGURE 3-8: PROGRAM CODE MEMORY FLOW

15 8 7 0

LSW1

MSB2 MSB1

LSW2

LSWx: Least Significant 16 bits of instruction wordMSBx: Most Significant Byte of instruction word

Start

Configure Devicefor Writes

All DataWritten?

Yes

Initiate WriteSequence and Poll

WR Bit to be Cleared

Load Two Words intoWrite Latches

IncrementWrite Pointer

End

No

Programming Using Two Write Latches

2018 Microchip Technology Inc. DS70005352C-page 23

Page 24: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

TABLE 3-6: SERIAL INSTRUCTION EXECUTION FOR PROGRAMMING CODE MEMORY:TWO-WORD LATCH WRITES

Command(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register for writing to the latches.00000000

200FAC8802AC

MOV #0xFA, W12MOV W12, TBLPAG

Step 3: Load W0:W2 with the next two packed instruction words to program.000000000000

2xxxx02xxxx12xxxx2

MOV #<LSW0>, W0MOV #<MSB1:MSB0>, W1MOV #<LSW1>, W2

Step 4: Set the Read Pointer (W6) and Write Pointer (W7), and load the (next set of) write latches.0000000000000000000000000000000000000000000000000000000000000000

EB0300000000EB0380000000BB0BB6000000000000BBDBB6000000000000BBEBB6000000000000BB0B96000000000000

CLR W6NOPCLR W7NOPTBLWTL [W6++], [W7] NOPNOPTBLWTH.B [W6++], [W7++] NOPNOPTBLWTH.B [W6++], [++W7] NOPNOPTBLWTL.W [W6], [W7] NOP NOP

Step 5: Set the NVMADRU/NVMADR register pair to point to the correct address.0000000000000000

2xxxx32xxxx48846938846A4

MOV #DestinationAddress<15:0>, W3MOV #DestinationAddress<23:16>, W4MOV W3, NVMADRMOV W4, NVMADRU

Step 6: Set the NVMCON register to program two instruction words.00000000000000000000

24001A00000088468A000000000000

MOV #0x4001, W10NOPMOV W10, NVMCONNOPNOP

DS70005352C-page 24 2018 Microchip Technology Inc.

Page 25: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 7: Initiate the write cycle.00000000000000000000000000000000

2005518846B1200AA18846B1A8F1A1000000000000000000

MOV #0x55, W1MOV W1, NVMKEYMOV #0xAA, W1MOV W1, NVMKEYBSET NVMCON, #WRNOPNOPNOP

Step 8: Generate clock pulses for the program operation to complete until the WR bit is clear.0000000000000000000000010000000000000000000000000000

00000080468000000887E60000000<VISI>000000000000000000040200000000000000000000

NOPMOV NVMCON, W0NOPMOV W0, VISINOPClock out contents of the VISI register.NOPNOPNOPGOTO 0x200NOPNOPNOPRepeat until the WR bit is clear.

Step 9: Repeat Steps 3-8 until all code memory is programmed.

TABLE 3-6: SERIAL INSTRUCTION EXECUTION FOR PROGRAMMING CODE MEMORY:TWO-WORD LATCH WRITES (CONTINUED)

Command(Binary)

Data(Hex) Description

2018 Microchip Technology Inc. DS70005352C-page 25

Page 26: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.8 Writing Configuration BitsThe procedure for writing Configuration bits is similar tothe procedure for writing code memory.

To change the values of the Configuration bits once theyhave been programmed, the device must be erased, asdescribed in Section 3.5 “Erasing Program Memory”,and reprogrammed to the desired value.

Table 3-7 provides the ICSP programming details forwriting the Configuration bits.

The code protection can be enabled by programming‘0’ in the code protection Configuration bits. In order toverify the data by reading the Configuration bits afterperforming the write, the code protection bits shouldinitially be programmed to ‘1’ to ensure that theverification can be performed properly. After verificationis finished, the code protection bits can be programmedto ‘0’ by using a word write to the appropriateConfiguration register.

TABLE 3-7: SERIAL INSTRUCTION EXECUTION FOR WRITING CONFIGURATION WORDS

Command(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register for writing to the latches.00000000

200FAC8802AC

MOV #0xFA, W12MOV W12, TBLPAG

Step 3: Load W0:W1 with the next two Configuration Words to program.0000000000000000

2xxxx02xxxx12xxxx22xxxx3

MOV #<Config1 lower word data>, W0MOV #<Config1 upper word data>, W1MOV #<Config2 lower word data>, W2MOV #<Config2 upper word data>, W3

Step 4: Set the Write Pointer (W3) and load the write latches.00000000000000000000000000000000000000000000000000000000

EB0300000000BB0B00000000000000BB9B01000000000000BB0B02000000000000BB9B03000000000000

CLR W6NOPTBLWTL W0, [W6]NOPNOPTBLWTH W1, [W6++]NOPNOPTBLWTL W2, [W6]NOPNOPTBLWTH W3, [W6++]NOPNOP

Step 5: Set the NVMADRU/NVMADR register pair to point to the correct Configuration Word address.0000000000000000

2xxxx42xxxx58846948846A5

MOV #DestinationAddress<15:0>, W4MOV #DestinationAddress<23:16>, W5MOV W4, NVMADRMOV W5, NVMADRU

DS70005352C-page 26 2018 Microchip Technology Inc.

Page 27: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 6: Set the NVMCON register to program two instruction words.00000000000000000000

24001A00000088468A000000000000

MOV #0x4001, W10NOPMOV W10, NVMCONNOPNOP

Step 7: Initiate the write cycle.0000000000000000000000000000000000000000

2005518846B1200AA18846B1A8F1A1000000000000000000000000000000

MOV #0x55, W1MOV W1, NVMKEYMOV #0xAA, W1MOV W1, NVMKEYBSET NVMCON, #WRNOPNOPNOPNOPNOP

Step 8: Generate clock pulses for the program operation to complete until the WR bit is clear.0000000000000000000000010000000000000000000000000000

000000804680000000887E60000000<VISI>000000000000000000040200000000000000000000

NOPMOV NVMCON, W0NOPMOV W0, VISINOPClock out contents of the VISI register.NOPNOPNOPGOTO 0x200NOPNOPNOPRepeat until the WR bit is clear.

Step 9: Repeat Steps 3-8 until all Configuration registers are programmed.

TABLE 3-7: SERIAL INSTRUCTION EXECUTION FOR WRITING CONFIGURATION WORDS (CONTINUED)

Command(Binary)

Data(Hex) Description

2018 Microchip Technology Inc. DS70005352C-page 27

Page 28: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.9 Writing OTP WordsThe procedure for writing to user OTP memory is similarto the procedure for writing to user program memory,except that each of the 64 OTP double-word pairs canonly be written once. Both words in each OTP locationmust be written together using the same two-word latchwrite process used to write code memory.

Writing anything, with the exception of all ‘1’s, to an OTPlocation generates an ECC checksum and renders thatlocation used. Attempting to write to an OTP location thathas already been programmed will cause an ECCchecksum error the next time that location is read. Careshould be taken to avoid writing to OTP locations thathave already been programmed or may need to beprogrammed at a later time. See Figure 2-6 for thelocation of user OTP memory.

Figure 3-9 shows a high-level overview of the OTPprogramming process.

FIGURE 3-9: OTP PROGRAMMING PROCESS

3.10 Reading OTP WordsThe procedure for reading OTP Words is similar to theprocedure for reading code memory. Since there aremultiple OTP Words, they are read one at a time.

3.11 Reading Code MemoryReading from code memory is performed by executinga series of TBLRD instructions and clocking out the datausing the REGOUT command.

Table 3-8 provides the ICSP programming details forreading code memory.

To minimize reading time, the same packed data formatthat the write procedure uses is utilized. SeeSection 3.7 “Writing Code Memory” for more detailson the packed data format.

No

Start

Data to beWritten to

OTP?

Do Not Writeto OTP Memory

No

Yes

Read (next) OTPLocation to be

Written

No

Yes

Do Not Writeto OTP Memory

OTPLocation

Read All ‘1’s?

Write Datato OTP Location

Yes

All DataWritten?

END

DS70005352C-page 28 2018 Microchip Technology Inc.

Page 29: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

TABLE 3-8: SERIAL INSTRUCTION EXECUTION FOR READING CODE MEMORYCommand

(Binary)Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register and the Read Pointer (W6) for the TBLRD instruction.000000000000

200xx08802A02xxxx6

MOV #<SourceAddress23:16>, W0MOV W0, TBLPAGMOV #<SourceAddress15:0>, W6

2018 Microchip Technology Inc. DS70005352C-page 29

Page 30: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 3: Initialize the Write Pointer (W7) and store the next four locations of code memory to W0:W5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

EB0380000000BA1B96000000000000000000000000000000BADBB6000000000000000000000000000000BADBD6000000000000000000000000000000BA1BB6000000000000000000000000000000BA1B96000000000000000000000000000000BADBB6000000000000000000000000000000BADBD6000000000000000000000000000000BA0BB6000000000000000000000000000000

CLR W7 NOPTBLRDL [W6], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [W6++], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [++W6], [W7++] NOPNOPNOPNOPNOPTBLRDL [W6++], [W7++] NOPNOPNOPNOPNOPTBLRDL [W6], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [W6++], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [++W6], [W7++] NOPNOPNOPNOPNOPTBLRDL [W6++], [W7] NOPNOPNOPNOPNOP

TABLE 3-8: SERIAL INSTRUCTION EXECUTION FOR READING CODE MEMORY (CONTINUED)Command

(Binary)Data(Hex) Description

DS70005352C-page 30 2018 Microchip Technology Inc.

Page 31: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 4: Output W0:W5 using the VISI register and REGOUT command.000000000001000000000000000100000000000000010000000000000001000000000000000100000000000000010000

887E60000000<VISI>000000887E61000000<VISI>000000887E62000000<VISI>000000887E63000000<VISI>000000887E64000000<VISI>000000887E65000000<VISI>000000

MOV W0, VISI NOPClock out contents of the VISI register.NOPMOV W1, VISI NOPClock out contents of the VISI register.NOPMOV W2, VISI NOPClock out contents of the VISI register.NOPMOV W3, VISI NOPClock out contents of the VISI register.NOPMOV W4, VISI NOPClock out contents of the VISI register.NOPMOV W5, VISI NOPClock out contents of the VISI register.NOP

Step 5: Reset the device’s internal PC.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200 NOPNOPNOP

Step 6: Repeat Steps 3-5 until all desired code memory is read.

TABLE 3-8: SERIAL INSTRUCTION EXECUTION FOR READING CODE MEMORY (CONTINUED)Command

(Binary)Data(Hex) Description

2018 Microchip Technology Inc. DS70005352C-page 31

Page 32: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.12 Reading Configuration RegistersThe procedure for reading the Configuration Words issimilar to the procedure for reading code memory.Since there are multiple Configuration Words, they areread one at a time.

Table 3-9 provides the ICSP programming details forreading the Configuration Words.

TABLE 3-9: SERIAL INSTRUCTION EXECUTION FOR READING CONFIGURATION WORDSCommand

(Binary)Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register, the Write Pointer (W7) and the Read Pointer (W6) for the TBLRD instruction.0000000000000000

200xx020FCC78802A02xxxx6

MOV #<Address23:16>, W0MOV #<VISI>, W7MOV W0, TBLPAGMOV #<Address15:0>, W6

Step 3: Store the Configuration register and send the contents of the VISI register.000000000000000000000000000000010000000000000000000000000001

000000BA8B96000000000000000000000000000000<VISI>BA0B96000000000000000000000000000000<VISI>

NOPTBLRDH [W6], [W7] NOPNOPNOPNOPNOPClock out contents of the VISI register.TBLRDL [W6], [W7]NOPNOPNOPNOPNOPClock out contents of the VISI register.

Step 4: Repeat Steps 1-3 until all Configuration registers are read.

DS70005352C-page 32 2018 Microchip Technology Inc.

Page 33: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

3.13 Verify Code Memory and Configuration Bits

The verify step involves reading back the code memoryspace and comparing it against the copy held in theprogrammer’s buffer. The Configuration Words areverified with the rest of the code.

The verify process is shown in Figure 3-10. The lowerword of the instruction is read, and then the lowerbyte of the upper word is read and compared againstthe instruction stored in the programmer’s buffer.Refer to Section 3.11 “Reading Code Memory” forimplementation details of reading code memory.

FIGURE 3-10: VERIFY CODE MEMORY FLOW

3.14 Exiting ICSP ModeExiting Program/Verify mode is done by removingVDD from MCLR, as shown in Figure 3-11. The onlyrequirement for exit is that an interval, P16, shouldelapse between the last clock, and the program signalson PGECx and PGEDx before removing VDD.

FIGURE 3-11: EXITING ICSP™ MODE

Note: Because the Configuration Words includethe device code protection bit, codememory should be verified immediatelyafter writing if code protection is to beenabled. This is because the device willnot be readable or verifiable if a deviceReset occurs after the code-protect bithas been cleared.

Read Low Word

Read High Byte

Data?

AllCode Memory

Verified?

No

Yes

No

Start

Yes

End

with Post-Increment

with Post-Increment

FailureReport Error

DoesInstruction Word =

Expected

MCLR

P16

PGECx

VDD

P17

PGEDx

2018 Microchip Technology Inc. DS70005352C-page 33

Page 34: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

4.0 DEVICE PROGRAMMING – ENHANCED ICSP

This section discusses programming the device throughEnhanced ICSP and the Programming Executive. TheProgramming Executive resides in executive memory(separate from code memory) and is executed whenEnhanced ICSP Programming mode is entered. TheProgramming Executive provides the mechanism for theprogrammer (host device) to program and verify thedsPIC33CK64MP105 devices using a simple commandset and communication protocol. There are several basicfunctions provided by the Programming Executive:

• Read Memory• Erase Memory• Program Memory• Blank Check

The Programming Executive performs the low-leveltasks required for erasing, programming and verifyinga device. This allows the programmer to program thedevice by issuing the appropriate commands and data.A detailed description for each command is provided inSection 5.2 “Programming Executive Commands”.

4.1 Overview of the Programming Process

Figure 4-1 shows the high-level overview of theprogramming process. First, it must be determined ifthe Programming Executive is present in executivememory, then the Enhanced ICSP mode is entered.The program memory is then erased, and the programmemory and Configuration Words are programmedand verified. Last, the code-protect Configuration bitsare programmed (if required) and Enhanced ICSPmode is exited.

FIGURE 4-1: HIGH-LEVEL ENHANCED ICSP™ PROGRAMMING FLOW

Note: The PE uses the device’s data RAM forvariable storage and program execution.After running the PE, no assumptionsshould be made about the contents ofdata RAM.

Start

End

Program Memory,

Verify Program Memory,

Erase

Program Code-Protect

Exit Enhanced ICSP

Confirm Presence of

Enter Enhanced

Configuration Words

Configuration Bits

Programming Executive

ICSP™ Mode

Program Memory

Configuration Wordsand User OTP Words

and User OTP Words

DS70005352C-page 34 2018 Microchip Technology Inc.

Page 35: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

4.2 Confirming the Presence of the Programming Executive

Before programming can begin, the programmer mustconfirm that the Programming Executive is stored inexecutive memory. The procedure for this task isshown in Figure 4-2.

First, In-Circuit Serial Programming (ICSP) mode isentered. Then, the unique Application ID Word storedin executive memory is read. If the ProgrammingExecutive is resident, the correct Application ID Word,0xDF, is read and programming can resume as normal.However, if the Application ID Word is not present,the PE must be programmed to executive codememory using the method described in Section 5.0“The Programming Executive”.

Section 3.0 “Device Programming – ICSP” describesthe ICSP programming method. Section 4.3 “Readingthe Application ID Word” describes the procedure forreading the Application ID Word in ICSP mode.

FIGURE 4-2: CONFIRMING PRESENCE OF PROGRAMMING EXECUTIVE

Is

Start

Enter ICSP™ Mode

Application IDPresent?

Yes

No

Application IDCheck the

be ProgrammedProg. Executive must

by Reading Address,0x800BFE

End

Exit ICSP Mode

Enter Enhanced

Sanity Check

ICSP Mode

2018 Microchip Technology Inc. DS70005352C-page 35

Page 36: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

4.3 Reading the Application ID WordThe Application ID Word is stored at the address,0x800BFE, in executive code memory. To read thismemory location, you must use the SIX control code tomove this program memory location to the VISIregister. Then, the REGOUT control code must be usedto clock the contents of the VISI register out of thedevice. The corresponding control and instructioncodes that must be serially transmitted to the device toperform this operation are provided in Table 4-1.

After the programmer has clocked out the ApplicationID Word, it must be inspected. If the Application IDhas the value, 0xDF, the Programming Executive isresident in memory and the device can be programmedusing the mechanism described in Section 4.0 “DeviceProgramming – Enhanced ICSP”. However, if theApplication ID has any other value, the ProgrammingExecutive is not resident in memory; it must be loadedinto memory before the device can be programmed.The procedure for loading the ProgrammingExecutive to memory is described in Section 5.0 “TheProgramming Executive”.

TABLE 4-1: SERIAL INSTRUCTION EXECUTION FOR READING THE APPLICATION ID WORDCommand(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register and the Read Pointer (W0) for the TBLRD instruction.00000000000000000000000000000000000000000000

2008008802A020BFE020FCC1000000BA0890000000000000000000000000000000

MOV #0x80, W0 MOV W0, TBLPAGMOV #0xBFE, W0 MOV #<VISI>, W1 NOPTBLRDL [W0], [W1] NOPNOPNOPNOPNOP

Step 3: Output the VISI register using the REGOUT command.0001 <VISI> Clock out contents of the VISI register.

DS70005352C-page 36 2018 Microchip Technology Inc.

Page 37: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

4.4 Entering Enhanced ICSP ModeAs shown in Figure 4-3, entering Enhanced ICSPProgram/Verify mode requires three steps:

1. The MCLR pin is briefly driven high, then low.2. A 32-bit key sequence is clocked into PGEDx.

An interval of at least P18 must elapse beforepresenting the key sequence on PGEDx.

3. MCLR is held within a specified period of time,then driven high.

The key sequence is a specific 32-bit pattern,‘0100 1101 0100 0011 0100 1000 0101 0000’(more easily remembered as 0x4D434850 in hexa-decimal format). The device will enter Program/Verifymode only if the key sequence is valid. The MostSignificant bit (MSb) of the most significant nibble mustbe shifted in first.

Once the key sequence is complete, VDD must be appliedto MCLR and held at that level for as long as Program/Verify mode is to be maintained. An interval time of atleast time, P19, P7 and P1 * 5, must elapse beforepresenting data on PGEDx. Signals appearing on PGEDxbefore P7 has elapsed will not be interpreted as valid.

4.5 Blank CheckThe term, “Blank Check”, implies verifying that thedevice has been successfully erased and has noprogrammed memory locations. A blank or erasedmemory location is always read as ‘1’.

The Device ID registers (0xFF0000:0xFF0002) can beignored by the Blank Check since this region storesdevice information that cannot be erased. Additionally,all unimplemented memory space and Calibrationregisters should be ignored by the Blank Check.

The QBLANK command is used for the Blank Check. Itdetermines if the code memory is erased by testingthese memory regions. A ‘BLANK’ or ‘NOT BLANK’response is returned. If it is determined that the deviceis not blank, it must be erased before attempting toprogram the chip.

FIGURE 4-3: ENTERING ENHANCED ICSP™ MODE

MCLR

PGEDx

PGECx

VDD

P6P14

b31 b30 b29 b28 b27 b2 b1 b0b3...

Program/Verify Entry Code = 0x4D434850

P1AP1B

P18

P19

0 1 0 0 1 0 0 0 0

P7VDD VDD

P21 P1 * 5

2018 Microchip Technology Inc. DS70005352C-page 37

Page 38: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

4.6 Code Memory Programming4.6.1 PROGRAMMING METHODOLOGYThere are two commands that can be used forprogramming code memory when utilizing the Program-ming Executive. The PROG2W command programs andverifies two 24-bit instruction words into the programmemory, starting at the specified address. The secondand faster command, PROGP, programs and verifies anentire row of 128 24-bit instruction words to programmemory, starting at the specified address. Pleaseensure that the starting address is on a row boundarywhen using Row Programming. See Section 5.0 “TheProgramming Executive” for a full description of eachof these commands.

Figure 4-4 and Figure 4-5 show a high-level overviewof the code memory programming process using thePROG2W and PROGP commands.

FIGURE 4-4: FLOWCHART FOR DOUBLE-WORD PROGRAMMING

FIGURE 4-5: FLOWCHART FOR ROW PROGRAMMING

BaseAddress = 0x0

Start

FailureReport ErrorEnd

Yes

No

Yes

PASS?

No

BaseAddressCommand to Program

Send PROG2W

Programmed?All Words

BaseAddress + 0x04BaseAddress =

PROG2W ResponseIs

BaseAddress = 0x0

Start

FailureReport ErrorEnd

Yes

No

Yes

PASS?

No

BaseAddressCommand to Program

Send PROGP

Programmed?All Rows

BaseAddress + 0x100BaseAddress =

PROGP ResponseIs

DS70005352C-page 38 2018 Microchip Technology Inc.

Page 39: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

4.7 Configuration Bits ProgrammingThe Configuration bits are programmed, one 16-bitword at a time, using the PROG2W command. This com-mand specifies the configuration data and address.When Configuration bits are programmed, anyunimplemented bits must be programmed with a ‘1’.

Multiple PROG2W commands are required to programall Configuration bits. A flowchart for Configuration bitprogramming is shown in Figure 4-6.

FIGURE 4-6: CONFIGURATION BIT PROGRAMMING FLOW

4.8 Programming VerificationAfter the code memory is programmed, the contents ofthe memory should be verified to ensure that theprogramming was successful. Verification requirescode memory to be read back and compared againstthe copy held in the programmer’s buffer. The READPcommand can be used to read back all theprogrammed code memory and Configuration Words.

Alternatively, the programmer can perform the verifica-tion after the entire device is programmed using achecksum computation.

See Section 7.0 “Checksum Computation” for moreinformation on calculating the checksum.

4.9 Exiting Enhanced ICSP ModeExiting Program/Verify mode is done by removing VDDfrom MCLR, as shown in Figure 4-7. The onlyrequirement for exit is that an interval, P16, shouldelapse between the last clock, and program signals onPGECx and PGEDx, before removing VDD.

FIGURE 4-7: EXITING ENHANCED ICSP™ MODE

Send PROG2WCommand

IsPROG2W Response

PASS?

No

Yes

No

FailureReport Error

Start

End

Yes

LastConfiguration

Word?

ConfigAddress =ConfigAddress +

0x04

MCLR

P16

PGEDx

PGECx

VDD

P17

2018 Microchip Technology Inc. DS70005352C-page 39

Page 40: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.0 THE PROGRAMMING EXECUTIVE

5.1 Programming Executive Communication

The programmer and Programming Executive have amaster-slave relationship, where the programmer isthe master programming device and the ProgrammingExecutive is the slave.

All communication is initiated by the programmer in theform of a command. Only one command at a time can besent to the Programming Executive. In turn, the PE onlysends one response to the programmer after receivingand processing a command. The PE command set isdescribed in Section 5.2 “Programming ExecutiveCommands”. The response set is described inSection 5.3 “Programming Executive Responses”.

5.1.1 COMMUNICATION INTERFACE AND PROTOCOL

The ICSP/Enhanced ICSP interface is a 2-wire SPI,implemented using the PGECx and PGEDx pins. ThePGECx pin is used as a clock input pin and the clocksource must be provided by the programmer. ThePGEDx pin is used for sending command data to, andreceiving response data from, the PE.

FIGURE 5-1: PROGRAMMING EXECUTIVE SERIAL TIMING

Since a 2-wire SPI is used, and data transmissions arebidirectional, a simple protocol is used to control thedirection of PGEDx. When the programmer completesa command transmission, it releases the PGEDx lineand allows the PE to drive this line high. The PE keepsthe PGEDx line high to indicate that it is processing thecommand.

After the PE has processed the command, it bringsPGEDx low (P9B) to indicate to the programmer thatthe response is available to be clocked out. Theprogrammer can begin to clock out the response aftera maximum wait (P9B) and the programmer mustprovide the necessary amount of clock pulses toreceive the entire response from the PE.

After the entire response is clocked out, theprogrammer should terminate the clock on PGECx untilit is time to send another command to the ProgrammingExecutive. This protocol is shown in Figure 5-2.

5.1.2 SPI RATEIn Enhanced ICSP mode, the dsPIC33CK64MP105devices operate from the internal Fast RC (FRC)oscillator, which has a nominal frequency of 8 MHz.This oscillator frequency yields an effective system clockfrequency of 4 MHz. To ensure that the programmer doesnot clock too fast, it is recommended that a 2 MHz clockbe provided by the programmer.

FIGURE 5-2: PROGRAMMING EXECUTIVE – PROGRAMMER COMMUNICATION PROTOCOL

Note: The Programming Executive can beobtained from each device page on theMicrochip website: www.microchip.com.

Note: For Enhanced ICSP, all serial data istransmitted on the falling edge of PGECxand latched on the rising edge of PGECx.All data transmissions are sent to the MSbfirst using 16-bit mode (see Figure 5-1).

PGECx

PGEDx

1 2 3 11 13 15 161412

LSb14 13 12 11

4 5 6

MSb 123... 45

P2

P3

P1

P1BP1A

1 2 15 16 1 2 15 16

PGECx

PGEDx

PGECx = Input PGECx = Input (Idle)

Host TransmitsLast Command Word

PGEDx = Input PGEDx = Output

P8

1 2 15 16

MSB X X X LSB1 0

P9B

PGECx = InputPGEDx = Output

P9A

Programming ExecutiveProcesses Command Host Clocks Out Response

Note: A delay of 25 ms is required between commands.

MSB X X X LSB MSB X X X LSB

DS70005352C-page 40 2018 Microchip Technology Inc.

Page 41: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.1.3 TIME-OUTSThe Programming Executive uses no Watchdog Timer ortime-out for transmitting responses to the programmer.If the programmer does not follow the flow control mech-anism using PGECx, as described in Section 5.1.1“Communication Interface and Protocol”, it ispossible that the Programming Executive will behaveunexpectedly while trying to send a response to the

programmer. Since the PE has no time-out, it isimperative that the programmer correctly follows thedescribed communication protocol.

As a safety measure, the programmer should use thecommand time-outs identified in Table 5-1. If the com-mand time-out expires, the programmer should resetthe PE and start programming the device again.

TABLE 5-1: PROGRAMMING EXECUTIVE COMMAND SET

Opcode Mnemonic Length(16-bit words) Time-out Description

0x0 SCHECK 1 1 ms Sanity check.0x1 Reserved N/A N/A —0x2 READP 4 1 ms/row Read ‘N’ 24-bit instruction words of the user Flash memory,

Configuration Word or Device ID register, starting from the specified address.

0x3 PROG2W 6 5 ms Program a double instruction word of code memory at the specified address and verify.

0x4 Reserved N/A N/A This command is reserved; it will return a NACK.0x5 PROGP 195 5 ms Program 128 words of program memory at the specified

starting address, then verify.0x6 Reserved N/A N/A This command is reserved; it will return a NACK.0x7 ERASEB 1 125 ms Bulk Erase user memory.0x8 Reserved N/A N/A This command is reserved; it will return a NACK.0x9 ERASEP 3 25 ms Command to erase a page.0xA Reserved N/A N/A This command is reserved; it will return a NACK.0xB QVER 1 1 ms Query the Programming Executive software version.0xC CRCP 5 1s Perform a CRC-16 on the specified range of memory.0xD Reserved N/A N/A This command is reserved; it will return a NACK.0xE QBLANK 5 700 ms Query to check whether the code memory is blank.

2018 Microchip Technology Inc. DS70005352C-page 41

Page 42: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.2 Programming Executive Commands

The Programming Executive command set is shown inTable 5-1. This table contains the opcode, mnemonic,length, time-out and description for each command.Functional details on each command are provided in thecommand descriptions (see Section 5.2.4 “CommandDescriptions”).

5.2.1 COMMAND FORMATAll Programming Executive commands have a generalformat, consisting of a 16-bit header and any requireddata for the command (see Figure 5-3). The 16-bitheader consists of a 4-bit opcode field, which is used toidentify the command, followed by a 12-bit commandlength field.

FIGURE 5-3: COMMAND FORMAT

The command opcode must match one of those in thecommand set. Any command that is received whichdoes not match the list in Table 5-1 will return a “NACK”response (see Section 5.3.1.1 “Opcode Field”).

The command length is represented in 16-bit wordssince the SPI operates in 16-bit mode. The Program-ming Executive uses the command length field todetermine the number of words to read from the SPIport. If the value of this field is incorrect, the commandwill not be properly received by the ProgrammingExecutive.

5.2.2 PACKED DATA FORMATWhen 24-bit instruction words are transferred acrossthe 16-bit SPI interface, they are packed to conservespace using the format shown in Figure 5-4. Thisformat minimizes traffic over the SPI and provides theProgramming Executive with data that is properlyaligned for performing Table Write operations.

FIGURE 5-4: PACKED INSTRUCTION WORD FORMAT

5.2.3 PROGRAMMING EXECUTIVE ERROR HANDLING

The Programming Executive will “NACK” all unsup-ported commands. Additionally, due to the memoryconstraints of the Programming Executive, no checkingis performed on the data contained in the programmercommand. It is the responsibility of the programmer tocommand the Programming Executive with valid com-mand arguments or the programming operation mayfail. Additional information on error handling is providedin Section 5.3.1.3 “QE_Code Field”.

15 12 11 0

Opcode Length

Command Data First Word (if required)

Command Data Last Word (if required)

15 8 7 0

LSW1

MSB2 MSB1

LSW2

LSWx: Least Significant 16 bits of instruction wordMSBx: Most Significant Byte of instruction word

DS70005352C-page 42 2018 Microchip Technology Inc.

Page 43: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.2.4 COMMAND DESCRIPTIONSAll commands supported by the ProgrammingExecutive are described in Section 5.2.4.1 “SCHECKCommand” through Section 5.2.4.9 “QBLANKCommand”.

5.2.4.1 SCHECK Command

Table 5-2 provides the description for the SCHECKcommand.

TABLE 5-2: COMMAND DESCRIPTION

The SCHECK command instructs the ProgrammingExecutive to do nothing but generate a response. Thiscommand is used as a “Sanity Check” to verify that theProgramming Executive is operational.

Expected Response (2 words):0x10000x0002

5.2.4.2 READP Command

Table 5-3 provides the description for the READPcommand.

TABLE 5-3: COMMAND DESCRIPTION

The READP command instructs the ProgrammingExecutive to read N 24-bit words of code memory,Flash Configuration Words or Device ID registers,starting from the 24-bit address specified by Addr_MSBand Addr_LS. This command can only be used to read24-bit data. All data returned in response to thiscommand uses the packed data format described inSection 5.2.2 “Packed Data Format”.

Expected Response (2 + 3 * N/2 words for N even):0x12002 + 3 * N/2Least Significant Program Memory Word 1... Least Significant Data Word N

Expected Response (4 + 3 * (N – 1)/2 words for N odd):0x12004 + 3 * (N – 1)/2Least Significant Program Memory Word 1... MSB of Program Memory Word N (zero-padded)

15 12 11 0Opcode Length

Field Description

Opcode 0x0Length 0x1

Note: This instruction is not required forprogramming but is provided fordevelopment purposes only.

15 12 11 8 7 0Opcode Length

NReserved Addr_MSB

Addr_LS

Field Description

Opcode 0x2Length 0x4N Number of 24-bit instructions to read

(maximum of 32768)Reserved 0x0Addr_MSB MSB of 24-bit source addressAddr_LS Least Significant 16 bits of 24-bit

source address

Note 1: Reading unimplemented memory willcause the Programming Executive toreset. Please ensure that only memorylocations present on a particular deviceare accessed.

2: When the READP command is used toread Device ID registers, the upper byte(bits<23:16>) of each word returned bythe Programming Executive should beignored.

2018 Microchip Technology Inc. DS70005352C-page 43

Page 44: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.2.4.3 PROG2W Command

Table 5-4 provides the description for the PROG2Wcommand.

TABLE 5-4: COMMAND DESCRIPTION

The PROG2W command instructs the ProgrammingExecutive to program two instruction words of codememory (six bytes) to the specified memory address.

After the words have been programmed to codememory, the Programming Executive verifies theprogrammed data against the data in the command.

Expected Response (2 words):0x13000x0002

5.2.4.4 PROGP Command

Table 5-5 provides the description for the PROGPcommand.

TABLE 5-5: COMMAND DESCRIPTION

The PROGP command instructs the ProgrammingExecutive to program one row of code memory(128 instruction words) to the specified memoryaddress. Programming begins with the row addressspecified in the command. The destination addressshould be a multiple of 0x100.

The data to program the memory, located in commandwords, D_1 through D_192, must be arranged usingthe packed instruction word format illustrated inFigure 5-4.

After all data has been programmed to code memory,the Programming Executive verifies the programmeddata against the data in the command.

Expected Response (2 words):0x15000x0002

15 12 11 8 7 0Opcode Length

Reserved Addr_MSBAddr_LSDataL_LS

DataH_MSB DataL_MSBDataH_LS

Field Description

Opcode 0x3Length 0x6DataL_MSB MSB of 24-bit data for low instruction

wordDataH_MSB MSB of 24-bit data for high instruction

wordAddr_MSB MSB of 24-bit destination addressAddr_LS Least Significant 16 bits of 24-bit

destination addressDataL_LS Least Significant 16 bits of 24-bit data

for low instruction wordDataH_LS Least Significant 16 bits of 24-bit data

for high instruction word

15 12 11 8 7 0Opcode Length

Reserved Addr_MSBAddr_LS

D_1D_2...

D_N

Field Description

Opcode 0x5Length 0xC3Reserved 0x0Addr_MSB MSB of 24-bit destination addressAddr_LS Least Significant 16 bits of 24-bit

destination addressD_1 16-bit Data Word 1D_2 16-bit Data Word 2... 16-bit Data Word 3 through 191D_192 16-bit Data Word 192

Note: Refer to Table 2-3 for code memory sizeinformation.

DS70005352C-page 44 2018 Microchip Technology Inc.

Page 45: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.2.4.5 ERASEB Command

Table 5-6 provides the description for the ERASEBcommand.

TABLE 5-6: COMMAND DESCRIPTION

The ERASEB command instructs the ProgrammingExecutive to perform a Bulk Erase of the user Flashmemory.

Expected Response (2 words):0x17000x0002

5.2.4.6 ERASEP Command

Table 5-7 provides the description for the ERASEPcommand.

TABLE 5-7: COMMAND DESCRIPTION

The ERASEP command instructs the ProgrammingExecutive to Page Erase [NUM_PAGES] of codememory. The code memory must be erased at an“even” 1024 instruction word address boundary.

Expected Response (2 words):0x19000x0002

5.2.4.7 QVER Command

Table 5-8 provides the description for the QVERcommand.

TABLE 5-8: COMMAND DESCRIPTION

The QVER command queries the version of theProgramming Executive software stored in testmemory. The “version.revision” information is returnedin the response’s QE_Code, using a single byte withthe following format: main version in upper nibble anda revision in the lower nibble (i.e., 0x23 meansVersion 2.3 of the Programming Executive software).

Expected Response (2 words):0x1BMN (where “MN” stands for Version M.N)0x0002

5.2.4.8 CRCP Command

Table 5-9 provides the description for the CRCP command.

TABLE 5-9: COMMAND DESCRIPTION

The CRCP command performs a CRC-16 on the range ofmemory specified. This command can substitute for a fullchip verify. Data is shifted in a packed method as shownin Figure 5-4, bytewise, Least Significant Byte (LSB) first.

Example:CRC-CCITT-16 with test data of “123456789” becomes0x29B1

Expected Response (3 words):QE_Code: 0x1C00Length: 0x0003CRC Value: 0xXXXX

15 12 11 8 7 0Opcode Length

Field Description

Opcode 0x7Length 0x1

15 12 11 8 7 0Opcode Length

NUM_PAGES Addr_MSBAddr_LS

Field Description

Opcode 0x9Length 0x3NUM_PAGES Up to 255Addr_MSB Most Significant Byte of the 24-bit

addressAddr_LS Least Significant 16 bits of the 24-bit

address

15 12 11 0Opcode Length

Field Description

Opcode 0xBLength 0x1

15 12 11 8 7 0Opcode Length

Reserved Addr_MSBAddr_LSW

Reserved Size_MSBSize_LSW

Field Description

Opcode 0xCLength 0x5Addr_MSB Most Significant Byte of 24-bit addressAddr_LSW Least Significant 16 bits of 24-bit addressSize Number of 24-bit locations (address

range divided by 2)

2018 Microchip Technology Inc. DS70005352C-page 45

Page 46: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.2.4.9 QBLANK Command

Table 5-10 provides the description for the QBLANKcommand.

TABLE 5-10: COMMAND DESCRIPTION

The QBLANK command queries the ProgrammingExecutive to determine if the contents of code memoryare blank (contains all ‘1’s). The size of code memoryto check must be specified in the command.

The Blank Check for code memory begins at [Addr] andadvances toward larger addresses for the specifiednumber of instruction words.

QBLANK returns a QE_Code of 0xF0 if the specifiedcode memory is blank; otherwise, QBLANK returns aQE_Code of 0x0F.

Expected Response (2 words for blank device):0x1EF00x0002

Expected Response (2 words for non-blank device):0x1E0F0x0002

5.3 Programming Executive Responses

The Programming Executive sends a response to theprogrammer for each command that it receives. Theresponse indicates if the command was processedcorrectly. It includes any required response data orerror data.

The Programming Executive response set is shown inTable 5-11. This table contains the opcode, mnemonicand description for each response. The response formatis described in Section 5.3.1 “Response Format”.

TABLE 5-11: PROGRAMMING EXECUTIVE RESPONSE OPCODES

5.3.1 RESPONSE FORMATAll Programming Executive responses have a generalformat, consisting of a two-word header and anyrequired data for the command.

Table 5-12 provides the description of the responseformat.

TABLE 5-12: RESPONSE FORMAT DESCRIPTION

15 12 11 0Opcode Length

Reserved Size_MSBSize_LSW

Reserved Addr_MSBAddr_LSW

Field Description

Opcode 0xELength 0x5Size Length of program memory to check

(in 24-bit words) + Addr_MSAddr_MSB Most Significant Byte of the 24-bit

addressAddr_LSW Least Significant 16 bits of the 24-bit

address

Note: The QBLANK command does not check thesystem operation Configuration bits, sincethese bits are not set to ‘1’ when a ChipErase is performed.

Opcode Mnemonic Description

0x1 PASS Command successfully processed

0x2 FAIL Command unsuccessfully processed

0x3 NACK Command not known

Field Description

Opcode Response opcodeLast_Cmd Programmer command that

generated the responseQE_Code Query code or error codeLength Response length in 16-bit words

(includes two header words)D_1 First 16-bit data word (if applicable)D_N Last 16-bit data word (if applicable)

15 12 11 8 7 0Opcode Last_Cmd QE_Code

LengthD_1 (if applicable)

...D_N (if applicable)

DS70005352C-page 46 2018 Microchip Technology Inc.

Page 47: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.3.1.1 Opcode FieldThe opcode is a 4-bit field in the first word of theresponse. The opcode indicates how the command wasprocessed (see Table 5-11). If the command wasprocessed successfully, the response opcode is PASS. Ifthere was an error in processing the command, theresponse opcode is FAIL and the QE_Code indicates thereason for the failure. If the command sent to the Pro-gramming Executive is not identified, the ProgrammingExecutive returns a NACK response.

5.3.1.2 Last_Cmd FieldThe Last_Cmd is a 4-bit field in the first word of theresponse and indicates the command that theProgramming Executive processed. Since the Pro-gramming Executive can only process one commandat a time, this field is technically not required. However,it can be used to verify that the Programming Executivecorrectly received the command that the programmertransmitted.

5.3.1.3 QE_Code FieldThe QE_Code is a byte in the first word of theresponse. This byte is used to return data for querycommands and error codes for all other commands.

When the Programming Executive processes one ofthe two query commands (QBLANK or QVER), thereturned opcode is always PASS and the QE_Codeholds the query response data. The format of theQE_Code for both queries is shown in Table 5-13.

TABLE 5-13: QE_Code FOR QUERIES

When the Programming Executive processes anycommand other than a query, the QE_Code representsan error code. Supported error codes are shown inTable 5-14. If a command is successfully processed, thereturned QE_Code is set to 0x0, which indicates thatthere is no error in the command processing. If the verifyof the programming for the PROGW command fails, theQE_Code is set to 0x1. For all other ProgrammingExecutive errors, the QE_Code is 0x2.

TABLE 5-14: QE_Code FOR NON-QUERY COMMANDS

5.3.1.4 Response LengthThe response length indicates the length of theProgramming Executive’s response in 16-bit words.This field includes the two words of the response header.

With the exception of the response for the readcommands, the length of each response is onlytwo words.

The response to the READP commands uses the packedinstruction word format described in Section 5.2.2“Packed Data Format”. When reading an odd numberof Program Memory Words (N odd), the response to theREADP command is (3 * (N + 1)/2 + 2) words. Whenreading an even number of Program Memory Words(N even), the response to the READP command is(3 * N/2 + 2) words.Query QE_Code

QBLANK 0x0F = Code memory is NOT blank0xF0 = Code memory is blank

QVER 0xMN, where Programming Executive Software Version = M.N(i.e., 0x32 means Software Version 3.2)

QE_Code Description

0x0 No error0x1 Verify failed0x2 Other error

2018 Microchip Technology Inc. DS70005352C-page 47

Page 48: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.4 Programming the Programming Executive to Memory

5.4.1 OVERVIEWIf it is determined that the Programming Executive isnot present in the executive memory (as described inSection 4.2 “Confirming the Presence of the Pro-gramming Executive”), the Programming Executivemust be programmed to executive memory.

Figure 5-5 shows the high-level process of programmingthe Programming Executive into executive memory.First, the ICSP mode must be entered and the executivememory must be erased. Then, the ProgrammingExecutive is programmed and verified. Finally, ICSPmode is exited.

FIGURE 5-5: HIGH-LEVEL PROGRAMMING EXECUTIVE PROGRAM FLOW

5.4.2 ERASING EXECUTIVE MEMORYThe procedure for erasing each page of executivememory is similar to that of erasing program memoryand is shown in Figure 3-6. It consists of setting NVMCONto 0x4003 and then executing the programming cycle.

Table 5-15 shows the ICSP programming process forerasing the executive code memory.

Note: The Programming Executive can beobtained from each device page on theMicrochip website: www.microchip.com.

Start

End

Program the

Enter ICSP™ Mode

Page Erase All Pages in

Programming Executive

Executive Memory

Exit ICSP Mode

Read/Verify theProgramming Executive

Note: The Programming Executive memorymust always be erased before it isprogrammed, as described in Figure 5-5.

DS70005352C-page 48 2018 Microchip Technology Inc.

Page 49: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

TABLE 5-15: SERIAL INSTRUCTION EXECUTION FOR ERASING ALL PAGES OF EXECUTIVE MEMORY

Command(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Set the NVMADRU/NVMADR register pair to point to the correct page of executive memory to be erased.0000000000000000

2xxxx32xxxx48846938846A4

MOV #DestinationAddress<15:0>, W3MOV #DestinationAddress<23:16>, W4MOV W3, NVMADRMOV W4, NVMADRU

Step 3: Set the NVMCON register to erase the first page of executive memory.0000000000000000

24003A88468A000000000000

MOV #0x4003, W10MOV W10, NVMCONNOPNOP

Step 4: Initiate the erase cycle.00000000000000000000000000000000

2005518846B1200AA18846B1A8F1A1000000000000000000

MOV #0x55, W1MOV W1, NVMKEYMOV #0xAA, W1MOV W1, NVMKEYBSET NVMCON, #WRNOPNOPNOP

Step 5: Generate clock pulses for the Page Erase operation to complete until the WR bit is clear.0000000000000000000000010000000000000000000000000000

000000804680000000887E60000000<VISI>000000000000000000040200000000000000000000

NOPMOV NVMCON, W0NOPMOV W0, VISINOPClock out contents of the VISI register.NOPNOPNOPGOTO 0x200NOPNOPNOPRepeat until the WR bit is clear.

Step 6: Repeat Steps 2-5 for all pages of executive memory.

2018 Microchip Technology Inc. DS70005352C-page 49

Page 50: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.4.3 PROGRAM THE PROGRAMMING EXECUTIVE

Storing the PE to executive memory is similar to normalprogramming of code memory. The executive memorymust first be erased and then programmed usingtwo-word writes (two instruction words). The controlflow for this method is summarized in Figure 5-6.

Table 5-16 provides the ICSP programming processes forPE memory. To minimize programming time, the samepacked data format that the PE uses is utilized. SeeSection 5.2 “Programming Executive Commands” formore details on the packed data format.

FIGURE 5-6: PROGRAMMING EXECUTIVE PROGRAM FLOW

Start

Configure Devicefor Writes

All DataWritten?

Yes

Initiate WriteSequence and Poll

WR Bit to be Cleared

Load Two Words intoWrite Latches

IncrementWrite Pointer

End

No

Programming Using 2 Write Latches

DS70005352C-page 50 2018 Microchip Technology Inc.

Page 51: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

TABLE 5-16: PROGRAMMING THE PROGRAMMING EXECUTIVE (TWO-WORD LATCH WRITES)

Command(Binary)

Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register for writing to the latches.00000000

200FAC8802AC

MOV #0xFA, W12MOV W12, TBLPAG

Step 3: Load W0:W2 with the next two packed instruction words to program.000000000000

2xxxx02xxxx12xxxx2

MOV #<LSW0>, W0MOV #<MSB1:MSB0>, W1MOV #<LSW1>, W2

Step 4: Set the Read Pointer (W6) and the Write Pointer (W7), and load the write latches.0000000000000000000000000000000000000000000000000000000000000000

EB0300000000EB0380000000BB0BB6000000000000BBDBB6000000000000BBEBB6000000000000BB0B96000000000000

CLR W6NOPCLR W7NOPTBLWTL [W6++], [W7] NOPNOPTBLWTH.B [W6++], [W7++] NOPNOPTBLWTH.B [W6++], [++W7] NOPNOPTBLWTL.W [W6], [W7] NOP NOP

Step 5: Set the NVMADRU/NVMADR register pair to point to the correct row.0000000000000000

2xxxx32xxxx48846938846A4

MOV #DestinationAddress<15:0>, W3MOV #DestinationAddress<23:16>, W4MOV W3, NVMADRMOV W4, NVMADRU

Step 6: Set the NVMCON register to program two instruction words.00000000000000000000

24001A00000088468A000000000000

MOV #0x4001, W10NOPMOV W10, NVMCONNOPNOP

2018 Microchip Technology Inc. DS70005352C-page 51

Page 52: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 7: Initiate the write cycle.0000000000000000000000000000000000000000

2005518846B1200AA18846B1A8F1A1000000000000000000000000000000

MOV #0x55, W1MOV W1, NVMKEYMOV #0xAA, W1MOV W1, NVMKEYBSET NVMCON, #WRNOPNOPNOPNOPNOP

Step 8: Wait for program operation to complete and make sure the WR bit is clear.0000000000000000000000010000000000000000000000000000

000000804680000000887E60000000<VISI>000000000000000000040200000000000000000000

NOPMOV NVMCON, W0NOPMOV W0, VISINOPClock out contents of the VISI register.NOPNOPNOPGOTO 0x200NOPNOPNOPRepeat until the WR bit is clear.

Step 9: Repeat Steps 3-8 until all code memory is programmed.

TABLE 5-16: PROGRAMMING THE PROGRAMMING EXECUTIVE (TWO-WORD LATCH WRITES) (CONTINUED)

Command(Binary)

Data(Hex) Description

DS70005352C-page 52 2018 Microchip Technology Inc.

Page 53: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.4.4 READING EXECUTIVE MEMORYReading from executive memory is performed byexecuting a series of TBLRD instructions and clockingout the data using the REGOUT command.

Table 5-17 provides the ICSP programming details forreading executive memory.

To minimize reading time, the same packed dataformat that the PE uses is utilized. See Section 5.2“Programming Executive Commands” for moredetails on the packed data format.

TABLE 5-17: SERIAL INSTRUCTION EXECUTION FOR READING CODE MEMORYCommand

(Binary)Data(Hex) Description

Step 1: Exit the Reset vector.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200NOPNOPNOP

Step 2: Initialize the TBLPAG register and the Read Pointer (W6) for the TBLRD instruction.000000000000

200xx08802A02xxxx6

MOV #<SourceAddress23:16>, W0MOV W0, TBLPAGMOV #<SourceAddress15:0>, W6

2018 Microchip Technology Inc. DS70005352C-page 53

Page 54: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 3: Initialize the Write Pointer (W7) and store the next four locations of code memory to W0:W5.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

EB0380000000BA1B96000000000000000000000000000000BADBB6000000000000000000000000000000BADBD6000000000000000000000000000000BA1BB6000000000000000000000000000000BA1B96000000000000000000000000000000BADBB6000000000000000000000000000000BADBD6000000000000000000000000000000BA0BB6000000000000000000000000000000

CLR W7 NOPTBLRDL [W6], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [W6++], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [++W6], [W7++] NOPNOPNOPNOPNOPTBLRDL [W6++], [W7++] NOPNOPNOPNOPNOPTBLRDL [W6], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [W6++], [W7++] NOPNOPNOPNOPNOPTBLRDH.B [++W6], [W7++] NOPNOPNOPNOPNOPTBLRDL [W6++], [W7] NOPNOPNOPNOPNOP

TABLE 5-17: SERIAL INSTRUCTION EXECUTION FOR READING CODE MEMORY (CONTINUED)Command

(Binary)Data(Hex) Description

DS70005352C-page 54 2018 Microchip Technology Inc.

Page 55: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

Step 4: Output W0:W5 using the VISI register and REGOUT command.000000000001000000000000000100000000000000010000000000000001000000000000000100000000000000010000

887E60000000<VISI>000000887E61000000<VISI>000000887E62000000<VISI>000000887E63000000<VISI>000000887E64000000<VISI>000000887E65000000<VISI>000000

MOV W0, VISI NOPClock out contents of the VISI register.NOPMOV W1, VISI NOPClock out contents of the VISI register.NOPMOV W2, VISI NOPClock out contents of the VISI register.NOPMOV W3, VISI NOPClock out contents of the VISI register.NOPMOV W4, VISI NOPClock out contents of the VISI register.NOPMOV W5, VISI NOPClock out contents of the VISI register.NOP

Step 5: Reset the device’s internal PC.0000000000000000000000000000

000000000000000000040200000000000000000000

NOPNOPNOPGOTO 0x200 NOPNOPNOP

Step 6: Repeat Steps 3-5 until all desired code memory is read.

TABLE 5-17: SERIAL INSTRUCTION EXECUTION FOR READING CODE MEMORY (CONTINUED)Command

(Binary)Data(Hex) Description

2018 Microchip Technology Inc. DS70005352C-page 55

Page 56: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

5.4.5 PROGRAMMING VERIFICATIONThe verification is performed by reading back theexecutive memory space and comparing it against thecopy held in the programmer’s buffer.

The verification process is shown in Figure 5-7. Thelower word of the instruction is read, and then the lowerbyte of the upper word is read and compared against theinstruction stored in the programmer’s buffer. Referto Section 5.4.4 “Reading Executive Memory” forimplementation details of reading executive memory.

FIGURE 5-7: VERIFY PROGRAMMING EXECUTIVE MEMORY FLOW

Read Low Word

Read High Byte

Does

= ExpectedData?

AllExecutive Memory

Verified?

No

Yes

No

Set TBLPAG = 0

Start

Yes

End

with Post-Increment

with Post-Increment

FailureReport Error

Instruction Word

DS70005352C-page 56 2018 Microchip Technology Inc.

Page 57: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

6.0 DEVICE ID/UNIQUE IDThe Device ID region of memory can be used todetermine variant and manufacturing information aboutthe chip. This region of memory is read-only and can beread when code protection is enabled.

Table 6-1 lists the identification information for eachdevice. Table 6-2 shows the Device ID registers.Table 6-3 shows that the JTAG ID is generated given adevice DEVREV and DEVID.

TABLE 6-2: DEVICE ID REGISTERS

6.1 Unique Device ID (UDID)All dsPIC33CK64MP105 family devices are individuallyencoded during final manufacturing with a UniqueDevice Identifier or UDID. The UDID cannot be erasedby a Bulk Erase command or any other user-accessiblemeans. This feature allows for manufacturing trace-ability of Microchip Technology devices in applicationswhere this is a requirement. It may also be used by theapplication manufacturer for any number of things thatmay require unique identification, such as:

• Tracking the device• Unique serial number• Unique security key

The UDID comprises five 24-bit program words. Whentaken together, these fields form a unique 120-bitidentifier. The UDID is stored in five read-only locationsin the device configuration space. Table 6-4 lists theaddresses of the Identifier Words and shows theircontents.

TABLE 6-1: DEVICE IDs FOR THE dsPIC33CK64MP105 FAMILY

Device DEVID

dsPIC33CK32MP102 0x8E00

dsPIC33CK32MP103 0x8E01

dsPIC33CK32MP105 0x8E02

dsPIC33CK64MP102 0x8E10

dsPIC33CK64MP103 0x8E11

dsPIC33CK64MP105 0x8E12

Address NameBit

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

0xFF0000 DEVID DEVID Value0xFF0002 DEVREV DEVREV Value

TABLE 6-3: JTAG ID31 28 27 12 11 0

DEVREV<3:0> DEVID<15:0> Manufacturer ID (0x053)4 bits 16 bits 12 bits

TABLE 6-4: UDID ADDRESSESUDID Address Content

UDID1 0x801200 UDID Word 1UDID2 0x801202 UDID Word 2UDID3 0x801204 UDID Word 3UDID4 0x801206 UDID Word 4UDID5 0x801208 UDID Word 5

2018 Microchip Technology Inc. DS70005352C-page 57

Page 58: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

7.0 CHECKSUM COMPUTATIONChecksums for devices are 16 bits in size. The checksumis calculated by summing the following:

• Contents of code memory locations• Contents of Configuration Words

All memory locations, including Configuration Words,are summed by adding all three bytes of each memoryaddress. The checksum is computed “bytewise”, withthe final result truncated to 16 bits. In the dsPIC33architecture, each Flash memory address contains twobytes (if an even address) or one byte (if an oddaddress, since the upper byte is implemented and isalways 0x00). When computing the checksum, both theupper and lower bytes of the word at a given addressshould be added to the running sum, separately asbytes, instead of as a single 16-bit word.

For example, in a program that contains two words withcontents such as:Contents at address 0x0000 = 0xABCDContents at address 0x0001 = 0x00EF

The checksum over the 0x0000:0x0001 region is:0xCD + 0xAB + 0xEF + 0x00 = 0x0267

The CFGB block checksum is also a “bytewise” sum ofall contents of the configuration block address region.The checksum is computed identically to the PROGregion with the exception that some Configurationregisters may require certain bits to be AND maskedout and excluded during the checksum computation.

Table 7-1 describes the Configuration bit masks for eachdevice. Table 7-2 shows examples of the checksumcalculations with the Configuration bits are set to thedefault configuration values after erasing the part.

TABLE 7-1: CONFIGURATION BIT MASKSConfiguration

Register Mask

FSIGN 0xFF7FFFFICD 0xFFFFDF

FDEVOPT 0xFFFCFF

TABLE 7-2: CHECKSUM COMPUTATION EXAMPLE

Device Read CodeProtection Checksum Computation Blank

Value

Value with0xAAAAAA at 0x0

and LastCode Address

dsPIC33CK64MPX0XDisabled PROG[0x0:0xAEFF + CFGB[0xAF00:0xAFFF] 0xF75D 0xF55FEnabled 0x00 0x0000 0x0000

dsPIC33CK32MPX0XDisabled PROG[0x0:0x5EFF + CFGB[0x5F00:0x5FFF] 0x6F5D 0x6D5FEnabled 0x00 0x0000 0x0000

Legend: PROG[a:b] = Program memory byte sum of locations, a to b inclusive (all three bytes of code memory).CFGB[c:d] = Configuration memory byte sum of locations, a to b inclusive (all three bytes of configuration memory),

using any read masks shown in Table 7-1.

DS70005352C-page 58 2018 Microchip Technology Inc.

Page 59: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

8.0 AC/DC CHARACTERISTICS AND TIMING REQUIREMENTS

Table 8-1 lists the AC/DC characteristics and timingrequirements.

TABLE 8-1: AC/DC CHARACTERISTICS AND TIMING REQUIREMENTSStandard Operating ConditionsOperating Temperature: -40ºC to +125ºC. Programming at +25ºC is recommended.

Param. No. Symbol Characteristic Min. Max. Units Conditions

D111 VDD Supply Voltage During Programming 3.0 3.60 V Normal programming(1)

D113 IDDP Supply Current During Programming — 10 mAD114 IPEAK Instantaneous Peak Current During Start-up — 200 mAD031 VIL Input Low Voltage VSS 0.2 VDD VD041 VIH Input High Voltage 0.7 VDD VDD VD080 VOL Output Low Voltage — 0.4 VD090 VOH Output High Voltage 2.4 — VD012 CIO Capacitive Loading on I/O Pin (PGEDx) — 50 pFP1 TPGC Serial Clock (PGECx) Period (ICSP™) 200 — nsP1 TPGC Serial Clock (PGECx) Period

(Enhanced ICSP)500 — ns

P1A TPGCL Serial Clock (PGECx) Low Time (ICSP) 80 — nsP1A TPGCL Serial Clock (PGECx) Low Time

(Enhanced ICSP)200 — ns

P1B TPGCH Serial Clock (PGECx) High Time (ICSP) 80 — nsP1B TPGCH Serial Clock (PGECx) High Time

(Enhanced ICSP)200 — ns

P2 TSET1 Input Data Setup Time to Serial Clock 15 — nsP3 THLD1 Input Data Hold Time from PGECx 15 — nsP4 TDLY1 Delay Between 4-Bit Command and

Command Operand40 — ns

P4A TDLY1A Delay Between Command Operand and Next 4-Bit Command

40 — ns

P5 TDLY2 Delay Between Last PGECx of Command to First PGECx of Read of Data Word

20 — ns

P6 TSET2 VDD Setup Time to MCLR 100 — ns

P7 THLD2 Input Data Hold Time from MCLR 50 — msP8 TDLY3 Delay Between Last PGECx of Command

Byte to PGEDx by PE12 — µs

Note 1: VDD must also be supplied to the AVDD pins during programming. AVDD and AVSS should always be within ±0.3V of VDD and VSS, respectively.

2: Time depends on the FRC accuracy and the value of the FRC Oscillator Tuning register. Refer to the “Electrical Characteristics” chapter in the specific device data sheet.

2018 Microchip Technology Inc. DS70005352C-page 59

Page 60: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

P9A TDLY4 Programming Executive Command Processing Time

10 — µs

P9B TDLY5 Delay Between PGEDx by Programming Executive to PGEDx Released by Programming Executive

15 23 µs

P10 TDLY6 PGECx Low Time After Programming 400 — nsP11 TDLY7 Bulk Erase Time — 20 ms See Note 2P12 TDLY8 Page Erase Time — 20 ms See Note 2P13 TDLY9 Double-Word Write Time — 20 µs See Note 2

Row Write Time 1.28 ms See Note 2P14 TR MCLR Rise Time to Enter ICSP mode — 1.0 µsP15 TVALID Data Out Valid from PGECx 10 — ns

P16 TDLY10 Delay Between Last PGECx and MCLR 0 — s

P17 THLD3 MCLR to VDD 100 — ns

P18 TKEY1 Delay from First MCLR to First PGECx for Key Sequence on PGEDx

1 — ms

P19 TKEY2 Delay from Last PGECx for Key Sequence on PGEDx to Second MCLR

25 — ns

P21 TMCLRH MCLR High Time — 500 µs

TABLE 8-1: AC/DC CHARACTERISTICS AND TIMING REQUIREMENTS (CONTINUED)Standard Operating ConditionsOperating Temperature: -40ºC to +125ºC. Programming at +25ºC is recommended.

Param. No. Symbol Characteristic Min. Max. Units Conditions

Note 1: VDD must also be supplied to the AVDD pins during programming. AVDD and AVSS should always be within ±0.3V of VDD and VSS, respectively.

2: Time depends on the FRC accuracy and the value of the FRC Oscillator Tuning register. Refer to the “Electrical Characteristics” chapter in the specific device data sheet.

DS70005352C-page 60 2018 Microchip Technology Inc.

Page 61: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

APPENDIX A: REVISION HISTORYRevision A (January 2018)

Original version of the programming specification createdfor the dsPIC33CK64MP105 family devices.

Revision B (August 2018)

Added FDEVOPT<7> to Section 2.6 “ConfigurationBits”.

Removed FBTSEQ register from Table 2-4 and Table 2-5.

Removed BSSO and IBSEQ bits from Table 2-5.

Removed the DEVREV and Silicon Revisions columnsfrom Table 6-1.

Revision C (November 2018)

Added SMB3EN bit to Table 2-6.

Added FDEVOPT configuration register to Table 7-1.

Updated Table 7-2.

2018 Microchip Technology Inc. DS70005352C-page 61

Page 62: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

dsPIC33CK64MP105 FAMILY

NOTES:

DS70005352C-page 62 2018 Microchip Technology Inc.

Page 63: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

Note the following details of the code protection feature on Microchip devices:• Microchip products meet the specification contained in their particular Microchip Data Sheet.

• Microchip believes that its family of products is one of the most secure families of its kind on the market today, when used in the intended manner and under normal conditions.

• There are dishonest and possibly illegal methods used to breach the code protection feature. All of these methods, to our knowledge, require using the Microchip products in a manner outside the operating specifications contained in Microchip’s Data Sheets. Most likely, the person doing so is engaged in theft of intellectual property.

• Microchip is willing to work with the customer who is concerned about the integrity of their code.

• Neither Microchip nor any other semiconductor manufacturer can guarantee the security of their code. Code protection does not mean that we are guaranteeing the product as “unbreakable.”

Code protection is constantly evolving. We at Microchip are committed to continuously improving the code protection features of ourproducts. Attempts to break Microchip’s code protection feature may be a violation of the Digital Millennium Copyright Act. If such actsallow unauthorized access to your software or other copyrighted work, you may have a right to sue for relief under that Act.

Information contained in this publication regarding deviceapplications and the like is provided only for your convenienceand may be superseded by updates. It is your responsibility toensure that your application meets with your specifications.MICROCHIP MAKES NO REPRESENTATIONS ORWARRANTIES OF ANY KIND WHETHER EXPRESS ORIMPLIED, WRITTEN OR ORAL, STATUTORY OROTHERWISE, RELATED TO THE INFORMATION,INCLUDING BUT NOT LIMITED TO ITS CONDITION,QUALITY, PERFORMANCE, MERCHANTABILITY ORFITNESS FOR PURPOSE. Microchip disclaims all liabilityarising from this information and its use. Use of Microchipdevices in life support and/or safety applications is entirely atthe buyer’s risk, and the buyer agrees to defend, indemnify andhold harmless Microchip from any and all damages, claims,suits, or expenses resulting from such use. No licenses areconveyed, implicitly or otherwise, under any Microchipintellectual property rights unless otherwise stated.

2018 Microchip Technology Inc.

Microchip received ISO/TS-16949:2009 certification for its worldwide headquarters, design and wafer fabrication facilities in Chandler and Tempe, Arizona; Gresham, Oregon and design centers in California and India. The Company’s quality system processes and procedures are for its PIC® MCUs and dsPIC® DSCs, KEELOQ® code hopping devices, Serial EEPROMs, microperipherals, nonvolatile memory and analog products. In addition, Microchip’s quality system for the design and manufacture of development systems is ISO 9001:2000 certified.

QUALITY MANAGEMENT SYSTEM CERTIFIED BY DNV

== ISO/TS 16949 ==

TrademarksThe Microchip name and logo, the Microchip logo, AnyRate, AVR, AVR logo, AVR Freaks, BitCloud, chipKIT, chipKIT logo, CryptoMemory, CryptoRF, dsPIC, FlashFlex, flexPWR, Heldo, JukeBlox, KeeLoq, Kleer, LANCheck, LINK MD, maXStylus, maXTouch, MediaLB, megaAVR, MOST, MOST logo, MPLAB, OptoLyzer, PIC, picoPower, PICSTART, PIC32 logo, Prochip Designer, QTouch, SAM-BA, SpyNIC, SST, SST Logo, SuperFlash, tinyAVR, UNI/O, and XMEGA are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.ClockWorks, The Embedded Control Solutions Company, EtherSynch, Hyper Speed Control, HyperLight Load, IntelliMOS, mTouch, Precision Edge, and Quiet-Wire are registered trademarks of Microchip Technology Incorporated in the U.S.A.Adjacent Key Suppression, AKS, Analog-for-the-Digital Age, Any Capacitor, AnyIn, AnyOut, BodyCom, CodeGuard, CryptoAuthentication, CryptoAutomotive, CryptoCompanion, CryptoController, dsPICDEM, dsPICDEM.net, Dynamic Average Matching, DAM, ECAN, EtherGREEN, In-Circuit Serial Programming, ICSP, INICnet, Inter-Chip Connectivity, JitterBlocker, KleerNet, KleerNet logo, memBrain, Mindi, MiWi, motorBench, MPASM, MPF, MPLAB Certified logo, MPLIB, MPLINK, MultiTRAK, NetDetach, Omniscient Code Generation, PICDEM, PICDEM.net, PICkit, PICtail, PowerSmart, PureSilicon, QMatrix, REAL ICE, Ripple Blocker, SAM-ICE, Serial Quad I/O, SMART-I.S., SQI, SuperSwitcher, SuperSwitcher II, Total Endurance, TSHARC, USBCheck, VariSense, ViewSpan, WiperLock, Wireless DNA, and ZENA are trademarks of Microchip Technology Incorporated in the U.S.A. and other countries.SQTP is a service mark of Microchip Technology Incorporated in the U.S.A.Silicon Storage Technology is a registered trademark of Microchip Technology Inc. in other countries.GestIC is a registered trademark of Microchip Technology Germany II GmbH & Co. KG, a subsidiary of Microchip Technology Inc., in other countries. All other trademarks mentioned herein are property of their respective companies.© 2018, Microchip Technology Incorporated, All Rights Reserved.

ISBN: 978-1-5224-3907-3

DS70005352C-page 63

Page 64: dsPIC33CK64MP105 Family Flash Programming Specificationww1.microchip.com/downloads/en/DeviceDoc/70005352c.pdf · 8/15/2018  · dsPIC33CK64MP105 FAMILY DS70005352C-page 4 2018 Microchip

DS70005352C-page 64 2018 Microchip Technology Inc.

AMERICASCorporate Office2355 West Chandler Blvd.Chandler, AZ 85224-6199Tel: 480-792-7200 Fax: 480-792-7277Technical Support: http://www.microchip.com/supportWeb Address: www.microchip.comAtlantaDuluth, GA Tel: 678-957-9614 Fax: 678-957-1455Austin, TXTel: 512-257-3370 BostonWestborough, MA Tel: 774-760-0087 Fax: 774-760-0088ChicagoItasca, IL Tel: 630-285-0071 Fax: 630-285-0075DallasAddison, TX Tel: 972-818-7423 Fax: 972-818-2924DetroitNovi, MI Tel: 248-848-4000Houston, TX Tel: 281-894-5983IndianapolisNoblesville, IN Tel: 317-773-8323Fax: 317-773-5453Tel: 317-536-2380Los AngelesMission Viejo, CA Tel: 949-462-9523Fax: 949-462-9608Tel: 951-273-7800 Raleigh, NC Tel: 919-844-7510New York, NY Tel: 631-435-6000San Jose, CA Tel: 408-735-9110Tel: 408-436-4270Canada - TorontoTel: 905-695-1980 Fax: 905-695-2078

ASIA/PACIFICAustralia - SydneyTel: 61-2-9868-6733China - BeijingTel: 86-10-8569-7000 China - ChengduTel: 86-28-8665-5511China - ChongqingTel: 86-23-8980-9588China - DongguanTel: 86-769-8702-9880 China - GuangzhouTel: 86-20-8755-8029 China - HangzhouTel: 86-571-8792-8115 China - Hong Kong SARTel: 852-2943-5100 China - NanjingTel: 86-25-8473-2460China - QingdaoTel: 86-532-8502-7355China - ShanghaiTel: 86-21-3326-8000 China - ShenyangTel: 86-24-2334-2829China - ShenzhenTel: 86-755-8864-2200 China - SuzhouTel: 86-186-6233-1526 China - WuhanTel: 86-27-5980-5300China - XianTel: 86-29-8833-7252China - XiamenTel: 86-592-2388138 China - ZhuhaiTel: 86-756-3210040

ASIA/PACIFICIndia - BangaloreTel: 91-80-3090-4444 India - New DelhiTel: 91-11-4160-8631India - PuneTel: 91-20-4121-0141Japan - OsakaTel: 81-6-6152-7160 Japan - TokyoTel: 81-3-6880- 3770 Korea - DaeguTel: 82-53-744-4301Korea - SeoulTel: 82-2-554-7200Malaysia - Kuala LumpurTel: 60-3-7651-7906Malaysia - PenangTel: 60-4-227-8870Philippines - ManilaTel: 63-2-634-9065SingaporeTel: 65-6334-8870Taiwan - Hsin ChuTel: 886-3-577-8366Taiwan - KaohsiungTel: 886-7-213-7830Taiwan - TaipeiTel: 886-2-2508-8600 Thailand - BangkokTel: 66-2-694-1351Vietnam - Ho Chi MinhTel: 84-28-5448-2100

EUROPEAustria - WelsTel: 43-7242-2244-39Fax: 43-7242-2244-393Denmark - CopenhagenTel: 45-4450-2828 Fax: 45-4485-2829Finland - EspooTel: 358-9-4520-820France - ParisTel: 33-1-69-53-63-20 Fax: 33-1-69-30-90-79 Germany - GarchingTel: 49-8931-9700Germany - HaanTel: 49-2129-3766400Germany - HeilbronnTel: 49-7131-67-3636Germany - KarlsruheTel: 49-721-625370Germany - MunichTel: 49-89-627-144-0 Fax: 49-89-627-144-44Germany - RosenheimTel: 49-8031-354-560Israel - Ra’anana Tel: 972-9-744-7705Italy - Milan Tel: 39-0331-742611 Fax: 39-0331-466781Italy - PadovaTel: 39-049-7625286 Netherlands - DrunenTel: 31-416-690399 Fax: 31-416-690340Norway - TrondheimTel: 47-7288-4388Poland - WarsawTel: 48-22-3325737 Romania - BucharestTel: 40-21-407-87-50Spain - MadridTel: 34-91-708-08-90Fax: 34-91-708-08-91Sweden - GothenbergTel: 46-31-704-60-40Sweden - StockholmTel: 46-8-5090-4654UK - WokinghamTel: 44-118-921-5800Fax: 44-118-921-5820

Worldwide Sales and Service

08/15/18