2.2.6Port A input/output (I/O) pins (PTA7–PTA0)................................................................................................. 50
2.2.7Port B input/output (I/O) pins (PTB7–PTB0)..................................................................................................50
2.2.8Port C input/output (I/O) pins (PTC7–PTC0)..................................................................................................50
2.2.9Port D input/output (I/O) pins (PTD7–PTD0)................................................................................................. 50
2.2.10Port E input/Output (I/O) pins (PTE7–PTE0)..................................................................................................51
2.2.11Port F input/output (I/O) pins (PTF7–PTF0)................................................................................................... 51
2.2.12Port G input/output (I/O) pins (PTG3–PTG0)................................................................................................. 51
2.2.13Port H input/output (I/O) pins (PTH7–PTH6, PTH2–PTH0).......................................................................... 51
2.2.14True open drain pins (PTA3–PTA2)................................................................................................................51
3.3Low voltage detect (LVD) system..................................................................................................................................58
3.5Power management control bits and registers................................................................................................................ 60
3.5.1System Power Management Status and Control 1 Register (PMC_SPMSC1)................................................60
3.5.2System Power Management Status and Control 2 Register (PMC_SPMSC2)................................................62
4.2Reset and interrupt vector assignments...........................................................................................................................64
4.3Register addresses and bit assignments.......................................................................................................................... 65
4.5Flash and EEPROM........................................................................................................................................................77
4.5.2.8Flash and EEPROM commands.....................................................................................................93
4.5.2.9Flash and EEPROM command summary...................................................................................... 95
4.6Flash and EEPROM registers descriptions.....................................................................................................................109
5.1.2Interrupt vectors, sources, and local masks......................................................................................................123
5.3.1Interrupt Pin Request Status and Control Register (IRQ_SC).........................................................................132
5.4Interrupt priority control register.................................................................................................................................... 133
5.4.1IPC Status and Control Register (IPC_SC)......................................................................................................134
6.3Reset and system initialization........................................................................................................................................137
6.6System Control Registers................................................................................................................................................143
6.6.1System Reset Status Register (SYS_SRS).......................................................................................................143
6.6.2System Background Debug Force Reset Register (SYS_SBDFR)..................................................................145
6.6.3System Device Identification Register: High (SYS_SDIDH)......................................................................... 146
7.2Port data and data direction.............................................................................................................................................159
7.5High current drive...........................................................................................................................................................161
7.6Pin behavior in stop mode...............................................................................................................................................161
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.7
Page 8
Section numberTitlePage
7.7Port data registers............................................................................................................................................................161
7.7.1Port A Data Register (PORT_PTAD)..............................................................................................................162
7.7.2Port B Data Register (PORT_PTBD).............................................................................................................. 163
7.7.3Port C Data Register (PORT_PTCD).............................................................................................................. 163
7.7.4Port D Data Register (PORT_PTDD)..............................................................................................................164
7.7.5Port E Data Register (PORT_PTED)...............................................................................................................164
7.7.6Port F Data Register (PORT_PTFD)............................................................................................................... 165
7.7.7Port G Data Register (PORT_PTGD)..............................................................................................................165
7.7.8Port H Data Register (PORT_PTHD)..............................................................................................................166
7.7.9Port High Drive Enable Register (PORT_HDRVE)........................................................................................167
7.7.10Port A Output Enable Register (PORT_PTAOE)............................................................................................168
7.7.11Port B Output Enable Register (PORT_PTBOE)............................................................................................ 169
7.7.12Port C Output Enable Register (PORT_PTCOE)............................................................................................ 170
7.7.13Port D Output Enable Register (PORT_PTDOE)............................................................................................172
7.7.14Port E Output Enable Register (PORT_PTEOE).............................................................................................173
7.7.15Port F Output Enable Register (PORT_PTFOE)............................................................................................. 174
7.7.16Port G Output Enable Register (PORT_PTGOE)............................................................................................175
7.7.17Port H Output Enable Register (PORT_PTHOE)............................................................................................176
7.7.18Port A Input Enable Register (PORT_PTAIE)................................................................................................ 177
7.7.19Port B Input Enable Register (PORT_PTBIE)................................................................................................ 178
7.7.20Port C Input Enable Register (PORT_PTCIE)................................................................................................ 179
7.7.21Port D Input Enable Register (PORT_PTDIE)................................................................................................ 181
7.7.22Port E Input Enable Register (PORT_PTEIE)................................................................................................. 182
7.7.23Port F Input Enable Register (PORT_PTFIE)................................................................................................. 183
7.7.24Port G Input Enable Register (PORT_PTGIE)................................................................................................ 184
7.7.25Port H Input Enable Register (PORT_PTHIE)................................................................................................ 185
8.2.2Modes of operation.......................................................................................................................................... 206
8.2.3FLL lock and clock monitor.............................................................................................................................211
8.6ICS control registers....................................................................................................................................................... 216
8.6.1ICS Control Register 1 (ICS_C1).................................................................................................................... 217
8.6.2ICS Control Register 2 (ICS_C2).................................................................................................................... 218
8.6.3ICS Control Register 3 (ICS_C3).................................................................................................................... 219
8.6.4ICS Control Register 4 (ICS_C4).................................................................................................................... 219
8.6.5ICS Status Register (ICS_S)............................................................................................................................ 220
8.6.6OSC Status and Control Register (ICS_OSCSC)............................................................................................ 221
8.7System clock gating control registers............................................................................................................................. 222
8.7.1System Clock Gating Control 1 Register (SCG_C1).......................................................................................223
8.7.2System Clock Gating Control 2 Register (SCG_C2).......................................................................................224
8.7.3System Clock Gating Control 3 Register (SCG_C3).......................................................................................225
8.7.4System Clock Gating Control 4 Register (SCG_C4).......................................................................................226
9.2.1Central processor unit (CPU)...........................................................................................................................229
9.11.2Touch sense input (TSI)................................................................................................................................... 259
10.2 Programmer's Model and CPU Registers....................................................................................................................... 264
10.3.7Memory to memory Addressing Mode............................................................................................................ 272
10.3.7.1Direct to Direct...............................................................................................................................272
10.3.7.2Immediate to Direct....................................................................................................................... 272
10.3.7.3Indexed to Direct, Post Increment..................................................................................................272
10.3.7.4Direct to Indexed, Post-Increment................................................................................................. 273
10.6 Special Operations.......................................................................................................................................................... 277
10.7 Instruction Set Summary.................................................................................................................................................278
11.1.2Modes of Operation......................................................................................................................................... 291
11.1.2.1KBI in Wait mode..........................................................................................................................291
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.13
Page 14
Section numberTitlePage
11.1.2.2KBI in Stop modes.........................................................................................................................292
11.1.2.3KBI in Active Background mode...................................................................................................292
11.4 Memory Map and Registers............................................................................................................................................293
11.4.1KBI Status and Control Register (KBIx_SC).................................................................................................. 294
11.5.2Edge and level sensitivity................................................................................................................................ 296
12.1.3Modes of operation.......................................................................................................................................... 301
12.2 Signal description............................................................................................................................................................304
12.3.3Status and Control (FTMx_SC)....................................................................................................................... 309
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
14Freescale Semiconductor, Inc.
Page 15
Section numberTitlePage
12.3.4Counter High (FTMx_CNTH)......................................................................................................................... 310
12.3.6Modulo High (FTMx_MODH)........................................................................................................................ 311
12.3.8Channel Status and Control (FTMx_CnSC).................................................................................................... 312
12.3.9Channel Value High (FTMx_CnVH)...............................................................................................................315
12.3.10 Channel Value Low (FTMx_CnVL)................................................................................................................316
12.3.11 Counter Initial Value High (FTMx_CNTINH)................................................................................................ 316
12.3.12 Counter Initial Value Low (FTMx_CNTINL)................................................................................................. 317
12.3.13 Capture and Compare Status (FTMx_STATUS)............................................................................................. 317
12.3.14 Features Mode Selection (FTMx_MODE)...................................................................................................... 319
12.3.22 Fault Mode Status (FTMx_FMS).....................................................................................................................331
12.3.23 Input Capture Filter Control (FTMx_FILTERn)............................................................................................. 332
12.3.24 Fault Input Filter Control (FTMx_FLTFILTER).............................................................................................333
12.3.25 Fault Input Control (FTMx_FLTCTRL)..........................................................................................................334
12.4.10 Update of the registers with write buffers........................................................................................................358
12.4.17 Features priority............................................................................................................................................... 379
12.4.20 Capture test mode.............................................................................................................................................382
12.4.22.3 Write to SC.....................................................................................................................................392
12.4.22.4 Write to CnSC................................................................................................................................392
13.3 Modes of operation......................................................................................................................................................... 397
13.3.1MTIM in wait mode......................................................................................................................................... 398
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.17
Page 18
Section numberTitlePage
13.3.2MTIM in stop mode......................................................................................................................................... 398
13.3.3MTIM in active background mode.................................................................................................................. 398
13.5 External signal description..............................................................................................................................................399
14.2.1Modes of operation.......................................................................................................................................... 405
14.3 External signal description..............................................................................................................................................406
15.1.2Modes of operation.......................................................................................................................................... 415
15.2 SCI signal descriptions................................................................................................................................................... 418
15.2.1Detailed signal descriptions............................................................................................................................. 418
15.3.3SCI Control Register 1 (SCIx_C1)...................................................................................................................421
15.3.4SCI Control Register 2 (SCIx_C2)...................................................................................................................422
15.3.5SCI Status Register 1 (SCIx_S1)..................................................................................................................... 423
15.3.6SCI Status Register 2 (SCIx_S2)..................................................................................................................... 425
15.3.7SCI Control Register 3 (SCIx_C3)...................................................................................................................427
15.3.8SCI Data Register (SCIx_D)............................................................................................................................ 428
15.4.4Interrupts and status flags................................................................................................................................ 434
15.4.5.1Slow data tolerance........................................................................................................................ 436
15.4.5.2Fast data tolerance..........................................................................................................................437
16.1.2Modes of Operation......................................................................................................................................... 442
16.2 External Signal Description............................................................................................................................................ 444
16.2.1SPSCK — SPI Serial Clock.............................................................................................................................445
16.2.2MOSI — Master Data Out, Slave Data In....................................................................................................... 445
16.2.3MISO — Master Data In, Slave Data Out....................................................................................................... 445
16.3.1SPI control register 1 (SPIx_C1)......................................................................................................................446
16.3.2SPI control register 2 (SPIx_C2)......................................................................................................................448
16.3.4SPI status register (SPIx_S)............................................................................................................................. 450
16.3.5SPI data register (SPIx_D)............................................................................................................................... 451
16.3.6SPI match register (SPIx_M)........................................................................................................................... 452
16.4.8Low Power Mode Options............................................................................................................................... 462
16.4.8.1SPI in Run Mode............................................................................................................................462
16.4.8.2SPI in Wait Mode...........................................................................................................................462
16.4.8.3SPI in Stop Mode........................................................................................................................... 463
17.1.2Modes of operation.......................................................................................................................................... 470
17.2 External signal description..............................................................................................................................................473
17.2.1SPSCK — SPI Serial Clock.............................................................................................................................474
17.2.2MOSI — Master Data Out, Slave Data In....................................................................................................... 474
17.2.3MISO — Master Data In, Slave Data Out....................................................................................................... 474
17.3.4SPI Status Register (SPIx_S)........................................................................................................................... 479
17.3.5SPI data register high (SPIx_DH).................................................................................................................... 482
17.3.6SPI Data Register low (SPIx_DL)................................................................................................................... 483
17.3.7SPI match register high (SPIx_MH)................................................................................................................ 484
17.3.8SPI Match Register low (SPIx_ML)................................................................................................................ 484
17.3.9SPI control register 3 (SPIx_C3)......................................................................................................................485
17.4.10.1 SPI in Run mode............................................................................................................................ 499
17.4.10.2 SPI in Wait mode........................................................................................................................... 499
17.4.10.3 SPI in Stop mode............................................................................................................................500
18.1.2Modes of operation.......................................................................................................................................... 508
18.2 I2C signal descriptions....................................................................................................................................................509
18.3.2I2C Frequency Divider register (I2C_F)..........................................................................................................511
18.3.3I2C Control Register 1 (I2C_C1).....................................................................................................................512
18.3.4I2C Status register (I2C_S).............................................................................................................................. 513
18.3.5I2C Data I/O register (I2C_D)......................................................................................................................... 515
18.3.6I2C Control Register 2 (I2C_C2).....................................................................................................................516
18.4.4System management bus specification............................................................................................................ 528
18.4.6.1Byte transfer interrupt.................................................................................................................... 531
19.2 External Signal Description............................................................................................................................................ 538
19.2.1Analog Power (VDDA)................................................................................................................................... 539
19.2.3Voltage Reference High (VREFH).................................................................................................................. 539
19.3 ADC Control Registers...................................................................................................................................................540
19.3.1Status and Control Register 1 (ADC_SC1)......................................................................................................540
19.3.2Status and Control Register 2 (ADC_SC2)......................................................................................................542
19.3.3Status and Control Register 3 (ADC_SC3)......................................................................................................543
19.3.4Status and Control Register 4 (ADC_SC4)......................................................................................................544
19.3.5Conversion Result High Register (ADC_RH)................................................................................................. 545
19.3.6Conversion Result Low Register (ADC_RL).................................................................................................. 546
19.3.7Compare Value High Register (ADC_CVH)...................................................................................................547
19.3.8Compare Value Low Register (ADC_CVL)....................................................................................................547
19.3.9Pin Control 1 Register (ADC_APCTL1)......................................................................................................... 548
19.3.10 Pin Control 2 Register (ADC_APCTL2)......................................................................................................... 549
19.6.1External pins and routing................................................................................................................................. 564
19.6.2Sources of error................................................................................................................................................ 566
20.1.2Modes of operation.......................................................................................................................................... 571
20.1.2.1Operation in Wait mode.................................................................................................................572
20.1.2.2Operation in Stop3 mode............................................................................................................... 572
20.1.2.3Operation in Debug mode..............................................................................................................572
20.2 External signal description..............................................................................................................................................573
20.3 Memory map and register definition...............................................................................................................................573
20.3.1ACMP Control and Status Register (ACMP_CS)........................................................................................... 574
20.3.2ACMP Control Register 0 (ACMP_C0).......................................................................................................... 575
20.3.3ACMP Control Register 1 (ACMP_C1).......................................................................................................... 575
20.3.4ACMP Control Register 2 (ACMP_C2).......................................................................................................... 576
20.5 Setup and operation of ACMP........................................................................................................................................577
21.1.2Modes of operation.......................................................................................................................................... 580
21.2 External signal description..............................................................................................................................................581
21.4.3Enable TSI module...........................................................................................................................................593
21.4.4Software and hardware trigger......................................................................................................................... 593
21.4.10 End of scan.......................................................................................................................................................595
22.4 Modes of operation......................................................................................................................................................... 604
22.5.9CRC Control Register (CRC_CTRL).............................................................................................................. 609
23.3.1.2Refreshing the Watchdog...............................................................................................................622
23.3.1.3Example code: Refreshing the Watchdog......................................................................................623
23.3.2Configuring the Watchdog...............................................................................................................................623
23.3.2.1Reconfiguring the Watchdog......................................................................................................... 623
23.3.2.2Unlocking the Watchdog............................................................................................................... 624
23.3.2.3Example code: Reconfiguring the Watchdog................................................................................ 624
23.3.6Functionality in debug and low-power modes................................................................................................. 626
23.3.7Fast testing of the watchdog.............................................................................................................................627
23.3.7.1Testing each byte of the counter.................................................................................................... 627
23.3.7.2Entering user mode........................................................................................................................ 628
24.1.1Forcing active background...............................................................................................................................629
24.3 On-chip debug system (DBG)........................................................................................................................................ 637
24.3.1Comparators A and B.......................................................................................................................................638
24.3.2Bus capture information and FIFO operation.................................................................................................. 638
24.3.4Tag vs. force breakpoints and triggers............................................................................................................. 640
25.1.2Modes of operation.......................................................................................................................................... 650
25.2 Signal description............................................................................................................................................................651
25.3 Memory map and registers..............................................................................................................................................651
25.3.1Debug Comparator A High Register (DBG_CAH)......................................................................................... 652
25.3.2Debug Comparator A Low Register (DBG_CAL).......................................................................................... 653
25.3.3Debug Comparator B High Register (DBG_CBH)..........................................................................................654
25.3.4Debug Comparator B Low Register (DBG_CBL)...........................................................................................654
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.31
Page 32
Section numberTitlePage
25.3.5Debug Comparator C High Register (DBG_CCH)..........................................................................................655
25.3.6Debug Comparator C Low Register (DBG_CCL)...........................................................................................656
25.3.7Debug FIFO High Register (DBG_FH)...........................................................................................................656
25.3.9Debug Comparator A Extension Register (DBG_CAX)................................................................................. 658
25.3.10 Debug Comparator B Extension Register (DBG_CBX)..................................................................................659
25.3.11 Debug Comparator C Extension Register (DBG_CCX)..................................................................................660
25.3.12 Debug FIFO Extended Information Register (DBG_FX)................................................................................661
25.3.13 Debug Control Register (DBG_C)...................................................................................................................661
25.3.15 Debug Status Register (DBG_S)......................................................................................................................664
25.3.16 Debug Count Status Register (DBG_CNT)..................................................................................................... 665
25.4.4Trigger break control (TBC)............................................................................................................................ 668
25.4.4.1Begin- and end-trigger................................................................................................................... 669
25.4.4.2Arming the DBG module...............................................................................................................669
These devices are members of the low-cost, high-performance HCS08 family of 8-bit
microcontroller units (MCUs). All MCUs in the family use the enhanced HCS08 central
processor unit and are available with a variety of modules, memory sizes and types, and
package types. The following table summarizes the peripheral availability per package
type for the devices available.
The block diagram below shows the structure of the MCUs.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
36Freescale Semiconductor, Inc.
Page 37
HCS08 CORE
POWER MANAGEMENT
16-CH 12-BIT
ANALOG-TO-DIGITAL
CONVERTER(ADC)
CYCLIC REDUNDANCY
CHECK (CRC)
INTERFACE (TSI)
TOUCH SENSE
(RTC)
REAL-TIME COUNTER
(ACMP)
ANALOG COMPARATOR
CIRCUIT(IIC)
INTER-INTEGRATED
INTERFACE MODULE(SPI1)
16-BIT SERIAL PERIPHERAL
INTERFACE MODULE(SPI0)
8-BIT SERIAL PERIPHERAL
INTERFACE (SCI2)
SERIAL COMMUNICATION
INTERFACE (SCI1)
SERIAL COMMUNICATION
INTERFACE (SCI0)
SERIAL COMMUNICATION
MODULE (FTM2)
6-CH FTM TIMER
MODULE (FTM1)
2-CH FLEX TIMER
MODULE (FTM0)
2-CH FLEX TIMER
(MTIM1)
8-BIT MODULO TIMER
8-BIT MODULO TIMER
(MTIM0)
MODULE (KBI1)
KBYBOARD INTERRUPT
MODULE (KBI0)
KEYBOARD INTERRUPT
PTA1/KBI0P1/FTM0CH1/ACMP1/ADP1
PTA3/KBI0P3/TxD0/SCL
PTA4/ACMPO/BKGD/MS
PTA5/IRQ/TCLK0/RESET
PTA6/FTM2FAULT1/ADP2/TSI0
PTA7/FTM2FAULT2/ADP3/TSI1
PTB0/KBI0P4/RxD0/ADP4/TSI2
PTB1/KBI0P5/TxD0/ADP5/TSI3
PTB2/KBI0P6/SPSCK0/ADP6/TSI4
PTB3/KBI0P7/MOSI0/ADP7/TSI5
PTB4/FTM2CH4/MISO0
PTB5/FTM2CH5/SS0
PTB6/SDA/XTAL
PTB7/SCL/EXTAL
PTC0/FTM2CH0/ADP8/TSI6
PTC1/FTM2CH1/ADP9/TSI7
PTC2/FTM2CH2/ADP10
PTC4/FTM1CH0/RTCO
PTC5/FTM1CH1
PTC3/FTM2CH3/ADP11
PTC6/RxD1/TSI8
PTC7/TxD1/TSI9
PTD0/KBI1P0/FTM2CH2/SPSCK1
PTD1/KBI1P1/FTM2CH3/MOSI1
PTD2/KBI1P2/MISO1/TSI10
PTD3/KBI1P3/SS1/TSI11
PTD4/KBI1P4
PTD5/KBI1P5
PTD6/KBI1P6/RxD2
PTD7/KBI1P7/TxD2
PTE1/MOSI0
PTE2/MISO0
PTE3/SS0
PTE4
PTE5
PTE6
PTE7/TCLK2
PTF0/TSI12
PTF1/TSI13
PTF2/TSI14
PTF3/TSI15
PTF4/ADP12
PTF5/ADP13
PTF6/ADP14
PTF7/ADP15
PTG0
PTG1
PTG2
PTG3
PTH0/FTM2CH0
PTH1/FTM2CH1
PTH2/BUSOUT
PTH6
PTH7
PTE0/SPSCK0/TCLK1
PTA2/KBI0P2/RxD0/SDA
PTA0/KBI0P0/FTM0CH0/ACMP0/ADP0
20 MHz INTERNAL CLOCK
SOURCE (ICS)
EXTERNAL OSCILLATOR
SOURCE (XOSC)
Port A
LVD
1 kHz OSC
WDOG
SS
V
SS
V
REFH
V
REFL
V
DDA
V
SSA
IRQ
XTAL
EXTAL
V
V
V
DD
CPU
BDC
CONTROLLER(IPC)
INTERRUPT PRIORITY
ON-CHIP ICE AND
DEBUG MODUE (DBG)
Port BPort CPort DPort EPort F
USER EEPROM
Port GPort H
USER RAM
CONTROLLER (PMC)
V
SS
DD
MC9S08PT60 = 4,096 bytes
MC9S08PT32 = 4,096 bytes
MC9S08PT60 = 256 bytes
USER FLASH
MC9S08PT32 = 32,768 bytes
MC9S08PT60 = 60,864 bytes
MODULE (
SIM)
SYSTEM INTEGRATION
MC9S08PT32 = 256 bytes
4
2
3
3
3
3
3
3
3
3
5
5
5
1. PTA2 and PTA3 operate as true open drain when working as output.
3. PTB4, PTB5, PTD0, PTD1, PTE0, PTE1, PTH0 and PTH1 can provide high sink/source current drive.
in 32-pin packages.
4. The frequency of the clock from BUSOUT must be equal or less than 10 MHz with 25 pF loading at PAD.
2. PTA4/ACMPO/BKGD/MS is an output-only pin when used as port pin.
5. The secondary power pair of V and V (pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded
DD
SS
SS
1
1
Chapter 1 Device Overview
Figure 1-1. MCU block diagram
Freescale Semiconductor, Inc.37
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 38
ICSLCLK
ICSFFCLK
XTAL
EXTAL
RTC
FTM0
MTIM0
FTM1
MTIM1
FTM2ADC
SPI0
CPU
BDC
IIC
FLASH
ACMP
RAM
LPOCLK
ICS
SCI0
OSC
OSCOUT
1-kHz
LPO
ICSIRCLK
CRC
IPCDBG
2
N
CLKOUT
ICSCLK ()
CLKOE
SCI1
SCI2
SPI1
System Control
KBI0
KBI1
TSI
TCLK0TCLK1
TCLK2
WDOG
~8 MHz after reset
BUSREF
1/2
1
System clock distribution
1.3System clock distribution
These series contain three on-chip clock sources:
• Internal clock source (ICS) module — The main clock source generator providing
bus clock and other reference clocks to peripherals
• External oscillator (XOSC) module — The external oscillator providing reference
clock to internal clock source (ICS), the real-time clock counter clock module (RTC)
and other MCU sub-systems.
• Low-power oscillator (LPO) module — The on-chip low-power oscillator providing
1 kHz reference clock to RTC and watchdog (WDOG).
NOTE
For this device, the system clock is the bus clock.
The following figure shows a simplified clock connection diagram.
Figure 1-2. System clock distribution diagram
The clock system supplies:
38Freescale Semiconductor, Inc.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 39
Chapter 1 Device Overview
• ICSCLK(BUS) — This up to 20 MHz clock source is used as the bus clock that is
the reference to CPU and all peripherals. Control bits in the ICS control registers
determine which of the clock sources is connected:
• Internal reference clock
• External reference clock
• Frequency-locked loop (FLL) output
• ICSLCLK — This clock source is derived from the digitally controlled oscillator
(DCO) of the ICS when the ICS is configured to run off of the internal or external
reference clock. Development tools can select this internal self-clocked source (8
MHz) to speed up BDC communications in systems where the bus clock is slow.
• ICSIRCLK — This is the internal reference clock and can be selected as the clock
source to the WDOG module.
• ICSFFCLK — This generates the fixed frequency clock (FFCLK) after being
synchronized to the bus clock. It can be selected as clock source to the FTM and
MTIM modules. The frequency of the ICSFFCLK is determined by the setting of the
ICS.
• LPOCLK — This clock is generated from an internal low power oscillator (≈1 kHz)
that is completely independent of the ICS module. The LPOCLK can be selected as
the clock source to the RTC or WDOG modules.
• OSCOUT — This is the direct output of the external oscillator module and can be
selected as the clock source for RTC, WDOG and ADC.
• TCLK0 — This is an optional external clock source for the FTM0 and MTIM0
modules. The TCLK0 must be limited to 1/4th frequency of the bus clock for
synchronization.
• TCLK1 — This is an optional external clock source for the FTM1 and MTIM1
modules. The TCLK1 must be limited to 1/4th frequency of the bus clock for
synchronization.
• TCLK2 — This is an optional external clock source for the FTM2 module. The
TCLK2 must be limited to 1/4th frequency of the bus clock for synchronization.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.39
Page 40
System clock distribution
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
40Freescale Semiconductor, Inc.
Page 41
Chapter 2
Pins and connections
2.1Device pin assignment
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.41
Page 42
PTF0/TSI12
PTF2/TSI14
PTB1/KBI0P5/TxD0/ADP5/TSI3
PTB2/KBI0P6/SPSCK0/ADP6/TSI4
PTF6/ADP14
PTC3/FTM2CH3/ADP11
2. True open drain pins
PTE6
PTG3
PTF1/TSI13
PTF3/TSI15
PTB0/KBI0P4/RxD0/ADP4/TSI2
PTB3/KBI0P7/MOSI0/ADP7/TSI5
PTF4/ADP12
PTF5/ADP13
PTF7/ADP15
PTA7/FTM2FAULT2/ADP3/TSI1
PTA6/FTM2FAULT1/ADP2/TSI0
PTE4
V
SS
V
DD
PTD4/KBI1P4
PTD3/KBI1P3/SS1/TSI11
PTD2/KBI1P2/MISO1/TSI10
PTA3/KBI0P3/TxD0/SCL
2
PTA2/KBI0P2/RxD0/SDA
2
PTG0
PTG2
PTG1
PTA1/KBI0P1/FTM0CH1/ACMP1/ADP1
PTA0/KBI0P0/FTM0CH0/ACMP0/ADP0
PTC7/TxD1/TSI9
PTC6/RxD1/TSI8
PTE3/SS0
PTE2/MISO0
PTE1/MOSI0
1
PTE0/SPSCK0/TCLK1
1
PTC5/FTM1CH1
PTC4/FTM1CH0/RTCO
PTA5/IRQ/TCLK0/RESET
PTA4/ACMPO/BKGD/MS
PTD1/KBI1P1/FTM2CH3/MOSI1
1
PTD0/KBI1P0/FTM2CH2/SPSCK1
1
PTH7
PTH6
PTE7/TCLK2
PTH2/BUSOUT
V
DD
V
DDA /V
REFH
V
SSA /V
REFL
V
SS
V
SS
PTB7/SCL/EXTAL
PTB6/SDA/XTAL
PTH1/FTM2CH1
1
PTH0/FTM2CH0
1
PTE5
PTB5/FTM2CH5/SS0
1
PTB4/FTM2CH4/MISO0
1
PTC2/FTM2CH2/ADP10
PTD7/KBI1P7/TxD2
PTD6/KBI1P6/RxD2
PTD5/KBI1P5
PTC1/FTM2CH1/ADP9/TSI7
PTC0/FTM2CH0/ADP8/TSI6
1. High source/sink current pins
Pins in bold are not available on less pi n-count packages.
37
17
18
19
20
212223242526272829
303132
1
2
3
4
5
6
7
8
9
10
12
11
13
14
15
16
39
40
38
36
35
34
33
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
595860
61
62
63
64
Device pin assignment
Figure 2-1. MC9S08PT60 64-pin QFP and LQFP package
42Freescale Semiconductor, Inc.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 43
PTB1/KBI0P5/TxD0/ADP5/TSI3
PTC3/FTM2CH3/ADP11
2. True open drain pins
PTE6
PTB0/KBI0P4/RxD0/ADP4/TSI2
PTB3/KBI0P7/MOSI0/ADP7/TSI5
PTA7/FTM2FAULT2/ADP3/TSI1
PTA6/FTM2FAULT1/ADP2/TSI0
PTE4
V
SS
V
DD
PTD4/KBI1P4
PTD3/KBI1P3/SS1/TSI11
PTD2/KBI1P2/MISO1/TSI10
PTA3/KBI0P3/TxD0/SCL
2
PTA2/KBI0P2/RxD0/SDA
2
PTA1/KBI0P1/FTM0CH1/ACMP1/ADP1
PTA0/KBI0P0/FTM0CH0/ACMP0/ADP0
PTC7/TxD1/TSI9
PTC6/RxD1/TSI8
PTE3/SS0
PTE2/MISO0
PTE1/MOSI0
1
PTE0/SPSCK0/TCLK1
1
PTC5/FTM1CH1
PTC4/FTM1CH0/RTCO
PTA5/IRQ/TCLK0/RESET
PTA4/ACMPO/BKGD/MS
PTD1/KBI1P1/FTM2CH3/MOSI1
1
PTD0/KBI1P0/FTM2CH2/SPSCK1
1
PTE7/TCLK2
PTH2/BUSOUT
V
DD
V
DDA /V
REFH
V
SSA /V
REFL
V
SS
V
SS
PTB7/SCL/EXTAL
PTB6/SDA/XTAL
PTE5
PTB5/FTM2CH5/SS0
1
PTB4/FTM2CH4/MISO0
1
PTC2/FTM2CH2/ADP10
PTD7/KBI1P7/TxD2
PTD6/KBI1P6/RxD2
PTD5/KBI1P5
PTC1/FTM2CH1/ADP9/TSI7
PTC0/FTM2CH0/ADP8/TSI6
1. High source/sink current pins
Pins in bold are not available on less pi n-count packages.
37
17
18
19
20
212223
24
25
26
27
28
29
30
31
32
1
2
3
4
5
6
7
8
9
10
12
11
13
14
15
16
39
40
38
36
35
34
33
41
42
43
44
45
46
47
48
Chapter 2 Pins and connections
Figure 2-2. MC9S08PT60 48-pin LQFP package
Freescale Semiconductor, Inc.43
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 44
PTB1/KBI0P5/TxD0/ADP5/TSI3
PTC3/FTM2CH3/ADP11
2. True open drain pins
PTB0/KBI0P4/RxD0/ADP4/TSI2
PTB3/KBI0P7/MOSI0/ADP7/TSI5
PTA7/FTM2FAULT2/ADP3/TSI1
PTA6/FTM2FAULT1/ADP2/TSI0
V
SS
V
DD
PTD4/KBI1P4
PTD3/KBI1P3/SS1/TSI11
PTD2/KBI1P2/MISO1/TSI10
PTA2/KBI0P2/RxD0/SDA
2
PTA1/KBI0P1/FTM1CH1/ACMP1/ADP1
PTA0/KBI0P0/FTM0CH0/ACMP0/ADP0
PTC7/TxD1/TSI9
PTC6/RxD1/TSI8
PTE2/MISO0
PTE1/MOSI0
1
PTE0/SPSCK0/TCLK1
1
PTC5/FTM1CH1
PTC4/FTM1CH0/RTCO
PTA5/IRQ/TCLK0/RESET
PTA4/ACMPO/BKGD/MS
PTD1/KBI1P1/FTM2CH3/MOSI1
1
PTD0/KBI1P0/FTM2CH2/SPSCK1
1
PTE7/TCLK2
PTH2/BUSOUT
V
DD
V
DDA /V
REFH
V
SSA /V
REFL
V
SS
V
SS
PTB7/SCL/EXTAL
PTB6/SDA/XTAL
PTB5/FTM2CH5/SS0
1
PTB4/FTM2CH4/MISO0
1
PTC2/FTM2CH2/ADP10
PTD7/KBI1P7/TxD2
PTD6/KBI1P6/RxD2
PTD5/KBI1P5
PTC1/FTM2CH1/ADP9/TSI7
PTC0/FTM2CH0/ADP8/TSI6
1. High source/sink current pins
Pins in bold are not available on less pi n-count packages.
37
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1
2
3
4
5
6
7
8
9
10
12
11
13
14
15
16
39
40
38
36
35
34
33
41
42
43
44
PTA3/KBI0P3/TxD0/SCL2
Device pin assignment
Figure 2-3. MC9S08PT60 44-pin LQFP package
44Freescale Semiconductor, Inc.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 45
PTB1/KBI0P5/TxD0/ADP5/TSI3
PTB2/KBI0P6/SPSCK0/ADP6/TSI4
PTC3/FTM2CH3/ADP11
2. True open drain pins
PTB0/KBI0P4/RxD0/ADP4/TSI2
PTB3/KBI0P7/MOSI0/ADP7/TSI5
PTA7/FTM2FAULT2/ADP3/TSI1
PTA6/FTM2FAULT1/ADP2/TSI0
PTD3/KBI1P3/SS1/TSI11
PTD2/KBI1P2/MISO1/TSI10
PTA2/KBI0P2/RxD0/SDA
2
PTA1/KBI0P1/FTM0CH1/ACMP1/ADP1
PTA0/KBI0P0/FTM0CH0/ACMP0/ADP0
PTC7/TxD1/TSI9
PTC6/RxD1/TSI8
PTC5/FTM1CH1
PTC4/FTM1CH0/RTCO
PTA5/IRQ/TCLK0/RESET
PTA4/ACMPO/BKGD/MS
PTD1/KBI1P1/FTM2CH3/MOSI1
1
PTD0/KBI1P0/FTM2CH2/SPSCK1
1
V
DD
V
DDA /V
REFH
V
SSA /V
REFL
V
SS
PTB7/SCL/EXTAL
PTB6/SDA/XTAL
PTB5/FTM2CH5/SS0
1
PTB4/FTM2CH4/MISO0
1
PTC2/FTM2CH2/ADP10
PTC1/FTM2CH1/ADP9/TSI7
PTC0/FTM2CH0/ADP8/TSI6
1. High source/sink current pins
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
1
2
3
4
5
6
7
8
9
10
12
11
13
14
15
16
PTA3/KBI0P3/TxD0/SCL2
Chapter 2 Pins and connections
2.2
2.2.1
VDD and VSS are the primary power supply pins for the MCU. This voltage source
supplies power to all I/O buffer circuitry and to an internal voltage regulator. The internal
voltage regulator provides a regulated lower-voltage source to the CPU and to the MCU's
other internal circuitry.
Pin functions
Freescale Semiconductor, Inc.45
Figure 2-4. MC9S08PT60 32-pin LQFP package
Power (VDD, VSS)
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 46
MCU
C1
C2
V
DD
V
ss
V
0.1
F
MCU
C1
V
DDA /V
REFH
V
SSA /V
REFL
F
0.1
External reference voltage
Pin functions
Typically, application systems have two separate capacitors across the power pins. In this
case, there should be a bulk electrolytic capacitor, such as a 10 µF tantalum capacitor,
that provides bulk charge storage for the overall system and a 0.1 µF ceramic bypass
capacitor located as near to the paired VDD and VSS power pins as practical to suppress
high-frequency noise.
Figure 2-5. Power supply bypassing
2.2.2
V
DDA
Connect the V
Analog power supply and reference pins (V
V
SSA/VREFL
and V
are the power supply pins for the analog-to-digital converter (ADC).
SSA
DDA
)
pin to the same voltage potential as VDD, and the V
DDA/VREFH
pin to the same
SSA
voltage potential as VSS.
De-coupling of these pins should be as per the digital supply. A 0.1 µF ceramic bypass
capacitor should be located as near to the MCU power pins as practical to suppress highfrequency noise.
V
V
is the high reference supply for the ADC, and is internally connected to V
REFH
is the low reference supply for the ADC, and is internally connected to V
REFL
Figure 2-6. Analog power supply bypassing
and
DDA
.
SSA
.
46Freescale Semiconductor, Inc.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 47
MCU
EXTAL
XTAL
R
s
R
F
C1
C2
X1
Chapter 2 Pins and connections
2.2.3Oscillator (XTAL, EXTAL)
The XTAL and EXTAL pins are used to provide the connections for the on-chip
oscillator. The oscillator (XOSC) in this MCU is a Pierce oscillator that can
accommodate a crystal or ceramic resonator. Optionally, an external clock source can be
connected to the EXTAL input pin. The oscillator can be configured to run in stop3
mode.
Refer to the following figure, RS (when used) and RF must be low-inductance resistors
such as carbon composition resistors. Wire-wound resistors, and some metal film
resistors, have too much inductance. C1 and C2 normally must be high-quality ceramic
capacitors that are specifically designed for high-frequency applications.
Figure 2-7. Typical crystal or resonator circuit
RF is used to provide a bias path to keep the EXTAL input in its linear range during
crystal startup; its value is not generally critical. Typical systems use 1 M to 10 M.
Higher values are sensitive to humidity and lower values reduce gain and (in extreme
cases) could prevent startup.
C1 and C2 are typically in the 5 pF to 25 pF range and are chosen to match the
requirements of a specific crystal or resonator. Take into account printed circuit board
(PCB) capacitance and MCU pin capacitance when selecting C1 and C2. The crystal
manufacturer typically specifies a load capacitance, which is the series combination of
C1 and C2 (which are usually the same size). As a first-order approximation, use 10 pF as
an estimate of combined pin and PCB capacitance for each oscillator pin (EXTAL and
XTAL).
Freescale Semiconductor, Inc.47
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 48
MCU
V
DD
PTA5/IRQ/TCLK0/RESET
V
SS
F
0.1
4.7k
10k
Pin functions
2.2.4External reset pin (RESET) and interrupt pin (IRQ)
A low on the RESET pin forces the MCU to an known startup state. RESET is
bidirectional, allowing a reset of the entire system. It is driven low when any internal
reset source is asserted. This pin contains an internal pullup resistor.
RESET shares an I/O pin with PTA5. The RESET pin function is enabled by default after
POR reset, because internal power-on reset and low-voltage reset circuitry typically make
external reset circuitry unnecessary. This pin is normally connected to the standard 6-pin
background debug connector so that a development system can directly reset the MCU
system. If RESET function of PTA5/IRQ/TCLK0/RESET pin is enabled, a manual
external reset can be added by supplying a simple switch to ground (pull reset pin low to
force a reset). When the RESET pin function is enabled, an internal pullup resistor is
connected to this pin and a reset signal can feed into MCU with an input hysteresis. POR
reset brings RESET pin into its default configuration, reset other than POR has no effect
on the RESET pin function configuration.
When PTA5/IRQ/TCLK0/
RESET is enabled as IRQ pin, it is the input source for the
IRQ interrupt and is also the input for the BIH and BIL instructions. IRQ is asynchronous
external interrupt pins.
In EMC-sensitive applications, an external RC filter is recommended on the reset pin.
See the following figure for example.
During a power-on-reset (POR) or background debug force reset, the PTA4/ACMPO/
BKGD/MS pin functions as a mode select pin. Immediately after internal reset rises the
pin functions as the background pin and can be used for background debug
communication. While the pin functions as a background/mode selection pin, it includes
an internal pullup device and a standard output driver.
The background debug communication function is enabled when SOPT1[BKGDPE] bit
is set. SOPT1[BKGDPE] is set following any reset of the MCU and must be cleared to
use the PTA4/ACMPO/BKGD/MS pin's alternative pin functions.
If this pin is floating, the MCU will enter normal operating mode at the rising edge of
reset. If a debug system is connected to the 6-pin standard background debug header, it
can hold BKGD/MS low during the POR or immediately after issuing a background
debug force reset, which will force the MCU into active background mode.
The BKGD pin is used primarily for background debug controller (BDC)
communications using a custom protocol that uses 16 clock cycles of the target MCU's
BDC clock per bit time. The target MCU's BDC clock can run as fast as the bus clock, so
there should never be any significant capacitance connected to the BKGD/MS pin that
interferes with background serial communications. When the pin performs output only
PTA4, it can drive only capacitance-limited MOSFET. Driving a bipolar transistor
directly by PTA4 is prohibited because this can cause mode entry fault and BKGD errors.
Although the BKGD pin is a pseudo open-drain pin, the background debug
communication protocol provides brief, actively driven, high speedup pulses to ensure
fast rise time. Small capacitances from cables and the absolute value of the internal
pullup device play almost no role in determining rise and fall time on the BKGD pin.
Freescale Semiconductor, Inc.49
Figure 2-9. Typical debug circuit
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 50
Pin functions
2.2.6Port A input/output (I/O) pins (PTA7–PTA0)
PTA7–PTA0 except PTA4 are general-purpose, bidirectional I/O port pins. These port
pins also have selectable pullup devices when configured for input mode except PTA4.
The pullup devices are selectable on an individual port bit basis. The pulling devices are
disengaged when configured for output mode except when PTA2 and PTA3 are used as
SDA and SCL function.
PTA4 is output only when used as port pin. The pulling device is disabled at this
condition.
PTA3 and PTA2 provide true open drain when operated as output.
2.2.7
PTB7–PTB0 are general-purpose, bidirectional I/O port pins. These port pins also have
selectable pullup devices when configured for input mode, the pullup devices are
selectable on an individual port bit basis. The pulling devices are disengaged when
configured for output mode.
2.2.8
PTC7–PTC0 are general-purpose, bidirectional I/O port pins. These port pins also have
selectable pullup devices when configured for input mode, and the pullup devices are
selectable on an individual port bit basis. The pulling devices are disengaged when
configured for output mode.
2.2.9
PTD7–PTD0 are general-purpose, bidirectional I/O port pins. These port pins also have
selectable pullup devices when configured for input mode, the pullup devices are
selectable on an individual port bit basis. The pulling devices are disengaged when
configured for output mode.
Port B input/output (I/O) pins (PTB7–PTB0)
Port C input/output (I/O) pins (PTC7–PTC0)
Port D input/output (I/O) pins (PTD7–PTD0)
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
50Freescale Semiconductor, Inc.
Page 51
Chapter 2 Pins and connections
2.2.10Port E input/Output (I/O) pins (PTE7–PTE0)
PTE7–PTE0 are general-purpose, bidirectional I/O port pins. These port pins also have
selectable pullup devices when configured for input mode, the pullup devices are
selectable on an individual port bit basis. The pulling devices are disengaged when
configured for output mode.
2.2.11Port F input/output (I/O) pins (PTF7–PTF0)
PTF7–PTF0 are general-purpose, bidirectional I/O port pins. These port pins also have
selectable pullup devices when configured for input mode, the pullup devices are
selectable on an individual port bit basis. The pulling devices are disengaged when
configured for output mode.
2.2.12
PTG3–PTG0 are general-purpose, bidirectional I/O port pins. These port pins also have
selectable pull-up devices when configured for input mode, the pullup devices are
selectable on an individual port bit basis. The pulling devices are disengaged when
configured for output mode.
2.2.13
PTH7–PTH6, PTH2–PTH0 are general-purpose, bidirectional I/O port pins. These port
pins also have selectable pullup devices when configured for input mode, the pullup
devices are selectable on an individual port bit basis. The pulling devices are disengaged
when configured for output mode.
2.2.14
PTA3 and PTA2 operate in true open drain mode.
Port G input/output (I/O) pins (PTG3–PTG0)
Port H input/output (I/O) pins (PTH7–PTH6, PTH2–PTH0)
True open drain pins (PTA3–PTA2)
NOTE
When configuring IIC to use SDA(PTA2) and SCL(PTA3)
pins, if an application uses internal pullups instead of external
pullups, the internal pullups remain present setting when the
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.51
Page 52
Pin functions
pins are configured as outputs, but they are automatically
disabled to save power when the output values are low.
2.2.15High current drive pins (PTB4, PTB5, PTD0, PTD1, PTE0,
PTE1, PTH0, PTH1)
When high current function is enabled, PTB4, PTB5, PTD0, PTD1, PTE0, PTE1, PTH0
and PTH1 can drive output current. Each high current drive pin can drive higher sink/
source current than the other normal pins, please refer to data sheet for the drive capacity.
WARNING
The total sink/source current should be under the chip's
capacity, please refer to data sheet on max current allowed.
2.2.16
Peripheral pinouts
These MCUs support up to 57 general-purpose I/O pins, which are shared with on-chip
peripheral functions (FTM, ACMP, ADC, SCI, SPI, IIC, KBI, etc.). These 57 generalpurpose I/O pins include one output-only pin (PTA4).
When a port pin is configured as general-purpose input, or when a peripheral uses the
port pin as an input, the software can enable a pullup device.
When a high current drive port pin is configured as general-purpose output or when a
peripheral uses the port pin as an output, software can select alternative drive strengths.
For information about controlling these pins as general-purpose I/O pins, see the Parallel
input/output. For information about how and when on-chip peripheral systems use these
pins, see the appropriate module chapter.
Immediately after reset, all pins are configured as high-impedance general-purpose IO
with internal pullup devices disabled.
Table 2-1. Pin availability by package pin-count
Pin NumberLowest Priority <-- --> Highest
64-LQFP
64-QFP
1111PTD1
2222PTD0
3———PTH7————
4———PTH6————
48-LQFP44-LQFP32-LQFPPort PinAlt 1Alt 2Alt 3Alt 4
1
1
KBI1P1FTM2CH3MOSI1—
KBI1P0FTM2CH2SPSCK1—
Table continues on the next page...
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
52Freescale Semiconductor, Inc.
Page 53
Chapter 2 Pins and connections
Table 2-1. Pin availability by package pin-count (continued)
1. This is a high current drive pin when operated as output. Please see High current drive for more information.
2. This is a true open-drain pin when operated as output.
Note
When an alternative function is first enabled, it is possible to
get a spurious edge to the module. User software must clear any
associated flags before interrupts are enabled. The table above
illustrates the priority if multiple modules are enabled. The
highest priority module will have control over the pin. Selecting
a higher priority pin function with a lower priority function
already enabled can cause spurious edges to the lower priority
module. Disable all modules that share a pin before enabling
another module.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
54Freescale Semiconductor, Inc.
Page 55
Chapter 3
Power management
3.1Introduction
The operating modes of the device are described in this chapter. Entry into each mode,
exit from each mode, and functionality while in each of the modes are described.
3.2
These MCUs feature the following power modes:
3.2.1
Features
• Run mode
• Wait mode
• CPU shuts down to conserve power
• Bus clocks are running
• Full voltage regulation is maintained
• Stop3 modes
• System clocks stopped; voltage regulator in standby
• all internal circuits powered for fast recovery
Run mode
This is the normal operating mode. In this mode, the CPU executes code from internal
memory with execution beginning at the address fetched from memory at 0xFFFE:
0xFFFF after reset. The power supply is fully regulating and all peripherals can be active
in run mode.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.55
Page 56
Features
3.2.2Wait mode
Wait mode is entered by executing a WAIT instruction. Upon execution of the WAIT
instruction, the CPU enters a low-power state in which it is not clocked. The I bit in CCR
is cleared when the CPU enters the wait mode, enabling interrupts. When an interrupt
request occurs, the CPU exits the wait mode and resumes processing, beginning with the
stacking operations leading to the interrupt service routine.
While the MCU is in wait mode, there are some restrictions on which background debug
commands can be used. Only the BACKGROUND command and memory-access-withstatus commands are available when the MCU is in wait mode. The memory-access-withstatus commands do not allow memory access, but they report an error indicating that the
MCU is in either stop or wait mode. The BACKGROUND command can be used to
wake the MCU from wait mode and enter active background mode.
3.2.3
Stop3 mode
To enter stop3, the user must execute a STOP instruction with stop mode enabled
(SOPT1[STOPE] = 1). Upon entering the stop3 mode, all of the clocks in the MCU are
halted by default, but OSC clock and internal reference clock can be turned on by setting
the ICS control registers. The ICS enters its standby state, as does the voltage regulator
and the ADC. The states of all of the internal registers and logic, as well as the RAM
content, are maintained. The I/O pin states are not latched at the pin. Instead they are
maintained by virtue of the states of the internal logic driving the pins being maintained.
Exit from stop3 is done by asserting reset or through an interrupt. The interrupt include
the asynchronous interrupt from the IRQ or KBI pins, the SCI receive interrupt, the ADC,
ACMP, TSI , IIC or LVI interrupt and the real-time interrupt.
If stop3 is exited by means of the
RESET pin, then the MCU will be reset and operation
will resume after taking the reset vector. Exit by means of an asynchronous interrupt or
the real-time interrupt will result in the MCU taking the appropriate interrupt vector.
The LPO (≈1 kHz) for the real-time counter clock allows a wakeup from stop3 mode with
no external components. When RTC_SC2[RTCPS] is clear, the real-time counter clock
function is disabled.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
56Freescale Semiconductor, Inc.
Page 57
Chapter 3 Power management
3.2.4Active BDM enabled in stop3 mode
Entry into the active background mode from run mode is enabled if the
BDC_SCR[ENBDM] bit is set. This register is described in the development support. If
BDC_SCR[ENBDM] is set when the CPU executes a STOP instruction, the system
clocks to the background debug logic remain active when the MCU enters stop mode, so
background debug communication is still possible. In addition, the voltage regulator does
not enter its low-power standby state but maintains full internal regulation.
Most background commands are not available in stop mode. The memory-access-withstatus commands do not allow memory access, but they report an error indicating that the
MCU is in either stop or wait mode. The BACKGROUND command can be used to
wake the MCU from stop and enter active background mode if the BDC_SCR[ENBDM]
bit is set. After entering background debug mode, all background commands are
available.
3.2.5
LVD enabled in stop mode
The LVD system is capable of generating either an interrupt or a reset when the supply
voltage drops below the LVD voltage. If the LVD is enabled in stop (LVDE and LVDSE
bits in SPMSC1 both set) at the time the CPU executes a STOP instruction, then the
voltage regulator remains active during stop3 mode.
3.2.6
Power modes behaviors
Executing the WAIT or STOP command puts the MCU in a low power consumption
mode for standby situations. The system integration module (SIM) holds the CPU in a
non-clocked state. The operation of each of these modes is described in the following
subsections. Both STOP and WAIT clear the interrupt mask (I) in the condition code
register, allowing interrupt to occur. The following table shows the low power mode
behaviors.
Table 3-1. Low power mode behavior
ModeRunWaitStop3
PMCFull regulationFull regulationLoose regulation
ICSOnOnOptional on
OSCOnOnOptional on
LPOOnOnOn
CPUOnStandbyStandby
FLASHOnOnStandby
Table continues on the next page...
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.57
Page 58
Low voltage detect (LVD) system
Table 3-1. Low power mode behavior (continued)
ModeRunWaitStop3
RAMOnStandbyStandby
ADCOnOnOptional on
ACMPOnOnOptional on
TSIOnOnOptional on
I/OOnOnStates held
SCIOnOnStandby
SPIOnOnStandby
IICOnOnStandby
FTMOnOnStandby
MTIMOnOnStandby
WDOGOnOnOptional on
DBGOnOnStandby
IPCOnOnStandby
CRCOnOnStandby
RTCOnOnOptional on
LVDOnOnOptional on
3.3Low voltage detect (LVD) system
This device includes a system to protect against low voltage conditions in order to protect
memory contents and control MCU system states during supply voltage variations. This
system consists of a power-on reset (POR) circuit and an LVD circuit with a user
selectable trip voltage, either high (V
when SPMSC1[LVDE] is set and the trip voltage is selected by SPMSC2[LVDV]. The
LVD is disabled upon entering the stop modes unless the SPMSC1[LVDSE] bit is set or
active BDM enabled (BDCSCR[ENBDM]=1). If SPMSC1[LVDSE] and
SPMSC1[LVDE] are both set, the current consumption in stop3 with the LVD enabled
will be greater.
LVDH
) or low (V
). The LVD circuit is enabled
LVDL
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
58Freescale Semiconductor, Inc.
Page 59
Bandgap
+
vD
D
v
ss
v
BG
R
1
R
7
LVDV:LVDWV
LVD0
LVD1
LVD
+
LVW
LVW0
LVW1
LVW2
LVW3
Chapter 3 Power management
Figure 3-1. Low voltage detect (LVD) block diagram
3.3.1
Power-on reset (POR) operation
When power is initially applied to the MCU, or when the supply voltage drops below the
V
LVD circuit will hold the chip in reset until the supply has risen above the V
level, the POR circuit will cause a reset condition. As the supply voltage rises, the
POR
LVDL
level.
Both the SRS[POR] and SRS[LVD] are set following a POR.
3.3.2
LVD reset operation
The LVD can be configured to generate a reset upon detection of a low voltage condition
by setting SPMSC1[LVDRE] to 1. After an LVD reset has occurred, the LVD system
will hold the MCU in reset until the supply voltage has risen above the level determined
by LVDV. The SRS[LVD] bit is set following either an LVD reset or POR.
3.3.3
Low-voltage warning (LVW)
The LVD system has a low voltage warning flag to indicate that the supply voltage is
approaching the LVD voltage. When a low voltage condition is detected and the LVD
circuit is configured for interrupt operation (SPMSC1[LVDE] set, SPMSC1[LVWIE]
set), SPMSC1[LVWF] will be set and LVW interrupt will occur. There are four userselectable trip voltages for the LVW upon each LVDV configuration. The trip voltage is
selected by SPMSC2[LVWV].
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.59
Page 60
Bandgap reference
3.4Bandgap reference
This device includes an on-chip bandgap reference (≈1.2V) connected to ADC channel
and ACMP. The bandgap reference voltage will not drop under the full operating voltage
even when the operating voltage is falling. This reference voltage acts as an ideal
reference voltage for accurate measurements.
3.5Power management control bits and registers
PMC memory map
Absolute
address
(hex)
3040
3041
Register name
System Power Management Status and Control 1 Register
(PMC_SPMSC1)
System Power Management Status and Control 2 Register
(PMC_SPMSC2)
Width
(in bits)
Access Reset value
8R/W1Ch3.5.1/60
8R/W00h3.5.2/62
Section/
page
3.5.1System Power Management Status and Control 1 Register
(PMC_SPMSC1)
This high page register contains status and control bits to support the low-voltage
detection function, and to enable the bandgap voltage reference for use by the ADC
module. This register should be written during the user's reset initialization program to
set the desired controls, even if the desired settings are the same as the reset settings.
Address:
3040h base + 0h offset = 3040h
Bit76543210
ReadLVWF0
WriteLVWACK
Reset
00011100
LVWIELVDRELVDSELVDEBGBDSBGBE
PMC_SPMSC1 field descriptions
FieldDescription
7
LVWF
60Freescale Semiconductor, Inc.
Low-Voltage Warning Flag
The LVWF bit indicates the low-voltage warning status.
Table continues on the next page...
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 61
PMC_SPMSC1 field descriptions (continued)
FieldDescription
6
LVWACK
5
LVWIE
4
LVDRE
NOTE:
0Low-voltage warning is not present.
1Low-voltage warning is present or was present.
Low-Voltage Warning Acknowledge
If LVWF = 1, a low-voltage condition has occurred. To acknowledge this low-voltage warning, write 1 to
LVWACK, which automatically clears LVWF to 0 if the low-voltage warning is no longer present.
Low-Voltage Warning Interrupt Enable
This bit enables hardware interrupt requests for LVWF.
0Hardware interrupt disabled (use polling).
1Request a hardware interrupt when LVWF = 1.
Low-Voltage Detect Reset Enable
This write-once bit enables LVD events to generate a hardware reset (provided LVDE = 1).
LVWF will be set in the case when V
is already below V
. LVWF bit may be 1 after power on reset, therefore, to use LVW interrupt
LVW
transitions below the trip point or after reset and V
Supply
function, before enabling LVWIE, LVWF must be cleared by writing LVWACK first.
Chapter 3 Power management
Supply
3
LVDSE
2
LVDE
1
BGBDS
0
BGBE
NOTE:
This bit can be written only one time after reset. Additional writes are ignored.
0LVD events do not generate hardware resets.
1Force an MCU reset when an enabled low-voltage detect event occurs.
Low-Voltage Detect Stop Enable
Provided LVDE = 1, this read/write bit determines whether the low-voltage detect function operates when
the MCU is in stop mode.
0Low-voltage detect disabled during stop mode.
1Low-voltage detect enabled during stop mode.
Low-Voltage Detect Enable
This write-once bit enables low-voltage detect logic and qualifies the operation of other bits in this register.
NOTE:
This bit can be written only one time after reset. Additional writes are ignored.
0LVD logic disabled.
1LVD logic enabled.
Bandgap Buffer Drive Select
This bit is used to select the high drive mode of the bandgap buffer.
0Bandgap buffer enabled in low drive mode if BGBE = 1.
1Bandgap buffer enabled in high drive mode if BGBE = 1.
Bandgap Buffer Enable
This bit enables an internal buffer for the bandgap voltage reference for use by the ADC module on one of
its internal channels.
3.5.2System Power Management Status and Control 2 Register
(PMC_SPMSC2)
This register is used to report the status of the low-voltage warning function, and to
configure the stop mode behavior of the MCU. This register should be written during the
user's reset initialization program to set the desired controls, even if the desired settings
are the same as the reset settings.
Address: 3040h base + 1h offset = 3041h
Bit76543210
Read0
Write
Reset
00000000
LVDVLVWV
PMC_SPMSC2 field descriptions
FieldDescription
7
Reserved
6
LVDV
This field is reserved.
This read-only field is reserved and always has the value 0.
Low-Voltage Detect Voltage Select
This write-once bit selects the low-voltage detect (LVD) trip point setting. See data sheet for details.
0
0Low trip point selected (V
1High trip point selected (V
5–4
LVWV
ReservedThis field is reserved.
Low-Voltage Warning Voltage Select
This bit selects the low-voltage warning (LVW) trip point voltage. See data sheet for details.
00Low trip point selected (V
01Middle 1 trip point selected (V
10Middle 2 trip point selected (V
11High trip point selected (V
This read-only field is reserved and always has the value 0.
LVD
LVD
LVW
LVW
= V
= V
= V
= V
LVDL
LVW
LVW
LVDH
LVW1
= V
= V
LVW4
).
).
).
LVW2
LVW3
).
).
).
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
62Freescale Semiconductor, Inc.
Page 63
Chapter 4
Memory map
4.1Memory map
The HCS08 core processor can address 64 KB of memory space. The memory map,
shown in the following figure, includes:
• User flash memory (flash)
• MC9S08PT60: 60,864 bytes; 119 pages of 512 bytes each
• MC9S08PT32: 32,768 bytes; 64 pages of 512 bytes each
• MC9S08PT60: 256 bytes; 128 pages of 2 bytes each
• MC9S08PT32: 256 bytes; 128 pages of 2 bytes each
• Direct-page registers (0x0000 through 0x003F)
• High-page registers (0x3000 through 0x30FF)
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.63
Page 64
52,736B FLASH
32,768B FLASH
VECTOR TABLE
0xFFAF
0xFFB0
0xFFFF
0x8000
0x31FF
0x3100
0x30FF
0x3000
0x103F
0x0040
0x0000
0x003F
0x0000
0x003F
0x0040
0x103F
0x1040
0x2FFF
0x3000
0x30FF
0x3100
0x31FF
0x3200
4096 BYTES RAM
DIRECT PAGE REGISTERS
8,128 BYTES FLASH
HIGH PAGE REGISTERS
256 BYTES EEPROM
VECTOR TABLE
0xFFAF
0xFFB0
0xFFFF
DIRECT PAGE REGISTERS
RAM 4,096 BYTES
HIGH PAGE REGISTERS
256 BYTES EEPROM
UNIMPLEMENTED
UNIMPLEMENTED
MC9S08PT60
MC9S08PT32
Reset and interrupt vector assignments
Figure 4-1. Memory map
4.2
Reset and interrupt vector assignments
The following table shows address assignments for reset and interrupt vectors. The vector
names shown in this table are the labels used in the Freescale-provided header files for
the device.
0xFFF0:FFF1FTM2 channel 1Vftm2ch1
0xFFF2:FFF3FTM2 channel 0Vftm2ch0
0xFFF4:FFF5FTM2 faultVftm2flt
0xFFF6:FFF7Clock loss of lockVclk
0xFFF8:FFF9Low voltage warningVlvw
0xFFFA:FFFBIRQ or WatchdogVirq or Vwdog
0xFFFC:FFFDSWIVswi
0xFFFE:FFFFResetVreset
VectorVector name
4.3Register addresses and bit assignments
The register definitions vary in different memory sizes. The register addresses of unused
peripherals are reserved. The following table shows the register availability of the
devices.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.65
Page 66
Register addresses and bit assignments
Table 4-2. Peripheral registers availability
AddressBytesPeripheral registers
0x0000—0x00078Port data
0x0008—0x000F8TSI
0x0010—0x00178ADC
0x0018—0x001B4MTIM0
The registers in the devices are divided into two groups:
• Direct-page registers are located in the first 64 locations in the memory map, so they
can be accessed with efficient direct addressing mode instructions.
• High-page registers are used much less often, so they are located above 0x3000 in
the memory map. This leaves room in the direct page for more frequently used
registers and variables.
Direct-page registers can be accessed with efficient direct addressing mode instructions.
Bit manipulation instructions can be used to access any bit in a direct-page register.
The direct page registers can use the more efficient direct addressing mode, which
requires only the lower byte of the address.
The following tables are summaries of all user-accessible direct-page and high-page
registers and control bits. Cells that are not associated with named bits are shaded. A
shaded cell with a 0 indicates this unused bit always reads as a 0; and a shaded cell with a
1 indicates this unused bit always reads as a 1. Shaded cells with dashes indicate unused
or reserved bit locations that could read as 1s or 0s.
Several reserved flash memory locations, shown in the following table, are used for
storing values used by several registers. These registers include an 8-byte backdoor key,
NV_BACKKEY, which can be used to gain access to secure memory resources. During
reset events, the contents of NVPROT and NVOPT in the reserved flash memory are
transferred into corresponding FPROT and FOPT registers in the high-page registers area
to control security and block protection options.
Table 4-5. Reserved flash memory addresses
AddressRegister NameBit 7654321Bit 0
0xFF70NV_BACKKEY0
0xFF71NV_BACKKEY1BACKKEY1
0xFF72NV_BACKKEY2BACKKEY2
0xFF73NV_BACKKEY3BACKKEY3
0xFF74NV_BACKKEY4BACKKEY4
0xFF75NV_BACKKEY5BACKKEY5
0xFF76NV_BACKKEY6BACKKEY6
0xFF77NV_BACKKEY7BACKKEY7
0xFF78Reserved————————
0xFF79Reserved————————
0xFF7AReserved————————
0xFF7BReserved————————
0xFF7CNV_FPROT
0xFF7DNV_EEPROT
0xFF7ENV_FOPTNV
0xFF7FNV_FSEC
FPOPE
N
DPOPE
N
KEYEN1111SEC
—FPHDISFPHFPLDISFPLS
BACKKEY0
—DPS
The 8-byte comparison key can be used to temporarily disengage memory security
provided the key enable field, NV_FSEC[KEYEN], is 10b. This key mechanism can be
accessed only through user code running in secure memory. A security key cannot be
entered directly through background debug commands. This security key can be disabled
completely by programming the NV_FSEC[KEYEN] bit to 0. If the security key is
disabled, the only way to disengage security is by mass erasing the flash if needed,
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
76Freescale Semiconductor, Inc.
Page 77
Chapter 4 Memory map
normally through the background debug interface and verifying that flash is blank. To
avoid returning to secure mode after the next reset, program the security bits,
NV_FSEC[SEC], to the unsecured state (10b).
4.4Random-access memory (RAM)
This section describes the 4,096 bytes of RAM (random-access memory).
These devices include static RAM. The locations in RAM below 0x0100 can be accessed
using the more efficient direct addressing mode. Any single bit in this area can be
accessed with the bit manipulation instructions (BCLR, BSET, BRCLR, and BRSET).
The RAM retains data when the MCU is in low-power wait, or stop3 mode. At power-on,
the contents of RAM are uninitialized. RAM data is unaffected by any reset provided that
the supply voltage does not drop below the minimum value for RAM retention.
For compatibility with older M68HC05 MCUs, the HCS08 resets the stack pointer to
0x00FF. In this series, re-initialize the stack pointer to the top of the RAM so that the
direct-page RAM can be used for frequently accessed RAM variables and bit-addressable
program variables. Include the following 2-instruction sequence in your reset
initialization routine (where RamLast is equated to the highest address of the RAM in the
Freescale-provided equate file).
LDHX #RamLast+1 ;point one past RAM
TXS ;SP<-(H:X-1)
When security is enabled, the RAM is considered a secure memory resource and is not
accessible through BDM or code executing from non-secure memory.
4.5
Flash and EEPROM
4.5.1Overview
This device includes various configuration of flash and EEPROM. The controller for
flash and EEPROM is ideal for single-supply applications for field programming without
external high voltage sources for program or erase operations.
The flash memory is ideal for single-supply applications that allow for field
reprogramming without requiring external high voltage sources for program or erase
operations. The flash module includes a memory controller that executes commands to
modify flash memory contents. The user interface to the memory controller consists of
the indexed flash common command object (FCCOB) register, which is written to with
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.77
Page 78
Divider
Clock
Command Interrupt Request
Protection
Registers
Security
Sector 1
Sector 1
Sector 127
Sector 0
Sector 0
FLASH
EEPROM
Interface
NVM controller
Bus Clock
Error Interrupt Request
CPU
16K
x3
2
256
x8
Sector 127
Flash
Flash and EEPROM
the command, global address, data, and any required command parameters. The memory
controller must complete the execution of a command before the FCCOB register is
written to with a new command.
CAUTION
A flash byte or longword must be in the erased state before
being programmed. Cumulative programming of bits within a
flash byte or longword is not allowed.
The flash memory is read as bytes. Read access time is one bus
cycle for bytes. For flash memory, an erased bit reads 1 and a
programmed bit reads 0. It is possible to read from flash
memory while commands are being executed on EEPROM
memory. It is not possible to read from EEPROM memory
while a command (erase/program) is executing on flash
memory. Simultaneous EEPROM memory are implemented
with error correction codes (ECC) that can resolve single bit
faults and detect double bit faults.
The following figure shows the block diagram of the flash and EEPROM module.
Flash features:
• 64 KB of flash memory composed of one 64 KB flash block divided into 128 sectors
of 512 bytes
• Automated program and erase algorithm with verification
• Fast sector erase and longword program operation
78Freescale Semiconductor, Inc.
Figure 4-2. Flash and EEPROM block diagram
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 79
Chapter 4 Memory map
• Ability to read the flash memory while programming a word in the EEPROM
memory
• Flexible protection scheme to prevent accidental program or erase of flash memory
EEPROM features:
• 256 bytes of EEPROM memory composed of one 256 byte EEPROM block divided
into 128 sectors of 2 bytes
• Single bit fault correction and double bit fault detection within a word during read
operations
• Automated program and erase algorithm with verification and generation of ECC
parity bits
• Fast sector erase and byte program operation
• Protection scheme to prevent accidental program or erase of EEPROM memory
• Ability to program up to four bytes in a burst sequence
Other features
• No external high-voltage power supply required for flash memory program and erase
operations
• Interrupt generation on flash command completion and flash error detection
• Security mechanism to prevent unauthorized access to the flash memory
4.5.2
Function descriptions
4.5.2.1Modes of operation
The flash and EEPROM module provides the normal user mode of operation. The
operating mode is determined by module-level inputs and affects the FCLKDIV,
FCNFG, and EEPROT registers.
4.5.2.1.1
The flash and EEPROM module is not affected if the MCU enters wait mode. The flash
module can recover the MCU from wait via the CCIF interrupt. See Flash and EEPROM
interrupts.
4.5.2.1.2
If a flash and EEPROM command is active, that is, FSTAT[CCIF] = 0, when the MCU
requests stop mode, the current NVM operation will be completed before the MCU is
allowed to enter stop mode.
Wait mode
Stop mode
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.79
Page 80
Flash and EEPROM
4.5.2.2Flash and EEPROM memory map
The MCU places the flash memory between global address 0x0000 and 0xFFFF as
shown in the following table. Not all flash are available to users because some addresses
are overlapped with RAM, EEPROM, and registers.
MC9S08PT60 contains a piece of 64 KB flash in which only 60,864 bytes flash are
available for users. This flash block is divided into 128 sectors of 512 bytes.
MC9S08PT32 contains a piece of 32 KB flash that is fully available for users. This flash
block is divided into 64 sectors of 512 bytes.
Table 4-6. Flash memory addressing
DeviceGlobal address
MC9S08PT600x0000 — 0xFFFF64 KB
MC9S08PT320x8000 — 0xFFFF32 KB
Size
(Bytes)
DescriptionUser availability
Sector [0:7]: N/A
Sector [8]: Last 448 bytes available
Flash block contains
flash configuration field
Flash block contains
flash configuration field
Sector [9:23]: fully available
Sector [24]: N/A
Sector [25:127]: fully available
Sector [64:127]: fully available
4.5.2.3Flash and EEPROM initialization after system reset
On each system reset, the flash and EEPROM module executes an initialization sequence
that establishes initial values for the flash and EEPROM block configuration parameters,
the FPROT and EEPROT protection registers, and the FOPT and FSEC registers. The
initialization routine reverts to built-in default values that leave the module in a fully
protected and secured state if errors are encountered during execution of the reset
sequence. If a double bit fault is detected during the reset sequence, both
FSTAT[MGSTAT] bits will be set.
FSTAT[CCIF] is cleared throughout the initialization sequence. The NVM module holds
off all CPU access for a portion of the initialization sequence. Flash and EEPROM reads
are allowed after the hold is removed. Completion of the initialization sequence is
marked by setting FSTAT[CCIF] high, which enables user commands.
If a reset occurs while any flash or EEPROM command is in progress, that command will
be immediately aborted. The state of the word being programmed or the sector/block
being erased is not guaranteed.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
80Freescale Semiconductor, Inc.
Page 81
Chapter 4 Memory map
4.5.2.4Flash and EEPROM command operations
Flash and EEPROM command operations are used to modify flash and EEPROM
memory contents.
The command operations contain three steps:
1. Configure the clock for flash or EEPROM program and erase command operations.
2. Use command write sequence to set flash and EEPROM command parameters and
launch execution.
3. Execute valid flash and EEPROM commands according to MCU functional mode
and MCU security state.
The figure below shows a general flowchart of the flash or EEPROM command write
sequence.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.81
Page 82
Read: FCLKDIV
START
FDIV
Read: FSTAT
Read: FSTAT
CCIF
Write: FCLKDIV
register
NOTE: FCLKDIV must be
set after each reset
Set?
CCIF
ACCERR
Results from previous Command
Write to FCCOBIX register
to identify specific command
parameter to load
Write to FCCOB register
to load required command
parameter
More
Write: FSTAT register
(to launch command)
Read: FSTAT register
CCIF Set?
Bit Polling for
Command Completion Check
Clear CCIF 0x80
Parameters?
Write: FSTAT register
Clear ACCERR
FPVIOL 0x30
or FPVIOL Set?
Access Error and
Protection Violation Check
Set?
No
No
No
Yes
Yes
Yes
No
Yes
END
register
No
No
Yes
Yes
Clock Divider
Value Check
FCCOB
Availability Check
register
Correct?
register
Flash and EEPROM
Figure 4-3. Generic flash and EEPROM command write sequence flowchart
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
82Freescale Semiconductor, Inc.
Page 83
Chapter 4 Memory map
4.5.2.4.1Writing the FCLKDIV register
Prior to issuing any flash and EEPROM program or erase command after a reset, the user
is required to write the FCLKDIV register to divide BUSCLK down to a target FCLK of
1MHz. The following table shows recommended values for the FDIV field based on
BUSCLK frequency.
Table 4-7. FDIV values for various BUSCLK frequencies
BUSCLK frequency
(MHz)
1
MIN
1.01.60x00
1.62.60x01
2.63.60x02
3.64.60x03
4.65.60x04
5.66.60x05
6.67.60x06
7.68.60x07
8.69.60x08
9.610.60x09
10.611.60x0A
11.612.60x0B
12.613.60x0C
13.614.60x0D
14.615.60x0E
15.616.60x0F
16.617.60x10
17.618.60x11
18.619.60x12
19.620.00x13
MAX
2
FDIV[5:0]
1. BUSCLK is greater than this value
2. BUSCLK is less than or equal to this value
CAUTION
Programming or erasing the flash and EEPROM memory
cannot be performed if the bus clock runs at less than 0.8 MHz.
Setting FCLKDIV[FDIV] too high can destroy the flash and
EEPROM memory due to overstress. Setting FCLKDIV[FDIV]
too low can result in incomplete programming or erasure of the
flash and EEPROM memory cells.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.83
Page 84
Flash and EEPROM
When the FCLKDIV register is written, the FCLKDIV[FDIVLD] bit is set automatically.
If the FCLKDIV[FDIVLD] bit is 0, the FCLKDIV register has not been written since the
last reset. If the FCLKDIV register has not been written, any flash and EEPROM
program or erase command loaded during a command write sequence will not execute
and the FSTAT[ACCERR] bit will be set.
4.5.2.4.2Command write sequence
The memory controller will launch all valid flash and EEPROM commands entered using
a command write sequence.
Before launching a command, the FSTAT[ACCERR] and FSTAT[FPVIOL] bits must be
clear and the FSTAT[CCIF] flag will be tested to determine the status of the current
command write sequence. If FSTAT[CCIF] is 0, indicating that the previous command
write sequence is still active, a new command write sequence cannot be started and all
writes to the FCCOB register are ignored.
The FCCOB parameter fields must be loaded with all required parameters for the flash
and EEPROM command being executed. Access to the FCCOB parameter fields is
controlled via FCCOBIX[CCOBIX] bits.
Flash and EEPROM command mode uses the indexed FCCOB register to provide a
command code and its relevant parameters to the memory controller. First, the user must
set up all required FCCOB field. Then they can initiate the command's execution by
writing a 1 to the FSTAT[CCIF] bit. This action clears the CCIF command completion
flag to 0. When the user clears the FSTAT[CCIF] bit all FCCOB parameter field are
locked and cannot be changed by the user until the command completes (evidenced by
the memory controller returning FSTAT[CCIF] to1). Some commands return information
to the FCCOB register array.
The generic format for the FCCOB parameter fields in flash and EEPROM command
mode is shown in the following table. The return values are available for reading after the
FSTAT[CCIF] flag has been returned to 1 by the memory controller. Writes to the
unimplemented parameter fields, FCCOBIX[CCOBIX] =110b and FCCOBIX[CCOBIX]
= 111b, are ignored with read from these fields returning 0x0000.
The table below shows the generic flash command format. The high byte of the first word
in the CCOB array contains the command code, followed by the parameters for this
specific flash command. For details on the FCCOB settings required by each command,
see the flash command descriptions in Flash and EEPROM command summary .
CCOBIX[2:0]ByteFCCOB parameter fields in flash and EEPROM command mode
000
001
010
011
100
101
HIFCMD[7:0] defining flash command
LOGlobal address [23:16]
HIGlobal address [15:8]
LOGlobal address [7:0]
HIData 0 [15:8]
LOData 0 [7:0]
HIData 1 [15:8]
LOData 1 [7:0]
HIData 2 [15:8]
LOData 2 [7:0]
HIData 3 [15:8]
LOData 3 [7:0]
The contents of the FCCOB parameter fields are transferred to the memory controller
when the user clears the FSTAT[CCIF] command completion flag by writing 1. The
CCIF flag will remain clear until the flash and EEPROM command has completed. Upon
completion, the memory controller will return FSTAT[CCIF] to 1 and the FCCOB
register will be used to communicate any results.
The following table presents the valid flash and EEPROM commands, as enabled by the
combination of the functional MCU mode with the MCU security state of unsecured or
secured.
MCU secured state is selected by NVM_FSEC[SEC].
Table 4-9. Flash and EEPROM commands by mode and security state
The flash and EEPROM module can generate an interrupt when a flash command
operation has completed or when a flash and EEPROM command operation has detected
an ECC fault.
4.5.2.5.1Description of flash and EEPROM interrupt operation
The flash module uses the FSTAT[CCIF] flag in combination with the FCNFG[CCIE]
interrupt enable bit to generate the flash command interrupt request. The flash module
uses the DFDIF and SFDIF flags in combination with the FERSTAT[DFDIE] and
FERSTAT[SFDIE] interrupt enable bits to generate the flash error interrupt request.
The logic used for generating the flash module interrupts is shown in the following
figure.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
86Freescale Semiconductor, Inc.
Page 87
CCIE
CCIF
SFDIF
Flash and EEPROM Command
Flash and EEPROM
Complete Interrupt Request
Error Interrupt Request
CPU Interrupt
Flash Protected/Unprotected Region 32 Kbytes
Flash Configuration Field 16 bytes (0xFF70
0xFF7F)
Flash Protected/Unprotected Higher Region 2, 4, 8, 16 Kbytes
Flash Protected/Unprotected Lower Region 1, 2, 4, 8 Kbytes
Flash Protected/Unprotected Region 8 Kbytes (up to 29 Kbytes)
0x0000
0x8000
0x8400
0x8800
0x9000
0xA000
0xB000
0xC000
0xD000
0xE000
0xF000
0xF800
0xFFFF
Chapter 4 Memory map
Figure 4-4. Flash and EEPROM module interrupts implementation
4.5.2.6Protection
The FPROT register can be set to protect regions in the flash memory from accidental
programming or erasing. Three separate memory regions, one growing upward from
global address 0x8000 in the flash memory, called the lower region; one growing
downward from global address 0xFFFF in the flash memory, called the higher region;
and the remaining addresses in the flash memory, can be activated for protection. The
flash memory addresses covered by these protectable regions are shown in the flash
memory map. The higher address region is mainly targeted to hold the boot loader code
because it covers the vector space.
Figure 4-5. Flash protection memory map
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.87
Page 88
Flash and EEPROM
Default protection settings as well as security information that allows the MCU to restrict
access to the flash module are stored in the flash configuration field as described in the
table below.
Table 4-11. Flash configuration field
Global addressSize (Bytes)Description
0xFF70 — 0xFF77
0xFF78 — 0xFF7B4Reserved
0xFF7C
0xFF7D
0xFF7E
0xFF7F
1. 0xFF78–0xFF7F for a flash phrase and must be programmed in a single command write sequence. Each byte in the
0xFF78-0xFF7B reserved field must be programmed to 0xFF.
Backdoor comparison key. See Verify backdoor access key command and
Unsecuring the MCU using backdoor key access.
The flash and EEPROM module provides protection to the MCU. During the reset
sequence, the FPROT register is loaded with the contents of the flash protection byte in
the flash configuration field at global address 0xFF7C in flash memory. The protection
functions depend on the configuration of bit settings in FPORT register.
Table 4-12. Flash protection function
FPOPENFPHDISFPLDISFunction
111No flash protection
110Protected low range
101Protected high range
100Protected high and low ranges
011Full p-flash memory protected
010Unprotected low range
001Unprotected high range
000Unprotected high and low ranges
1. For range sizes, see Table 4 and Table 5
1
The flash protection scheme can be used by applications requiring reprogramming in
single chip mode while providing as much protection as possible if reprogramming is not
required.
The general guideline is that flash protection can only be added and not removed. The
following table specifies all valid transitions between flash protection scenarios. Any
attempt to write an invalid scenario to the FPROT register will be ignored. The contents
of the FPROT register reflect the active protection scenario. See the FPROT[FPHS] and
FPROT[FPLS] bit descriptions for additional restrictions.
Freescale Semiconductor, Inc.89
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Page 90
Flash and EEPROM
Table 4-13. Flash protection scenario transitions
From protection
scenario
0××××
1××
2××
3×
4××
5××××
6××××
7××××××××
01234567
To protection scenario
The flash protection address range is listed in the following two tables regarding the
scenarios in the table above.
During the reset sequence, fields NVM_EEPROT[DPOPEN] and NVM_EEPROT[DPS]
are loaded with the contents of the EEPROM protection byte in the flash configuration
field at global address 0xFF7D located in flash memory. EEPROM protection address
range is specified by the NVM_EEPROT[DPS].
All possible flash protection scenarios are shown in Figure 4-6. Although the protection
scheme is loaded from the flash memory at global address 0xFF7C during the reset
sequence, it can be changed by the user.
4.5.2.7Security
The flash and EEPROM module provides security information to the MCU. The flash
security state is defined by the NVM_FSEC[SEC] bits. During reset, the flash module
initializes the NVM_FSEC register using data read from the security byte of the flash and
EEPROM configuration field at global address 0xFF7F. The security state out of reset
can be permanently changed by programming the security byte, assuming that the MCU
is starting from a mode where the necessary flash and EEPROM erase and program
commands are available and that the upper region of the flash is unprotected. If the flash
security byte is successfully programmed, its new value will take affect after the next
MCU reset.
The following subsections describe these security-related subjects:
• Unsecuring the MCU using backdoor key access
• Unsecuring the MCU using BDM
• Mode and security effects on flash and EEPROM command availability
4.5.2.7.1
Unsecuring the MCU using backdoor key access
The MCU may be unsecured by using the backdoor key access feature which requires
knowledge of the contents of the backdoor keys, which are four 16-bit words
programmed at addresses 0xFF70–0xFF77. If the KEYEN[1:0] bits are in the enabled
state, the verify backdoor access key command – see Verify backdoor access key
command, allows the user to present four prospective keys for comparison to the keys
stored in the flash and EEPROM memory via the memory controller. If the keys
presented in the verify backdoor access key command match the backdoor keys stored in
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.91
Page 92
Flash and EEPROM
the flash and EEPROM memory, the FSEC[SEC] bits will be changed to unsecure the
MCU. Key values of 0x0000 and 0xFFFF are not permitted as backdoor keys. While the
Verify Backdoor Access Key command is active, flash memory and EEPROM memory
will not be available for read access and will return invalid data.
The user code stored in the flash memory must have a method of receiving the backdoor
keys from an external stimulus. This external stimulus would typically be through one of
the on-chip serial ports.
If the KEYEN[1:0] bits are in the enabled state, the MCU can be unsecured by the
backdoor key access sequence described below:
1. Follow the command sequence for the verify backdoor access key command as
explained in Verify backdoor access key command.
2. If the verify backdoor access key command is successful, the MCU is unsecured and
the FSEC[SEC] bits are forced to the unsecure state of 10.
The verify backdoor access key command is monitored by the memory controller and an
illegal key will prohibit future use of the verify backdoor access key command. A reset of
the MCU is the only method to re-enable the verify backdoor access key command. The
security as defined in the flash and EEPROM security byte (0xFF7F) is not changed by
using the verify backdoor access key command sequence. The backdoor keys stored in
addresses 0xFF70–0xFF77 are unaffected by the verify backdoor access key command
sequence. The verify backdoor access key command sequence has no effect on the
program and erase protections defined in the flash and EEPROM protection register,
FPORT.
After the backdoor keys have been correctly matched, the MCU will be unsecured. After
the MCU is unsecured, the sector containing the flash and EEPROM security byte can be
erased and the flash and EEPROM security byte can be reprogrammed to the unsecure
state, if desired. In the unsecure state, the user has full control of the contents of the
backdoor keys by programming addresses 0xFF70–0xFF77 in the flash configuration
field.
4.5.2.7.2
Unsecuring the MCU using BDM
A secured MCU can be unsecured by using the following method to erase the flash and
EEPROM memory:
1. Reset the MCU.
2. Set FCDIV register as described in Writing the FCLKDIV register.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
92Freescale Semiconductor, Inc.
Page 93
Chapter 4 Memory map
3. Configure registers NVM_FERSTAT and NVM_FPROT to disable protection in the
flash and EEPROM memory.
4. Execute the erase all blocks command write sequence to erase the flash and
EEPROM memory. Alternately, the unsecure NVM command can be executed.
If the flash and EEPROM memory are verified as erased, the MCU will be
unsecured. All BDM. commands will now be enabled and the flash security byte may
be programmed to the unsecure state by continuing with the steps that follow.
5. Execute the program flash command write sequence to program the flash security
byte to the unsecured state.
6. Reset the MCU.
4.5.2.7.3Mode and security effects on flash and EEPROM command
availability
The availability of flash and EEPROM module commands depends on the MCU
operating mode and security state as shown in Table 4-9.
4.5.2.8
Flash and EEPROM commands
4.5.2.8.1Flash commands
The following table summarizes the valid flash commands as well as the effects of the
commands on the flash block and other resources within the flash and EEPROM module.
Table 4-17. Flash commands
FCMDCommandFunction on flash memory
0x01Erase verify all blocksVerify that all flash (and EEPROM) blocks are erased
0x02Erase verify blockVerify that a flash block is erased
0x03Erase verify flash sectionVerify that a given number of words starting at the address provided are erased
0x04Read Once
0x06Program flashProgram up to two longwords in a flash block
0x07Program once
0x08Erase all block
0x09Erase flash blockErase a flash or EEPROM block
Read a dedicated 64 byte field in the nonvolatile information register in flash
block that was previously programmed using the program once command
Program a dedicated 64 byte field in the nonvolatile information register in flash
block that is allowed to be programmed only once
Erase all flash and EEPROM blocks
An erase of all flash blocks is possible only when the FPROT[FPLDIS],
FPROT[FPHDIS], and FPROT[FPOEN] bits and the EEPROT[DPOPEN] bit are
set prior to launching the command
Table continues on the next page...
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.93
Page 94
Flash and EEPROM
Table 4-17. Flash commands (continued)
FCMDCommandFunction on flash memory
An erase of the full flash block is possible only when FPROT[FPLDIS],
FPROT[FPHDIS], and FPROT[FPOEN] bits are set prior to launching the
command
0x0AErase flash sectorErase all bytes in a flash sector
0x0BUnsecure flash
0x0CVerify backdoor access keySupports a method of releasing MCU security by verifying a set of security keys
0x0DSet user margin levelSpecifies a user margin read level for all flash blocks
Supports a method of releasing MCU security by erasing all flash (and
EEPROM) blocks and verifying that all flash (and EEPROM) blocks are erased
4.5.2.8.2EEPROM commands
The following table summarizes the valid EEPROM commands along with the effects of
the commands on the EEPROM block.
Table 4-18. EEPROM commands
FCMDCommandFunction on flash memory
0x01Erase verify all blocksVerify that all EEPROM (and flash) blocks are erased.
0x02Erase verify blockVerify that an EEPROM block is erased.
Erase all EEPROM and flash blocks
0x08Erase all block
0x09Erase EEPROM Block
0x0BUnsecure EEPROM
0x0DSet User Margin LevelSpecifies a user margin read level for all flash blocks.
0x10
0x11Program EEPROMProgram up to four bytes in the EEPROM block.
0x12Erase EEPROM SectorErase all bytes in a sector of the EEPROM block.
Erase Verify EEPROM
Section
An erase of all EEPROM blocks is possible only when the FPROT[FPLDIS],
FPROT[FPHDIS], and FPROT[FPOEN] bits and the DPOPEN bit in the
EEPORT register are set prior to launching the command.
Erase a EEPROM and flash block
An erase of the full flash block is possible only when FPROT[FPLDIS],
FPROT[FPHDIS] and FPROT[FPOPEN] bits are set prior to launching the
command.
Supports a method of releasing MCU security by erasing all EEPROM and flash
blocks and verifying that all EEPROM and flash blocks are erased.
Verify that a given number of bytes starting at the address provided are erased.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
94Freescale Semiconductor, Inc.
Page 95
Chapter 4 Memory map
4.5.2.8.3Allowed simultaneous flash and EEPROM operations
Only the operations marked 'OK' in the following table are permitted to be run
simultaneously on the flash and EEPROM blocks. Some operations cannot be executed
simultaneously because certain hardware resources are shared by the two memories. The
priority has been placed on permitting flash reads while program and erase operations
execute on the EEPROM, providing read (flash) while write (EEPROM) functionality.
Table 4-19. Allowed simultaneous flash and EEPROM operations
Program flash
ReadOKOKOK
Margin Read
Program
Sector Erase
Mass Erase
1. A 'Margin read' is any read after executing the margin setting commands 'Set user margin level' or 'Set field margin level'
with anything but the 'normal' level specified. See the Note on margin settings in
2. The 'Mass erase' operations are commands 'Erase all blocks' and 'Erase flash block'
1
2
ReadMargin readProgramSector eraseMass erase
EEPROM
OK
4.5.2.9Flash and EEPROM command summary
This section provides details of all available flash commands launched by a command
write sequence. The FSTAT[ACCERR] bit will be set during the command write
sequence if any of the following illegal steps are performed, causing the command not to
be processed by the memory controller:
• Starting any command write sequence that programs or erases flash memory before
initializing the FLCKDIV register.
• Writing an invalid command as part of the command write sequence.
• For additional possible errors, refer to the error handling table provided for each
command.
If a flash block is read during the execution of an algorithm (FSTAT[CCIF] = 0) on that
same block, the read operation will return invalid data if both flags FERSTAT[SFDIF]
and FERSTAT[DFDIF] are set. If the FERSTAT[SFDIF] or FERSTAT[DFDIF] flags
were not previously set when the invalid read operation occurred, both the
FERSTAT[SFDIF] and FERSTAT[DFDIF] flags will be set.
If the FSTAT[ACCERR] or FSTAT[FPVIOL] bits are set, the user must clear these bits
before starting any command write sequence.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.95
Page 96
Flash and EEPROM
CAUTION
An EEPROM byte or flash longword must be in the erased state
before being programmed. Cumulative programming of bits
within an EEPROM byte or flash longword is not allowed.
4.5.2.9.1Erase verify all blocks command
The erase verify all blocks command will verify that all flash and EEPROM blocks have
been erased.
Table 4-20. Erase verify all blocks command FCCOB requirements
Upon clearing NVM_FSTAT[CCIF] to launch the erase verify all blocks command, the
memory controller will verify that the entire flash memory space is erased. The
NVM_FSTAT[CCIF] flag will set after the erase verify all blocks operation has
completed. If all blocks are not erased, it means blank check failed and both
NVM_FSTAT[MGSTAT] bits will be set.
Table 4-21. Erase verify all blocks command error handling
RegisterError bitError condition
ACCERRSet if CCOBIX[2:0] != 000 at command launch
FPVIOLNone
NVM_FSTAT
1. As found in the memory map for NVM
MGSTAT1
MGSTAT0
Set if any errors have been encountered during the read1 or if blank check
failed
Set if any non-correctable errors have been encountered during the read
or if blank check failed
4.5.2.9.2Erase verify block command
The erase verify block command allows the user to verify that an entire flash or
EEPROM block has been erased. The FCCOB global address [23:0] bits determine which
block must be verified.
0000x02Global address [23:16] to identify Flash block
001Global address [15:0] in flash block to be verified
1
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
96Freescale Semiconductor, Inc.
Page 97
Chapter 4 Memory map
1. Global address [23] selects between flash (0) or EEPROM (1) block, that can otherwise eventually share the same
address on the MCU global memory map.
Upon clearing NVM_FSTAT[CCIF] to launch the erase verify block command, the
memory controller will verify that the selected flash or EEPROM block is erased. The
NVM_FSTAT[CCIF] flag will set after the erase verify block operation has completed. If
the block is not erased, it means blank check failed and both NVM_FSTAT[MGSTAT]
bits will be set.
Set if CCOBIX[2:0] != 000 at command launch
Set if an invalid global address [23:0] is supplied
Set if any errors have been encountered during the read or if blank check
failed
Set if any non-correctable errors have been encountered during the read
or if blank check failed
1
1. As found in the memory map for NVM
4.5.2.9.3Erase verify flash section command
The erase verify flash section command will verify that a section of code in the flash
memory is erased. The erase verify flash section command defines the starting point of
the code to be verified and the number of longwords.
0000x03Global address [23:16] of flash block
001Global address [15:0] of the first longwords to be verified
010Number of long words to be verified
Upon clearing NVM_FSTAT[CCIF] to launch the erase verify flash section command,
the memory controller will verify that the selected section of flash memory is erased. The
NVM_FSTAT[CCIF] flag will set after the erase verify flash section operation has
completed. If the section is not erased, it means blank check failed and both
FSTAT[MGSTAT] bits will be set.
Set if command not available in current mode (see Table 4-9)
1
2
FPVIOLNone
MGSTAT1
MGSTAT0
1. As defined by the memory map for NVM
2. As found in the memory map for NVM
Set if an invalid global address [23:0] is supplied (see Table 4-6)
Set if a misaligned long words address is supplied (global address[1:0] !=
00)
Set if the requested section crosses flash address boundary
Set if any errors have been encountered during the read2 or if blank check
failed
Set if any non-correctable errors have been encountered during the read
or if blank check failed
4.5.2.9.4Read once command
The read once command provides read access to a reserved 64 byte field (8 phrase)
located in the nonvolatile information register of flash. The read once field can only be
programmed once and can not be erased. It can be used to store the product ID or any
other information that can be written only once. It is programmed using the program once
command described in Program once command. To avoid code runaway, the read once
command must not be executed from the flash block containing the program once
reserved field.
Table 4-26. Read once command FCCOB requirements
CCOBIX[2:0]FCCOB parameters
0000x04Not required
001Read once phrase index (0x0000 – 0x0007)
010Read once word 0 value
011Read once word 1 value
100Read once word 2 value
101Read once word 3 value
Upon clearing FSTAT[CCIF] to launch the read once command, a read once phrase is
fetched and stored in the FCCOB indexed register. The FSTAT[CCIF] flag will set after
the read once operation has completed. Valid phrase index values for the read once
command range from 0x0000 to 0x0007. During execution of the read once command,
any attempt to read addresses within flash block will return invalid data.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
98Freescale Semiconductor, Inc.
Page 99
Chapter 4 Memory map
Table 4-27. Read once command error handling
RegisterError bitError condition
Set if CCOBIX[2:0] != 001 at command launch
FSTAT
ACCERR
FPVIOLNone
MGSTAT1Set if any errors have been encountered during the read
MGSTAT0Set if any non-correctable errors have been encountered during the read
Set if command is not available in current mode (see Table 4-9)
Set if an invalid phrase index is supplied
4.5.2.9.5Program flash command
The program flash operation will program up to two previously erased longwords in the
flash memory using an embedded algorithm.
Note
A flash phrase must be in the erased state before being
programmed. Cumulative programming of bits within a flash
phrase is not allowed.
Table 4-28. Program flash command FCCOB requirements
0000x06Global address [23:16] to identify flash block
001Global address [15:0] of longwords location to be programmed
010Word 0 (longword 0) program value
011Word 1 (longword 0) program value
100Word 2 (longword 1) program value
101Word 3 (longword 1) program value
1. Global address [1:0] must be 00.
1
Upon clearing NVM_FSTAT[CCIF] to launch the program flash command, the memory
controller will program the data words to the supplied global address and will then
proceed to verify the data words read back as expected. The NVM_FSTAT[CCIF] flag
will set after the program flash operation has completed.
Table 4-29. Program flash command error handling
RegisterError bitError condition
Set if CCOBIX[2:0] ≠ 011 or 101 at command launch
NVM_FSTATACCERR
Set if command not available in current mode (see Table 4-9)
Set if an invalid global address [23:0] is supplied (see Table 4-6)
1
Table continues on the next page...
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
Freescale Semiconductor, Inc.99
Page 100
Flash and EEPROM
Table 4-29. Program flash command error handling (continued)
RegisterError bitError condition
Set if a misaligned longword address is supplied (global address [1:0] !=
00)
Set if the requested group of words breaches the end of the flash block.
FPVIOLSet if the global address [23:0] points to a protected data
MGSTAT1Set if any errors have been encountered during the verify operation
MGSTAT0
1. As defined by the memory map of NVM
Set if any non-correctable errors have been encountered during the verify
operation
4.5.2.9.6Program once command
The program once command restricts programming to a reserved 64 byte field (8 phrases)
in the nonvolatile information register located in flash. The program once reserved field
can be read using the read once command as described in Read once command. The
program once command must be issued only because the nonvolatile information register
in flash cannot be erased. To avoid code runaway, the read once command must not be
executed from the flash block containing the program once reserved field.
Table 4-30. Program once command FCCOB requirements
CCOBIX[2:0]FCCOB parameters
0000x07Not required
001Program Once phrase index (0x000 – 0x0007)
010Program once Word 0 value
011Program once Word 1value
100Program once Word 2 value
101Program once Word 3 value
Upon clearing FSTAT[CCIF] to launch the program once command, the memory
controller first verifies that the selected phrase is erased. If erased, then the selected
phrase will be programmed and then verified with read back. The FSTAT[CCIF] flag will
remain clear, setting only after the program once operation has completed.
The reserved nonvolatile information register accessed by the program once command
cannot be erased, and any attempt to program one of these phrases a second time will not
be allowed. Valid phrase index values for the program once command range from 0x0000
to 0x0007. During execution of the program once command, any attempt to read
addresses within flash will return invalid data.
MC9S08PT60 Reference Manual, Rev. 4, 08/2014
100Freescale Semiconductor, Inc.
Loading...
+ hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.