Page 19
Receiver functional description........................431 15.4.3.1 Data sampling technique........................ 432 15.4.3.2 Receiver wake-up operation......................433 15.4.4 Interrupts and status flags..........................434 15.4.5 Baud rate tolerance............................435 15.4.5.1 Slow data tolerance........................436 15.4.5.2 Fast data tolerance..........................437 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 20
SPI status register (SPIx_S)..........................450 16.3.5 SPI data register (SPIx_D)..........................451 16.3.6 SPI match register (SPIx_M)........................... 452 16.4 Functional Description..............................452 16.4.1 General................................452 16.4.2 Master Mode..............................453 16.4.3 Slave Mode..............................454 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 21
16-Bit Serial Peripheral Interface (16-Bit SPI) 17.1 Introduction..................................469 17.1.1 Features................................469 17.1.2 Modes of operation............................470 17.1.3 Block diagrams..............................471 17.1.3.1 SPI system block diagram......................471 17.1.3.2 SPI module block diagram......................471 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 22
SPI clock formats............................. 493 17.4.7 SPI baud rate generation..........................496 17.4.8 Special features..............................496 17.4.8.1 SS Output............................496 17.4.8.2 Bidirectional mode (MOMI or SISO).................... 497 17.4.9 Error conditions..............................498 17.4.9.1 Mode fault error..........................498 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 23
18.3.2 I2C Frequency Divider register (I2C_F)......................511 18.3.3 I2C Control Register 1 (I2C_C1)........................512 18.3.4 I2C Status register (I2C_S)..........................513 18.3.5 I2C Data I/O register (I2C_D)......................... 515 18.3.6 I2C Control Register 2 (I2C_C2)........................516 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 24
Address matching.............................527 18.4.4 System management bus specification......................528 18.4.4.1 Timeouts............................528 18.4.4.2 FAST ACK and NACK......................... 530 18.4.5 Resets................................530 18.4.6 Interrupts................................530 18.4.6.1 Byte transfer interrupt........................531 18.4.6.2 Address detect interrupt......................... 531 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 25
Conversion Result Low Register (ADC_RL)....................546 19.3.7 Compare Value High Register (ADC_CVH)....................547 19.3.8 Compare Value Low Register (ADC_CVL)....................547 19.3.9 Pin Control 1 Register (ADC_APCTL1)......................548 19.3.10 Pin Control 2 Register (ADC_APCTL2)......................549 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 26
19.6 Application information..............................564 19.6.1 External pins and routing..........................564 19.6.1.1 Analog supply pins.........................564 19.6.1.2 Analog reference pins........................564 19.6.1.3 Analog input pins........................... 565 19.6.2 Sources of error..............................566 19.6.2.1 Sampling error..........................566 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 27
20.4 Functional description..............................576 20.5 Setup and operation of ACMP............................577 20.6 Resets....................................578 20.7 Interrupts..................................578 Chapter 21 Touch Sense Input (TSI) 21.1 Introduction..................................579 21.1.1 Features................................579 21.1.2 Modes of operation............................580 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 28
Software and hardware trigger......................... 593 21.4.5 Scan times................................ 594 21.4.6 Clock setting..............................594 21.4.7 Reference voltage.............................594 21.4.8 Current source..............................595 21.4.9 Pin enable................................. 595 21.4.10 End of scan...............................595 21.4.11 Noise detection mode............................596 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 29
CCITT compliant CRC example........................611 Chapter 23 Watchdog (WDOG) 23.1 Introduction..................................613 23.1.1 Features................................613 23.1.2 Block diagram..............................614 23.2 Memory map and register definition..........................615 23.2.1 Watchdog Control and Status Register 1 (WDOG_CS1)................615 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 30
Fast testing of the watchdog..........................627 23.3.7.1 Testing each byte of the counter....................627 23.3.7.2 Entering user mode........................628 Chapter 24 Development support 24.1 Introduction..................................629 24.1.1 Forcing active background..........................629 24.1.2 Features................................629 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 31
25.3 Memory map and registers..............................651 25.3.1 Debug Comparator A High Register (DBG_CAH)..................652 25.3.2 Debug Comparator A Low Register (DBG_CAL)..................653 25.3.3 Debug Comparator B High Register (DBG_CBH)..................654 25.3.4 Debug Comparator B Low Register (DBG_CBL)...................654 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 32
Trigger modes..........................670 25.4.5 FIFO................................. 672 25.4.5.1 Storing data in FIFO........................673 25.4.5.2 Storing with begin-trigger......................673 25.4.5.3 Storing with end-trigger......................... 673 25.4.5.4 Reading data from FIFO........................ 673 25.4.6 Interrupt priority...............................674 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 33
Section number Title Page 25.5 Resets....................................675 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MTIM0 MTIM1 SPI0 (8-bit) SPI1 (16-bit) ACMP SCI0 SCI1 SCI2 ADC channels TSI channels KBI pins GPIO 1.2 MCU block diagram The block diagram below shows the structure of the MCUs. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 37
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 in 32-pin packages. Figure 1-1. MCU block diagram MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ICSFFCLK ICSCLK ( ~8 MHz after reset SCI0 SPI0 KBI0 FLASH SCI1 SPI1 KBI1 SCI2 ICSLCLK CLKOUT BUSREF CLKOE System Control Figure 1-2. System clock distribution diagram The clock system supplies: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 39
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.
Page 40
System clock distribution MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Chapter 2 Pins and connections 2.1 Device pin assignment MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 42
PTE6 PTB1/KBI0P5/TxD0/ADP5/TSI3 Pins in bold are not available on less pi n-count packages. 1. High source/sink current pins 2. True open drain pins Figure 2-1. MC9S08PT60 64-pin QFP and LQFP package MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 43
PTA7/FTM2FAULT2/ADP3/TSI1 PTB0/KBI0P4/RxD0/ADP4/TSI2 PTE6 PTB1/KBI0P5/TxD0/ADP5/TSI3 Pins in bold are not available on less pi n-count packages. 1. High source/sink current pins 2. True open drain pins Figure 2-2. MC9S08PT60 48-pin LQFP package MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 44
PTA7/FTM2FAULT2/ADP3/TSI1 PTB6/SDA/XTAL PTB0/KBI0P4/RxD0/ADP4/TSI2 PTB1/KBI0P5/TxD0/ADP5/TSI3 Pins in bold are not available on less pi n-count packages. 1. High source/sink current pins 2. True open drain pins Figure 2-3. MC9S08PT60 44-pin LQFP package MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTB7/SCL/EXTAL PTB6/SDA/XTAL PTB1/KBI0P5/TxD0/ADP5/TSI3 1. High source/sink current pins 2. True open drain pins Figure 2-4. MC9S08PT60 32-pin LQFP package Pin functions 2.2.1 Power (V and V 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.
Figure 2-6. Analog power supply bypassing 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 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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. PTA5/IRQ/TCLK0/RESET 4.7k Figure 2-8. PTA5/IRQ/TCLK0/RESET external RC filter MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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. PTA5/IRQ/TCLK0/RESET Optional Manual Reset BKGD/MS Figure 2-9. Typical debug circuit MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTA3 and PTA2 operate in true open drain mode. 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.
Page 54
Disable all modules that share a pin before enabling another module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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.
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 Freescale Semiconductor, Inc.
The following table shows the low power mode behaviors. Table 3-1. Low power mode behavior Mode Wait Stop3 Full regulation Full regulation Loose regulation Optional on Optional on Standby Standby FLASH Standby Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPMSC1[LVWF] will be set and LVW interrupt will occur. There are four user- selectable 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.
LVDRE LVDSE LVDE BGBDS BGBE Write LVWACK Reset PMC_SPMSC1 field descriptions Field Description Low-Voltage Warning Flag LVWF The LVWF bit indicates the low-voltage warning status. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 61
Bandgap Buffer Enable BGBE This bit enables an internal buffer for the bandgap voltage reference for use by the ADC module on one of its internal channels. Bandgap buffer disabled. Bandgap buffer enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Middle 1 trip point selected (V LVW2 Middle 2 trip point selected (V LVW3 High trip point selected (V LVW4 Reserved This field is reserved. This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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 • Random-access memory (RAM) •...
4.3 Register 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.
Page 66
0x3088—0x308F SCI1 0x3090—0x3097 SCI2 0x3098—0x309F SPI0 0x30A0—0x30A9 SPI1 0x30AC—0x30AD 0x30AF—0x30AF Port high drive enable 0x30B0—0x30B7 Port output enable 0x30B8—0x30BF Port input enable 0x30C0—0x30EA FTM2 0x30EC—0x30EF Port filter 0x30F0—0x30F7 Port pullup 0x30F8—0x30FF MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 67
Bit 0 0x0010 ADC_SC1 COCO AIEN ADCO ADCH FEMPT 0x0011 ADC_SC2 ADACT ADTRG ACFE ACFGT FFULL — — ADLSM 0x0012 ADC_SC3 ADLPC ADIV MODE ADICLK Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 68
FTM1_C0SC CHIE ELSB ELSA — — 0x0036 FTM1_C0VH Bit 15 Bit 8 0x0037 FTM1_C0VL Bit 7 Bit 0 0x0038 FTM1_C1SC CHIE ELSB ELSA — — Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 69
— — — — — — 0x301B DBG_FX PPACC — — — — — — Bit 16 0x301C DBG_C DBGEN BRKEN — — — LOOP1 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 70
LOCK — IREFST CLKST — — 0x303D Reserved — — — — — — — — OSCST OSCINI 0x303E ICS_OSCSC OSCEN — OSCOS — RANGE Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 71
RTC_CNTL CNTL 0x3070 I2C_A1 0x3071 I2C_F MULT 0x3072 I2C_C1 IICEN IICIE TXAK RSTA WUEN — 0x3073 I2C_S IAAS BUSY ARBL IICIF RXAK 0x3074 I2C_D DATA Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 72
0x3091 SCI2_BDL SBR7 SBR6 SBR5 SBR4 SBR3 SBR2 SBR1 SBR0 SCISWA 0x3092 SCI2_C1 LOOPS RSRC WAKE 0x3093 SCI2_C2 TCIE ILIE 0x3094 SCI2_S1 TDRE RDRF IDLE Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 76
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 Freescale Semiconductor, Inc.
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.
Page 78
• 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 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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.
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.
Page 83
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.
Page 84
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 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 85
Program flash 0x07 Program once 0x08 Erase all block 0x09 Erase flash block 0x0A Erase flash sector 0x0B Unsecure NVM 0x0C Verify backdoor access key Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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 Freescale Semiconductor, Inc.
0xC000 0xD000 Flash Protected/Unprotected Higher Region 2, 4, 8, 16 Kbytes 0xE000 Protection Fixed End 0xF000 0xF800 Flash Configuration Field 16 bytes (0xFF70 0xFF7F) 0xFFFF Figure 4-5. Flash protection memory map MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 88
Table 4 Table 5 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. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 89
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. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 90
Table 4-16. EEPROM protection address range DPS[2:0] Global address range Protected size 0x3100 – 0x311F 32 bytes 0x3100 – 0x313F 64 bytes 0x3100 – 0x315F 96 bytes Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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.
Page 92
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 Freescale Semiconductor, Inc.
FPROT[FPHDIS], and FPROT[FPOEN] bits and the EEPROT[DPOPEN] bit are set prior to launching the command 0x09 Erase flash block Erase a flash or EEPROM block Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 94
Verify that a given number of bytes starting at the address provided are erased. Section 0x11 Program EEPROM Program up to four bytes in the EEPROM block. 0x12 Erase EEPROM Sector Erase all bytes in a sector of the EEPROM block. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
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.
Page 96
Table 4-22. Erase verify block command FCCOB requirements CCOBIX[2:0] NVM_FCCOBHI parameters NVM_FCCOBLO parameters 0x02 Global address [23:16] to identify Flash block Global address [15:0] in flash block to be verified MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 97
FSTAT[MGSTAT] bits will be set. Table 4-25. Erase verify flash section command error handling Register Error bit Error condition FSTAT ACCERR Set if CCOBIX[2:0] != 010 at command launch Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 98
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 Freescale Semiconductor, Inc.
Page 99
NVM_FSTAT ACCERR 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) Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 100
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 Freescale Semiconductor, Inc.
Page 101
Set if any errors have been encountered during the verify operation Set if any non-correctable errors have been encountered during the verify MGSTAT0 operation 1. As found in the memory map for NVM MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 102
Upon clearing FSTAT[CCIF] to launch the erase flash sector command, the memory controller will erase the selected flash sector and then verify that it is erased. The FSTAT[CCIF] flag will be set after the erase flash sector operation has completed. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 103
Set if any errors have been encountered during the verify operation Set if any non-correctable errors have been encountered during the verify MGSTAT0 operation 1. As found in the memory map for NVM MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 104
ACCERR Set if backdoor key access has not been enabled (KEYEN[1:0] ≠ 10 NVM_FSTAT Set if the backdoor key has mismatched since the last reset FPVIOL None MGSTAT1 None MGSTAT0 None MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 105
Level description (CCOBIX = 010) 0x0000 Return to normal level 0x0001 User margin-1 level 0x0002 User margin-0 level 1. Read margin to the erased state 2. Read margin to the programmed state MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 106
Error bit Error condition Set if CCOBIX[2:0] ≠ 010 at command launch FSTAT ACCERR Set if command is not available in current mode (see Table 4-9) Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 107
Table 4-48. Program EEPROM command error handling Register Error Bit Error condition Set if CCOBIX[2:0] < 010 at command launch NVM_FSTAT ACCERR Set if CCOBIX[2:0] >101 at command launch Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 108
Set if the selected area of the EEPROM memory is protected MGSTAT1 Set if any errors have been encountered during the verify operation Set if any non-correctable errors have been encountered during the verify MGSTAT0 operation MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
NOTE The FCLKDIV register must not be written while a flash command is executing (NVM_FSTAT[CCIF] = 0) Address: 3020h base + 0h offset = 3020h Read FDIVLD FDIVLCK FDIV Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The KEYEN[1:0] bits define the enabling of backdoor key access to the flash module. NOTE: 01 is the preferred KEYEN state to disable backdoor key access. Disabled Disabled Enabled Disabled Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The ACCERR bit is cleared by writing a 1 to ACCERR. Writing a 0 to the ACCERR bit has no effect on ACCERR. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The setting of the DFDIF flag indicates that a double bit fault was detected in the stored parity and data bits during a flash array read operation or that a flash array read operation returning invalid data was Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FPVIOL bit will be set in the FSTAT register. The block erase of a flash block is not possible if any of the flash sectors contained in the same flash block are protected. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The FPLS bits determine the size of the protected/unprotected area in flash memory. The FPLS bits can only be written to while the FPLIDS bit is set. 4.6.9 EEPROM Protection Register (NVM_EEPROT) The EEPROT register defines which EEPROM sectors are protected against program and erase operations. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 117
This field is reserved. Reserved This read-only field is reserved and always has the value 0. EEPROM Protection Size These bits determine the size of the protected area in the EEPROM memory. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
During the reset sequence, the FOPT register is loaded from the flash nonvolatile byte in the flash configuration field at global address 0xFF7E located in flash memory as indicated by reset condition. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 119
The NV[7:0] bits are available as nonvolatile bits. During the reset sequence, the FOPT register is loaded from the flash nonvolatile byte in the flash configuration field at global address 0xFF7E located in flash memory. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 120
Flash and EEPROM registers descriptions MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ISR itself, which is called nesting of interrupts. Normally, the I bit is restored to 0 when the CCR is restored from the value stacked on MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CCR was saved. The PC value that is stacked is the address of the instruction in the main program that would have executed next if the interrupt had not occurred. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(I bit in the CCR) is 0, the CPU finishes the current instruction, stacks the PCL, PCH, X, A, and CCR CPU registers, sets the I bit, and then fetches the interrupt vector for the highest priority pending interrupt. Processing then continues in the interrupt service routine. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 124
RDRF 0xFFC8:FFC9 Vsci1rx SCI1 SCI1 receive LBKDIF LBKDIE RXEDGIF RXEDGIE ORIE NEIE 0xFFCA:FFCB Vsci1err SCI1 SCI1 error FEIE PEIE 0xFFCC:FFCD Vsci0tx SCI0 TRDE SCI0 transmit Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Interrupt priority mask can be modified during main flow or interrupt service execution. • Previous interrupt mask level is automatically stored when interrupt vector is fetched (four levels of previous values accommodated) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The IPC consists of three major functional blocks: • The interrupt priority level registers • The interrupt priority level comparator set • The interrupt mask register update and restore mechanism MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
IPM. If the last position of IPMPS is written, the PSF flag indicates that the IPMPS is full. If all the values in the IPMPS were read, the PSE flag indicates that the IPMPS is empty. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Before leaving the interrupt service routine, the previous levels must be restored manually by setting PULIPM bit. Watch out for the full (PSF) bit and empty (PSE) bit. 5.2 IRQ The IRQ (external interrupt) module provides a maskable interrupt input. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When the MCU is in stop mode and system clocks are shut down, a separate asynchronous path is used so that the IRQ, if enabled, can wake the MCU. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Reads always return 0. If edge-and-level detection is selected (IRQMOD = 1), IRQF cannot be cleared while the IRQ pin remains at its asserted level. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(ILRxx) value that is greater than or equal to the value of IPM will be presented to the CPU. Writes to this field are allowed, but doing this will not push information to the Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(ILRSn is ILRS0 through ILRS9). Address: 3Eh base + 3012h offset + (1d × i), where i=0d to 9d Read ILRn3 ILRn2 ILRn1 ILRn0 Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 136
Interrupt Level Register for Source n*4+1 ILRn1 This field sets the interrupt level for interrupt source n*4+1. ILRn0 Interrupt Level Register for Source n*4+0 This field sets the interrupt level for interrupt source n*4+0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(SP) and system control settings. SP is forced to 0x00FF at reset. This device has the following sources for reset: • Power-on reset (POR) • Low-voltage detect (LVD) • Watchdog (WDOG) timer • Illegal opcode detect (ILOP) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
6.4.3 SCI0 pin reassignment After reset, SCI0 module pinouts of RxD and TxD are mapped on PTB0 and PTB1, respectively. SYS_SOPT1[SCI0PS] bit enables to reassign SCI0 pinouts on PTA2 and PTA3. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The system bus clock can be outputted on PTH2 when the SYS_SOPT3[CLKOE] bits are set by nonzero. Before mapping on the pinout, the output of bus clock can be pre-divided by 1, 2, 4, 8, 16, 32, 64, or 128 by setting SYS_SOPT3[BUSREF]. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TXD0 pinout. When this bit is clear, the TXD is directly mapped on the pinout. To enable IR modulation function, both FTM0CH0 and SCI must be active. The FTM0 counter modulo register specifies the period of the PWM, and the FTM0 channel 0 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SCI0 external RxD0 pin is released to other shared functions regardless of the configuration of SCI0 pin reassignment. When SCI0 RxD capture function is active, the ACMP output is injected to FTM0CH1 as well. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When a debug host forces reset by writing 1 to the SYS_SBDFR[BDFR] bit, none of the status bits in SRS will be set. The reset state of these bits depends on what caused the MCU to reset. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 144
ENBDM = 0 in the BDCSC register. Reset not caused by an illegal opcode. Reset caused by an illegal opcode. Illegal Address ILAD Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SYS_SBDFR field descriptions Field Description 7–1 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Background Debug Force Reset BDFR Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
HCS08 derivative and revision number. This allows the development software to recognize where specific memory blocks, registers, and control bits are located in a target MCU. Address: 3000h base + 3h offset = 3003h Read Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTA4. This pin defaults to the BKGD/MS function following any MCU reset. PTA4/ACMPO/BKGD/MS as PTA4 or ACMPO function. PTA4/ACMPO/BKGD/MS as BKGD function. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Write FTMSYNC Reset SYS_SOPT2 field descriptions Field Description SCI0 TxD Modulation Select TXDME This bit enables the SCI0 TxD output modulated by FTM0 channel 0. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 149
These bits select the ADC hardware trigger source. All trigger sources start ADC conversion on rising edge. RTC overflow as the ADC hardware trigger. MTIM0 overflow as the ADC hardware trigger. FTM2 init trigger with 8-bit programmable delay. FTM2 match trigger with 8-bit programmable delay. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Bus divided by 16. Bus divided by 32. Bus divided by 64. Bus divided by 128. 6.6.8 System Options Register 4 (SYS_SOPT4) Address: 3000h base + 7h offset = 3007h Read DELAY Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SYS_ILLAH field descriptions Field Description ADDR[15:8] High 8-bit of illegal address NOTE: For ILAD, it reset to the high 8-bit of the illegal address; in other cases, the reset to values are undetermined. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• internal pullups disabled (PTxPEn = 0). Additionally, the parallel I/O that support high drive capability are disabled (HDRVE = 0x00) after reset. The following three figures show the structures of each I/O pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 158
Introduction PTxPEn PTxOEn PTxDn PTxIEn CPU read PTxDn Figure 7-1. Normal I/O structure PTxPEn PTxOEn PTxIEn PTxDn CPU read PTxDn Figure 7-2. SDA(PTA2)/SCL(PTA3) structure MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When a peripheral module or system function is in control of a port pin, the data direction register bit still controls what is returned for reads of the port data register, even though the peripheral system has overriding control of the actual pin direction. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
1~128 LPOCLKs). This configurable glitch filter can take the place of an on board external analog filter, and greatly improve the EMC performance. Setting register PORT_IOFLTn can configure the filter of the whole port, etc. set PORT_IOFLT0[FLTA] will affect all PTAn pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
7.7.14/173 30B5 Port F Output Enable Register (PORT_PTFOE) 7.7.15/174 30B6 Port G Output Enable Register (PORT_PTGOE) 7.7.16/175 30B7 Port H Output Enable Register (PORT_PTHOE) 7.7.17/176 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
For port A pins that are configured as Hi-Z, a read returns uncertainty data. Writes are latched into all bits of this register. For port A pins that are configured as outputs, the logic level is driven out of the corresponding MCU pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
For port C pins that are configured as Hi-Z, a read returns uncertainty data. Writes are latched into all bits of this register. For port C pins that are configured as outputs, the logic level is driven out of the corresponding MCU pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
For port E pins that are configured as Hi-Z, a read returns uncertainty data. Writes are latched into all bits of this register. For port E pins that are configured as outputs, the logic level is driven out of the corresponding MCU pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
For port G pins that are configured as inputs, a read returns the logic level on the pin. For port G pins that are configured as outputs, a read returns the last value that was written to this register. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read-only field is reserved and always has the value 0. Port H Data Register Bit 2 PTHD2 Port H Data Register Bit 1 PTHD1 Port H Data Register Bit 0 PTHD0 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTD0 is disabled to offer high current drive capability. PTD0 is enable to offer high current drive capability. PTB5 PTB5 This read/write bit enables the high current drive capability of PTB5 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Output Enabled for port A bit 4. Output Enable for Port A Bit 3 PTAOE3 This read/write bit enables the port A pin as an output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Output Enabled for port B bit 6. Output Enable for Port B Bit 5 PTBOE5 This read/write bit enables the port B pin as an output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Reset PORT_PTCOE field descriptions Field Description Output Enable for Port C Bit 7 PTCOE7 This read/write bit enables the port C pin as an output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 171
Output Enable for Port C Bit 0 PTCOE0 This read/write bit enables the port C pin as an output. Output Disabled for port C bit 0. Output Enabled for port C bit 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Output Enabled for port D bit 2. Output Enable for Port D Bit 1 PTDOE1 This read/write bit enables the port D pin as an output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Output Enabled for port E bit 4. Output Enable for Port E Bit 3 PTEOE3 This read/write bit enables the port E pin as an output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Output Enabled for port F bit 6. Output Enable for Port F Bit 5 PTFOE5 This read/write bit enables the port F pin as an output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTGOE0 Write Reset PORT_PTGOE field descriptions Field Description 7–4 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read/write bit enables the port H pin as an output. Output Disabled for port H bit 6. Output Enabled for port H bit 6. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Input enabled for port A bit 6. Input Enable for Port A Bit 5 PTAIE5 This read/write bit enables the port A pin as an input. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read/write bit enables the port B pin as an input. Input disabled for port B bit 7. Input enabled for port B bit 7. Input Enable for Port B Bit 6 PTBIE6 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Input enabled for port B bit 0. 7.7.20 Port C Input Enable Register (PORT_PTCIE) Address: 0h base + 30BAh offset = 30BAh Read PTCIE7 PTCIE6 PTCIE5 PTCIE4 PTCIE3 PTCIE2 PTCIE1 PTCIE0 Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 180
Input Enable for Port C Bit 0 PTCIE0 This read/write bit enables the port C pin as an input. Input disabled for port C bit 0. Input enabled for port C bit 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Input enabled for port D bit 2. Input Enable for Port D Bit 1 PTDIE1 This read/write bit enables the port D pin as an input. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Input enabled for port E bit 4. Input Enable for Port E Bit 3 PTEIE3 This read/write bit enables the port E pin as an input. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Input enabled for port F bit 6. Input Enable for Port F Bit 5 PTFIE5 This read/write bit enables the port F pin as an input. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTGIE0 Write Reset PORT_PTGIE field descriptions Field Description 7–4 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read/write bit enables the port H pin as an input. Input disabled for port H bit 6. Input enabled for port H bit 6. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Description 7–6 Filter selection for input from PTD FLTD BUSCLK FLTDIV1 FLTDIV2 FLTDIV3 5–4 Filter selection for input from PTC FLTC BUSCLK FLTDIV1 FLTDIV2 FLTDIV3 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FLTDIV3 5–4 Filter selection for input from PTG FLTG BUSCLK FLTDIV1 FLTDIV2 FLTDIV3 3–2 Filter selection for input from PTF FLTF BUSCLK FLTDIV1 FLTDIV2 FLTDIV3 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Filter selection for input from RESET/IRQ No filter. Select FLTDIV1, and will switch to FLTDIV3 in stop mode automatically. Select FLTDIV2, and will switch to FLTDIV3 in stop mode automatically. FLTDIV3 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
NOTE: When configuring to use this pin as output high for IIC, the internal pullup device remains active when PTAPE2 is set. It is automatically disabled to save power when output low. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Hi-Z, these bits have no effect. Pullup disabled for port B bit 5. Pullup enabled for port B bit 5. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Address: 0h base + 30F2h offset = 30F2h Read PTCPE7 PTCPE6 PTCPE5 PTCPE4 PTCPE3 PTCPE2 PTCPE1 PTCPE0 Write Reset PORT_PTCPE field descriptions Field Description Pull Enable for Port C Bit 7 PTCPE7 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 193
This control bit determines if the internal pullup device is enabled for the associated PTC pin. For port C pins that are configured as outputs or Hi-Z, these bits have no effect. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Hi-Z, these bits have no effect. Pullup disabled for port D bit 3. Pullup enabled for port D bit 3. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Hi-Z, these bits have no effect. Pullup disabled for port E bit 6. Pullup enabled for port E bit 6. Pull Enable for Port E Bit 5 PTEPE5 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Pullup enabled for port E bit 0. 7.7.35 Port F Pullup Enable Register (PORT_PTFPE) Address: 0h base + 30F5h offset = 30F5h Read PTFPE7 PTFPE6 PTFPE5 PTFPE4 PTFPE3 PTFPE2 PTFPE1 PTFPE0 Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 197
Hi-Z, these bits have no effect. Pullup disabled for port F bit 1. Pullup enabled for port F bit 1. Pull Enable for Port F Bit 0 PTFPE0 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This control bit determines if the internal pullup device is enabled for the associated PTG pin. For port G pins that are configured as outputs or Hi-Z, these bits have no effect. Pullup disabled for port G bit 0. Pullup enabled for port G bit 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This control bit determines if the internal pullup device is enabled for the associated PTH pin. For port H pins that are configured as outputs or Hi-Z, these bits have no effect. Pullup disabled for port H bit 0. Pullup enabled for port H bit 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 200
Port data registers MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The low-power oscillator (LPO) module is an on-chip low-power oscillator providing 1 kHz reference clock to RTC and watchdog (WDOG). The following figures show the block diagram, highlighting the clock modules. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 202
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 8-1. Device block diagram highlighting clock modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ICSIRCLK, which can be used as an additional clock source. To re-target the ICSIRCLK frequency, write a new value to the ICS_C3[SCTRIM] and ICS_C4[SCFTRIM] bits to trim the period of the internal reference clock: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
There are seven modes of operation for the ICS: FEI, FEE, FBI, FBILP, FBE, FBELP, and stop. The following figure shows the seven states of the ICS as a state diagram. The arrows indicate the allowed movements between the states. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FLL engaged internal (FEI) is the default mode of operation and is entered when all of the following conditions occur: • ICS_C1[CLKS] bits are written to 0b • ICS_C1[IREFS] bit is written to 1b MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The FLL clock is controlled by the internal reference clock, and the FLL loop locks the FLL frequency to the 512 times the internal reference frequency. The ICSLCLK will be available for BDC communications, and the internal reference clock is enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
8.2.2.6 FLL bypassed external low power (FBELP) The FLL bypassed external low power (FBELP) mode is entered when all of the following conditions occur: • ICS_C1[CLKS] bits are written to 10 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The DCO frequency changes from the pre-stop value to its reset value and the FLL need to re-acquire the lock before the frequency is stable. Timing sensitive operations must wait for the FLL acquisition time, t , before executing. Aquire MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
8.3 Initialization / application information This section provides example code to give some basic direction to a user on how to initialize and configure the ICS module. The example software is implemented in C language. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(ICS), the real time counter clock module, and other MCU sub-systems. OSCINIT Initialization Oscillator High Gain XTLCLK Oscillator RANGE Low-Powe r OSCOS OSCOUT EXTAL XTAL Figure 8-4. Oscillator module block diagram MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ICS_OSCSC[HGO] = 0, the series resistor R is not used. The feedback resistor R must be carefully selected to get best performance. The figure below shows the typical OSC low-gain mode connection. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In stop modes, the bus clock is disabled for all gated peripherals, regardless of the setting in SCG_Cx registers. 8.6 ICS control registers MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Selects the amount to divide down the FLL reference clock selected by the IREFS bits. Resulting frequency must be in the range 31.25 kHz to 39.0625 kHz. RDIV ICS_OSCSC[RANGE]= 0 ICS_OSCSC[RANGE]= 1 1024 Reserved Reserved Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
LOLIE Determines if an interrupt request is made following a loss of lock indication. The LOLIE bit has an effect only when LOLS is set. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
IREFS, RDIV[2:0], or, if in FEI or FBI modes, TRIM[7:0] will cause the lock status bit to clear and stay cleared until the FLL has reacquired lock. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ICS_OSCSC field descriptions Field Description OSC Enable OSCEN The OSCEN bit enables the external clock for use as ICSERCLK. OSC module disabled. OSC module enabled. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
System Clock Gating Control 1 Register (SCG_C1) 8.7.1/223 300D System Clock Gating Control 2 Register (SCG_C2) 8.7.2/224 300E System Clock Gating Control 3 Register (SCG_C3) 8.7.3/225 300F System Clock Gating Control 4 Register (SCG_C4) 8.7.4/226 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This bit controls the clock gate to the MTIM1 module. Bus clock to the MTIM1 module is disabled. Bus clock to the MTIM1 module is enabled. MTIM0 Clock Gate Control MTIM0 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Bus clock to the DBG module is disabled. Bus clock to the DBG module is enabled. NVM Clock Gate Control This bit controls the clock gate to the NVM module. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read-only field is reserved and always has the value 0. SCI2 Clock Gate Control SCI2 This bit controls the clock gate to the SCI2 module. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
NOTE User software should disable the peripheral before disabling the clocks to the peripheral. When clocks are re-enabled to a peripheral, the peripheral registers need to be re-initialized by user software. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 227
KBI0 Clock Gate Control KBI0 This bit controls the clock gate to the KBI0 module. Bus clock to the KBI0 module is disabled. Bus clock to the KBI0 module is enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 228
System clock gating control registers MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The trigger can also provide extended breakpoint capacity. The on-chip ICE system is optimized for the HCS08 8-bit architecture and supports 64 KB of memory space. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The low-power oscillator (LPO) module is an on-chip low-power oscillator providing 1 kHz reference clock to RTC and watchdog (WDOG). The following figures show the block diagram, highlighting the clock modules. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 231
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-1. Device block diagram highlighting clock modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The 16-bit code is calculated for 8-bit of data at a time, and provides a simple check for all accessible memory locations in flash and RAM. The following figure shows the device block diagram highlighting the CRC module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 234
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-2. Device block diagram highlighting CRC module MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PTC3/FTM2CH3 PTD1/FTM2CH3 FTM2 channel 4 PTB4/FTM2CH4 channel 5 PTB5/FTM2CH5 fault 1 PTA6/FTM2FAULT1 fault 2 PTA7/FTM2FAULT2 alternate clock PTE7/TCLK2 The following figure shows the device block diagram highlighting FTM modules and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 236
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-3. Device block diagram highlighting FTM modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
A timer overflow interrupt can be enabled to generate periodic interrupts for time-based software events. MTIM modules may also use external clock source. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 238
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-4. Block diagram highlighting the MTIM modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADC and TSI module. Furthermore, when the trigger is enabled, RTC can toggle external pin function if the counter overflows. The following figure shows the device block diagram highlighting RTC module and pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 240
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-5. Device block diagram highlighting RTC module and pin MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Hardware parity, receiver wakeup, and double buffering on transmit and receive are also included. The following figure shows the device block diagram highlighting SCI modules and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 242
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-6. Device block diagram highlighting SCI modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MCU and peripheral devices. These peripheral devices can include other microcontrollers, analog-to-digital converters, shift registers, sensors, memories, etc. The following figure shows the device block diagram highlighting 8-bit SPI module and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 245
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-7. Device block diagram highlighting 8-bit SPI module and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MCU and peripheral devices. These peripheral devices can include other microcontrollers, analog-to-digital converters, shift registers, sensors, memories, etc. The following figure shows device block diagram highlighting 16-bit SPI module and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 247
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-8. Device block diagram highlighting 16-bit SPI module and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
9.9.4 Inter-Integrated Circuit (I2C) This device contains an inter-integrated circuit (I2C) module for communication with other integrated circuits. The following figure shows the device block diagram highlighting I2C module and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 249
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-9. Device block diagram highlighting I2C module and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADC for operation within an integrated microcontroller system-on-chip. The ADC channel assignments, alternate clock function, and hardware trigger function are configured as described following sections. The following figure shows device block diagram highlighting ADC module and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-10. Device block diagram highlighting ADC module and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
V • Convert the temperature sensor channel (AD22) • By using the calculated value of V , convert the digital value of AD22 into a voltage, V TEMP MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When using the bandgap reference voltage as the reference voltage to the built-in DAC, the user must enable the bandgap buffer by setting BGBE =1 in SPMSC1. For value of bandgap voltage reference see Bandgap reference. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 255
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-11. Device block diagram highlighting ACMP modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ACMP module output can be directly ejected to SCI0 RxD. In this mode, SCI0 external RxD pinout does not work. Any external signal tagged to ACMP inputs can be regarded as input pins. Please refer SCI0 RxD filter. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This device has two KBI modules with up to 16 keyboard interrupt inputs grouped in two KBI modules available depending on packages. The following figure shows the device block diagram with the KBI modules and pins highlighted. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 258
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-12. Block diagram highlighting KBI modules and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The following figure shows the device block diagram highlighting TSI module and pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(pin 41 and pin 40 in 64-pin packages) and the third V (pin 13 in 64-pin packages) are not bonded in 32-pin packages. Figure 9-13. Device block diagram highlighting TSI module and pins MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The TSI module supports two triggers: a software and a hardware trigger. The hardware trigger is connected to the RTC overflow flag. When the TSI module has the hardware trigger enabled, the module starts measurement immediately if an RTC overflows. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Relative — 8-bit signed offset to branch destination • Immediate — Operand in next object code byte(s) • Direct — Operand in memory at 0x0000–0x00FF • Extended — Operand anywhere in 64-Kbyte address space MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The A accumulator is a general-purpose 8-bit register. One input operand from the arithmetic logic unit (ALU) is connected to the accumulator, and the ALU results are often stored into the A accumulator after arithmetic and logical operations. The MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The RSP (reset stack pointer) instruction was included for compatibility with the M68HC05 family and is seldom used in new HCS08 V6 programs because it affects only the low-order half of the stack pointer. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TAP). This ensures that the next instruction after a CLI or TAP will always be executed without the possibility of an intervening interrupt, provided I was set. 0 Interrupts enabled Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Effective address computations do not require extra execution cycles. The HCS08 V6 CPU uses the 16 addressing modes described in the following sections. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
LDA $55 means to load the value from address $0055 into the accumulator. Without the # symbol, the instruction is erroneously interpreted as a direct addressing instruction. Example: #$55 CPHX #$FFFF LDHX #$67 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In extended addressing, the full 16-bit address of the memory location to be operated on is provided in the instruction. Extended addressing can access any location in the 64 KB memory map. Example: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The table can begin anywhere and can extend as far as the address map allows. The k value would typically be in H:X, and the address of the beginning of the table would be MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The sum is the effective address of the operand. If interrupts are disabled, this addressing mode allows the stack pointer to be used as a second "index" register. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This addressing mode is used to move an 8-bit constant to any location in the direct page memory. The source data is the byte immediately following the opcode, and the destination is addressed by the second byte following the opcode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CPU clocks will resume and the CPU will enter active background mode where other serial background commands can be processed. This ensures that a host development system can still gain access to a target MCU even if it is in stop mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MCU operation during software development. Active background mode is entered in any of the following ways: • When the BKGD/MS pin is low at the time the MCU exits reset. • When a BACKGROUND command is received through the BKGD pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Core. The core receives an external input signal that, when asserted, informs to the core that the MCU is in secure mode. While in secure mode, the core controls the following set of conditions: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 276
Table 10-2. Security conditions for read access Inputs conditions Read control Ram, flash or Security Program or Current CPU instruction Current access Read access EEPROM enabled vector read from secure memory is via BDC allowed access MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(SWI) instruction, except the address used for the vector fetch is determined by the highest priority interrupt that is pending when the interrupt sequence started. The CPU sequence for an interrupt is: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 286
Register High) onto 0x0001 Stack Push (X); SP ← (SP) – PSHX Push X (Index − − − − − − Register Low) onto 0x0001 Stack Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 287
Pull (PCH) SP ← (SP) + 0x0001, Pull (PCL) SP ← SP + 0x0001, Pull (PCH) Return from − − − − − − Subroutine Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 288
SUB #opr8i − − ↕ ↕ ↕ ↕ SUB opr8a − − ↕ ↕ ↕ ↕ SUB opr16a − − hh ll ↕ ↕ ↕ ↕ Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 289
− − − − − − Low) to Accumulator SP ← (H:X) – 0x0001 Transfer Index − − − − − − Register to SP Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 290
Table 10-3. Instruction Set Summary (continued) Effect on CCR Address N Z C Source Form Operation Description Mode I bit ← 0, Halt CPU WAIT Enable Interrupts Wait − − − − − for Interrupt MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
KBIx_SC[KBMOD] bit. Edge sensitive can be software programmed to be either falling or rising; the level can be either low or high. The polarity of the edge or edge and level sensitivity is selected using the KBIx_ES[KBEDGn] bits. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If an internal pullup resistor is enabled for an enabled KBI pin, the associated I/O port pull select register (see I/O Port chapter) can be used to select an internal pullup resistor. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
3. Before using internal pullup resistors, configure the associated bits in PORT_PTxPE. 4. Enable the KBI pins by setting the appropriate KBIx_PE[KBIPEn] bits. 5. Write to KBIx_SC[KBACK] to clear any false interrupts. 6. Set KBIx_SC[KBIE] to enable interrupts. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
A small exception to this is when the FlexTimer clock frequency is twice bus clock frequency to provide extra resolution for high speed PWM applications. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Each channel can be configured for input capture, output compare, or edge-aligned PWM mode • In input capture mode: • The capture can occur on rising edges, falling edges or both edges • An input filter can be selected for some channels MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FTM does not need to produce a real time reference or provide the interrupt sources needed to wake the MCU from wait mode, the power can then be saved by disabling FTM functions before entering wait mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The following figure shows the FTM structure. The central component of the FTM is the 16-bit counter with programmable initial and final values and its counting can be up or up-down. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FAULTM[1:0] and FAULTEN control bits are defined for each pair of channels. Each FAULTj input is activated by its corresponding FAULTjEN bit in the FLTCTRL register. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Status and Control (FTM0_SC) 12.3.3/309 Counter High (FTM0_CNTH) 12.3.4/310 Counter Low (FTM0_CNTL) 12.3.5/311 Modulo High (FTM0_MODH) 12.3.6/311 Modulo Low (FTM0_MODL) 12.3.7/312 Channel Status and Control (FTM0_C0SC) 12.3.8/312 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 306
12.3.23/332 Fault Input Filter Control (FTM0_FLTFILTER) 12.3.24/333 Fault Input Control (FTM0_FLTCTRL) 12.3.25/334 Status and Control (FTM1_SC) 12.3.3/309 Counter High (FTM1_CNTH) 12.3.4/310 Counter Low (FTM1_CNTL) 12.3.5/311 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 307
Channels Polarity (FTM1_POL) 12.3.21/329 Fault Mode Status (FTM1_FMS) 12.3.22/331 Input Capture Filter Control (FTM1_FILTER0) 12.3.23/332 Input Capture Filter Control (FTM1_FILTER1) 12.3.23/332 Fault Input Filter Control (FTM1_FLTFILTER) 12.3.24/333 Fault Input Control (FTM1_FLTCTRL) 12.3.25/334 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 308
Deadtime Insertion Control (FTM2_DEADTIME) 12.3.19/327 30E3 External Trigger (FTM2_EXTTRIG) 12.3.20/328 30E4 Channels Polarity (FTM2_POL) 12.3.21/329 30E5 Fault Mode Status (FTM2_FMS) 12.3.22/331 30E6 Input Capture Filter Control (FTM2_FILTER0) 12.3.23/332 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CPWMS is write protected. It can be written only when MODE[WPDIS] = 1. FTM counter operates in up counting mode. FTM counter operates in up-down counting mode. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
BDM is active. This assures that if you were in the middle of reading a 16-bit register when BDM became active, it reads the appropriate value from the other half of the 16-bit value after returning to normal execution. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
BDM is active. Any write to the modulo register bypasses the buffer latches and directly writes to the modulo register while BDM is active. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Table 12-73. Mode, edge, and level selection DECAPEN COMBINE CPWMS MSnB:MSnA ELSnB:ELSnA Mode Configuration None Pin not used for Input capture Capture on Rising Edge Only Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 314
This field is reserved. Reserved This read-only field is reserved and always has the value 0. This field is reserved. Reserved This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FTM clock, write the new value to the Counter Initial Value registers and then initialize the FTM counter by writing any value to CNT). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If another event occurs between the read and write operations, the write operation has no effect; therefore, CHF remains set indicating an event has occurred. In this case, a CHF interrupt request is not lost due to the clearing sequence for a previous CHF. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 318
No channel event has occurred. A channel event has occurred. Channel 2 Flag CH2F See the register description. No channel event has occurred. A channel event has occurred. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Fault control is enabled for all channels, and the selected mode is the manual fault clearing. Fault control is enabled for all channels, and the selected mode is the automatic fault clearing. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This register configures the PWM synchronization. A synchronization event can perform the synchronized update of MOD, CV, and OUTMASK registers with the value of their write buffer and the FTM counter initialization. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 321
Selects external trigger 0 as the PWM synchronization trigger. External trigger 0 occurs when the FTM detects a rising edge in the trigger 0 input signal. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FTMx_OUTINIT field descriptions Field Description Channel 7 Output Initialization Value CH7OI Selects the value that is forced into the channel output when the initialization occurs. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 323
The initialization value is 1. Channel 0 Output Initialization Value CH0OI Selects the value that is forced into the channel output when the initialization occurs. The initialization value is 0. The initialization value is 1. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Channel output is masked. It is forced to its inactive state. Channel 3 Output Mask CH3OM Defines if the channel output is masked (forced to its inactive state) or unmasked (it continues to operate normally). Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Address: Base address + 1Eh offset + (1d × i), where i=0d to 2d Read FAULTEN SYNCEN DTEN DECAP DECAPEN COMP COMBINE Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 326
This field is write protected. It can be written only when MODE[WPDIS] = 1. The channel (n+1) output is the same as the channel (n) output. The channel (n+1) output is the complement of the channel (n) output. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• When DTVAL is 2, 2 counts are inserted. This pattern continues up to a possible 63 counts. DTVAL is write protected. It can be written only when MODE[WPDIS] = 1. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Enables the generation of the channel trigger when the FTM counter is equal to the CV register. The generation of the channel trigger is disabled. The generation of the channel trigger is enabled. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This field is write protected. It can be written only when MODE[WPDIS] = 1. The channel polarity is active high. The channel polarity is active low. Channel 6 Polarity POL6 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 330
Defines the polarity of the channel output. This field is write protected. It can be written only when MODE[WPDIS] = 1. The channel polarity is active high. The channel polarity is active low. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FAULTF while there is no existing fault condition at the fault input n. Writing a 1 to FAULTFn has no effect. FAULTFn bit is also cleared when FAULTF bit is cleared. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
No fault condition was detected in the fault input. A fault condition was detected in the fault input. 12.3.23 Input Capture Filter Control (FTMx_FILTERn) This register selects the filter value for the inputs of channels. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This field is reserved. Reserved This read-only field is reserved and always has the value 0. FFVAL Fault Input Filter Selects the filter value for the fault inputs. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Enables the filter for the fault input. This field is write protected. It can be written only when MODE[WPDIS] = 1. Fault input filter is disabled. Fault input filter is enabled. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
12.4 Functional Description The following sections describe the FTM features. The notation used in this document to represent the counters and the generation of the signals is shown in the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Refer to chip specific documentation for further information. Due to FTM hardware implementation limitations, the frequency of the fixed frequency clock must not exceed the system clock frequency. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The value of CNTINH:L is loaded into the FTM counter, and the counter increments until the value of MODH:L is reached, at which point the counter is reloaded with CNTINH:L. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 338
Conversely, if (CNTINH[7] = 0 and CNTINH:L ≠ 0x0000), then the initial value of the FTM counter is a positive number, therefore the FTM counting is up and unsigned. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 339
MODH:L is not recommended as this unusual setting may make the FTM operation difficult to comprehend. However, there is no restriction on this configuration, and an example is shown in the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The TOF bit is set when the FTM counter changes from MODH:L to (MODH:L – 1). If (CNTINH:L = 0x0000), the FTM counting is equivalent to TPM up-down counting; that is, up-down and unsigned counting. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TOF bit Figure 12-192. Example when the FTM counter is a free running The FTM counter is also a free running counter when all of the following apply: • (FTMEN = 1) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
While in BDM, the input capture function works as configured. When a selected edge event occurs, the FTM counter value, which is frozen because of BDM, is captured into the CnVH:L registers and the CHnF bit is set. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(the counter exceeds the value of the CHnFVAL[3:0] bits), the state change of the input signal is validated. It is then transmitted as a pulse edge to the edge detector. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Figure 12-195. Channel input filter example 12.4.5 Output compare mode The output compare mode is selected when (DECAPEN = 0), (COMBINE = 0), (CPWMS = 0) and (MSnB:MSnA = 0:1). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 345
CNTH:L channel (n) output previous value previous value CHnF bit TOF bit Figure 12-198. Example of the output compare mode when the match sets the channel output MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If (ELSnB:ELSnA = 0:0) when the counter reaches the value in the CnVH:L registers, the CHnF bit is set and the channel (n) interrupt is generated (if CHnIE = 1), however, the channel (n) output is not controlled by FTM. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 347
0xFFFF in order to get a 100% duty cycle EPWM signal. Note • EPWM mode is available only with (CNTINH:L = 0x0000). • EPWM mode with (CNTINH:L ≠ 0x0000) is not recommended and its results are not guaranteed. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If (ELSnB:ELSnA = 1:0), then the channel (n) output is forced high at the channel (n) match (FTM counter = CnVH:L) when counting down, and it is forced low at the channel (n) match when counting up; see the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 349
The CPWM mode must not be used when the FTM counter is a free running counter. Note • CPWM mode is available only with (CNTINH:L = 0x0000). • CPWM mode with (CNTINH:L ≠ 0x0000) is not recommended and its results are not guaranteed. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(n) match channel (n) output with ELSnB:ELSnA = 1:0 channel (n) output with ELSnB:ELSnA = X:1 Figure 12-205. Combine mode The following figures illustrate the generation of PWM signals using combine mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 351
C(n)VH:L = CNTINH:L channel (n) output with ELSnB:ELSnA = 1:0 channel (n) output with ELSnB:ELSnA = X:1 Figure 12-208. Channel (n) output if (C(n)V = CNTIN) and (CNTIN < C(n+1)V < MOD) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 352
0% duty cycle with ELSnB:ELSnA = X:1 Figure 12-210. Channel (n) output if (C(n)V = CNTIN) and (CNTIN < C(n+1)V < MOD) and (C(n+1)V is almost equal to MOD) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 353
(n) output 100% duty cycle with ELSnB:ELSnA = X:1 Figure 12-212. Channel (n) output if (CNTIN < C(n)V < MOD) and (CNTIN < C(n+1)V < MOD) and (CnV = C(n+1)V) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 354
(n) output 100% duty cycle with ELSnB:ELSnA = X:1 Figure 12-215. Channel (n) output if (CNTIN < C(n)V < MOD) and (CNTIN < C(n+1)V < MOD) and (C(n)V > C(n+1)V) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 355
CNTINH:L C(n+1)VH:L channel (n) output with ELSnB:ELSnA = 1:0 channel (n) output with ELSnB:ELSnA = X:1 Figure 12-217. Channel (n) output if (C(n+1)V < CNTIN) and (CNTIN < C(n)V < MOD) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 356
C(n)VH:L CNTINH:L channel (n) output with ELSnB:ELSnA = 1:0 channel (n) output with ELSnB:ELSnA = X:1 Figure 12-219. Channel (n) output if (C(n+1)V > MOD) and (CNTIN < C(n)V < MOD) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The channel (n+1) output is the same as the channel (n) output if all of the following apply: • (FTMEN = 1) • (DECAPEN = 0) • (COMBINE = 1) • (CPWMS = 0) • (COMP = 0) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If (CLKS[1:0] = 0:0), then MODH:L registers are updated when their second byte is written, independent of FTMEN bit. If (CLKS[1:0] ≠ 0:0 and FTMEN = 0), then MODH:L registers are updated according to the CPWMS bit: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FTM counter changes from MODH:L to (MODH:L – 0x0001). If (CLKS[1:0] ≠ 0:0 and FTMEN = 1), then CnVH:L registers are updated according to the selected mode: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If a trigger n event occurs together with a write to set the TRIGn bit, then the synchronization is made, but the TRIGn bit remains set because of the last write. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Therefore, it is possible a new write to set SWSYNC happens when FTM is clearing the SWSYNC because it is the selected boundary cycle of PWM synchronization that was started previously by the software trigger event. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MODH:L and CnVH:L registers is made in the first boundary cycle that occurs with valid conditions for MODH:L or CnVH:L synchronization, except if (PWMSYNC = 0 and REINIT = 1). The CNTMAX and CNTMIN bits are cleared only by software. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If the trigger event was a hardware trigger, then the trigger enable bit (TRIGn) is cleared when the trigger n event is detected. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 364
Figure 12-227. MODH:L synchronization when (PWMSYNC = 0), (REINIT = 1), and software trigger was used If the trigger event was a hardware trigger, then the TRIGn bit is cleared. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The synchronization requires both bytes of CnVH:L to have been written, SYNCEN = 1 and either a hardware or software trigger event as per MODH:L registers synchronization. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If the trigger event was a hardware trigger, then the trigger enable bit (TRIGn) is cleared when the trigger n event is detected. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• If REINIT = 1 and PWMSYNC = 0, then this synchronization is made on the next enabled trigger event. If the trigger event was a software trigger, then the SWSYNC bit is cleared. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 368
FTM counter is reset and channel outputs are forced to their initial value Figure 12-236. FTM counter synchronization when (REINIT = 1), (PWMSYNC = 1), and a hardware trigger was used MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CnVH:L are updated with their write buffer contents when the enabled hardware or software trigger occurs. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 370
SWSYNC bit is cleared when the counter reaches its minimum value after the enabled software trigger has occurred. TRIGn bit TRIGn bit is cleared when the enabled hardware trigger has occurred. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Although in most cases the deadtime delay is not comparable to channels (n) and (n+1) duty cycle, the following figures show examples where the deadtime delay is comparable to the duty cycle. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Any write to a CHnOM bit updates the OUTMASK write buffer. The CHnOM bit is updated with the value of its corresponding bit in the OUTMASK write buffer according OUTMASK register synchronization. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Note Output mask is available only in combine mode. 12.4.14 Fault control The fault control is enabled if (FTMEN = 1) and (FAULTM[1:0] ≠ 0:0). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 375
If the fault control and fault input n are enabled and a rising edge at the fault input n signal is detected, then the FAULTFn bit is set. The FAULTF bit is the logic OR of FAULTFn[3:0] bits. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If the automatic fault clearing is selected (FAULTM[1:0] = 1:1), then the disabled channel outputs are enabled when the fault input signal (FAULTIN) returns to zero and a new PWM cycle begins. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
However, it is recommended to verify the value of the fault input signal (value of the FAULTIN bit) before clearing the FAULTF bit to avoid unpredictable results. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Polarity control is available only in combine mode. 12.4.16 Initialization The initialization forces the CHnOI bit value to the channel (n) output when a one is written to the INIT bit. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The FTM is able to generate multiple triggers in one PWM period. Because each trigger is generated for a specific channel, several channels are required to implement this functionality. This behavior is described in the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
0x0C 0x0D 0x0E 0x0F 0x00 0x01 0x02 0x03 0x04 0x05 FTM counter initialization trigger Figure 12-248. Initialization trigger is generated when the FTM counter achieves the value of CNTINH:L MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 381
Figure 12-251. Initialization trigger is generated if (CNTH:L = CNTINH:L) and (CLKS[1:0] = 0:0) and a value different from zero is written to CLKS[1:0] bits The initialization trigger output provides a trigger signal that is used for on-chip modules. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The next reads of CnVH:L registers return the value that was written to FTM counter and the next reads of CNTH:L register return the next value of the FTM counter. The read coherency mechanism of CNTH:L and CnVH:L registers remains enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(n) of a channel pair. The channel (n) filter can be active in this mode when n is the channels 0 or 2. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 384
C(n)VH:L registers must be read first before reading the C(n+1)VH:L registers. C(n)VH:L registers must be read first than C(n+1)VH:L registers. Note • The CH(n)F, CH(n)IE, MS(n)A, ELS(n)B, and ELS(n)A bits are channel (n) bits. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When the CH(n+1)F bit is set, both edges are captured and the captured values are ready for reading in the C(n)VH:L and C(n+1)VH:L registers. The latest captured values are always available in these registers even after the DECAP bit is cleared. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ELS(n +1)B:ELS(n+1)A bits. Both DECAP and CH(n+1)F bits indicate when two edges of the pulse were captured and the C(n)VH:L and C(n+1)VH:L registers are ready for reading. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 387
The CH(n+1)F bit is set when the second edge of this pulse is detected, that is, the edge selected by ELS(n+1)B:ELS(n+1)A bits. The CH(n+1)F bit indicates when two edges of the pulse were captured and the C(n)VH:L and C(n+1)VH:L registers are ready for reading. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The DECAPEN bit selects the dual edge capture mode, so it keeps set in all operation mode. The DECAP bit is set to MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 389
While the DECAP bit is set the configured measurements are made. The CH(n)F bit is set when the first rising edge is detected, that is, the edge selected by ELS(n)B:ELS(n)A bits. The CH(n+1)F bit MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Thus, the channel (n) is configured to capture the FTM counter value when there is a rising edge at channel (n) input signal, and channel (n+1) to capture the FTM counter value when there is a falling edge at channel (n) input signal. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 391
C(n)VH:L and C(n+1)VH:L registers can be accessed first; however, the C(n)VH:L registers must be read prior to the C(n+1)VH:L registers in dual edge capture oneshot and continuous modes for the read coherency mechanism to work properly. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If (FTMEN = 0), then a write to the CnSC register resets the write coherency mechanism of CnVH:L registers. If (FTMEN = 1), then a write to the CnSC register does not reset the write coherency mechanism of CnVH:L registers. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• The channels are in input capture mode (Input capture mode) • The channels outputs are zero • The channels pins are not controlled by FTM (ELS(n)B:ELS(n)A = 0b00). See table "Mode, Edge, and Level Selection" MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 394
CNTH or CNTL registers (item 3). In this case, it is recommended to use the initialization (Initialization) to update the channel output to the selected value (item 4). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
12.6.2 Channel (n) interrupt The channel (n) interrupt is generated when (CHnIE = 1) and (CHnF = 1). 12.6.3 Fault interrupt The fault interrupt is generated when (FAULTIE = 1) and (FAULTF = 1). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TSTP is cleared. Reset sets TSTP to prevent the MTIM from counting. MTIM counter is active. MTIM counter is stopped. Reserved This field is reserved. This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The MTIM consists of a main 8-bit up-counter with an 8-bit modulo register, a clock source selector, and a prescaler block with nine selectable values. The module also contains software-selectable interrupt logic. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 403
This will prevent the second occurrence from being missed. SC[TOF] is also cleared when a 1 is written to SC[TRST] or when any value is written to the MTIM_MOD register. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
0xAA, it overflows to 0x00 and continues counting. The timer overflow flag, SC[TOF], sets when the counter value changes from 0xAA to 0x00. An MTIM overflow interrupt is generated when SC[TOF] is set, if SC[TOIE] = 1. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Software selectable clock sources for input to prescaler with programmable 16 bit prescaler • XOSC 32.768KHz nominal. • LPO (~1 kHz) • Bus clock 14.2.1 Modes of operation This section defines the RTC operation in Stop, Wait, and Background Debug modes. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Figure 14-1. Real-time counter (RTC) block diagram 14.3 External signal description RTCO is the output of RTC. After MCU reset, the RTC_SC1[RTCO] is set to high. When the counter overflows, the output is toggled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RTIE This read/write bit enables real-time interrupts. If RTIE is set, then an interrupt is generated when RTIF is set. Reset clears RTIE to 0. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Changing the prescaler value clears the prescaler and RTCCNT counters. Reset clears RTCPS to 0000. If RTCLKS = x0, it is 1; if RTCLKS = x1, it is 128. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RTC_MODL, together with RTC_MODH, indicates the value of the 16-bit modulo value. Address: 306Ah base + 3h offset = 306Dh Read MODL Write Reset RTC_MODL field descriptions Field Description MODL RTC Modulo Low MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
14.4.6 RTC Counter Register: Low (RTC_CNTL) RTC_CNTL, together with RTC_CNTH, indicates the read-only value of the current RTC count of the 16-bit counter. Address: 306Ah base + 5h offset = 306Fh Read CNTL Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
14.5.1 RTC operation example This section shows an example of the RTC operation as the counter reaches a matching value from the modulo register. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 413
RTC_MODH and RTC_MODL registers. The real-time interrupt flag, RTC_SC1[RTIF], sets when the counter value changes from 0x7FFF to 0x0000. The RTC_SC1[RTCO] toggles as well when the RTC_SC1[RTIF] is set. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
/* 60 minutes in an hour */ if (Minutes > 59) Hours++; Minutes = 0; /* 24 hours in a day */ if (Hours > 23) Days ++; Hours = 0; MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Selectable transmitter output polarity 15.1.2 Modes of operation See Section Functional description for details concerning SCI operation in these modes: • 8- and 9-bit data modes • Stop mode operation MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TO TxD Transmit Control Pin Logic TxD Direction TXDIR BRK13 TDRE Tx Interrupt Request TCIE Figure 15-1. SCI transmitter block diagram The following figure shows the receiver portion of the SCI. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SCI registers. This section refers to registers and control bits only by their names. A Freescale-provided equate or header file is used to translate these names into the appropriate absolute addresses. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SCI_BDH to buffer the high half of the new value and then write to SCI_BDL. The working value in SCI_BDH does not change until SCI_BDL is written. Address: Base address + 0h offset Read LBKDIE RXEDGIE SBNS Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
These 13 bits in SBR[12:0] are referred to collectively as BR. They set the modulo divide rate for the SCI baud rate generator. When BR is cleared, the SCI baud rate generator is disabled to reduce supply current. When BR is 1 - 8191, the SCI baud rate equals BUSCLK/(16×BR). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
10 or 11 bit times of logic high level needed by the idle line detection logic. Idle character bit count starts after start bit. Idle character bit count starts after stop bit. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Hardware interrupt requested when RDRF flag is 1. Idle Line Interrupt Enable for IDLE ILIE Hardware interrupts from IDLE disabled; use polling. Hardware interrupt requested when IDLE flag is 1. Transmitter Enable Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This register has eight read-only status flags. Writes have no effect. Special software sequences, which do not involve writing to this register, clear these status flags. Address: Base address + 4h offset Read TDRE RDRF IDLE Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 424
The advanced sampling technique used in the receiver takes seven samples during the start bit and three samples in each data bit and the stop bits. If any of these samples disagrees with the rest of the samples Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
LBKDIF is set when the LIN break detect circuitry is enabled and a LIN break character is detected. LBKDIF is cleared by writing a 1 to it. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 426
This status flag can be used to check whether an SCI character is being received before instructing the MCU to go to stop mode. SCI receiver idle waiting for a start bit. SCI receiver active (RxD input not idle). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
NEIE This bit enables the noise flag (NF) to generate hardware interrupt requests. NF interrupts disabled; use polling). Hardware interrupt requested when NF is set. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Read receive data buffer 2 or write transmit data buffer 2. R2T2 Read receive data buffer 1 or write transmit data buffer 1. R1T1 Read receive data buffer 0 or write transmit data buffer 0. R0T0 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Freescale SCI system whose bus frequency is driven by a crystal, the allowed baud rate mismatch is about ±4.5 percent for 8-bit data format and about ±4 percent for 9-bit data MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Writing 0 to SCI_C2[TE] does not immediately release the pin to be a general-purpose I/O pin. Any transmit activity in progress must first be completed. This includes data characters in progress, queued idle characters, and queued break characters. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 431
If the receiving device is another Freescale Semiconductor SCI, the break characters are received as 0s in all eight data bits and a framing error (SCI_S1[FE] = 1) occurs.
In the case of the start bit, the bit is assumed to be 0 if at least two of the samples at MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SCI_BDH[SBNS] selects 1-bit or 2-bit stop bit number that determines how many bit times of idle are needed to constitute a full character time, 10 or 11 or 12 bit times because of the start and stop bits. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SCI_D. If the transmit interrupt enable (SCI_C2[TIE]) bit is set, a hardware interrupt is requested when SCI_S1[TDRE] is set. Transmit complete (SCI_S1[TC]) indicates that the transmitter is MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This function depends on the receiver being enabled (SCI_C2[RE] = 1). 15.4.5 Baud rate tolerance A transmitting device may operate at a baud rate below or above that of the receiver. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RT cycles = 163 RT cycles. The maximum percent difference between the receiver count and the transmitter count of a slow 9-bit or 2 stop bits character with no errors is: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
11 bit times x 16 RT cycles = 176 RT cycles. The maximum percent difference between the receiver count and the transmitter count of a fast 9-bit or 2 stop bits character with no errors is: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In custom protocols, the ninth bit can also serve as a software-controlled marker. 15.4.6.2 Stop mode operation During all stop modes, clocks to the SCI module are halted. No SCI module registers are affected in Stop3 mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In single-wire mode, the transmitter output is internally connected to the receiver input and the RxD pin is not used by the SCI, so it reverts to a general-purpose port I/O pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
16.1.3 Block Diagrams This section includes block diagrams showing SPI system connections, the internal organization of the SPI module, and the SPI clock dividers that control the master mode bit rate. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When the SPI is configured as a slave, the SPSCK pin is routed to the clock input of the SPI, the shifter output is routed to MISO, and the shifter input is routed from the MOSI pin. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPI control bits. When the SPI is disabled (SPE = 0), these four pins revert to other functions that are not controlled by the SPI (based on chip configuration). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPI is enabled as a master and MODFEN is 1, the slave select output enable bit determines whether this pin acts as the mode fault input (SSOE is 0) or as the slave select output (SSOE is 1). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This bit enables the SPI system and dedicates the SPI port pins to SPI system functions. If SPE is cleared, the SPI is disabled and forced into an idle state, and all status bits in the S register are reset. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 447
This bit does not affect the position of the MSB and LSB in the data register. Reads and writes of the data register always have the MSB in bit 7. SPI serial data transfers start with most significant bit SPI serial data transfers start with least significant bit MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This bit is used for power conservation while the device is in wait mode. SPI clocks continue to operate in wait mode SPI clocks stop when the MCU enters wait mode Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Baud rate prescaler divisor is 4 Baud rate prescaler divisor is 5 Baud rate prescaler divisor is 6 Baud rate prescaler divisor is 7 Baud rate prescaler divisor is 8 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Value in the receive data buffer does not match the value in the SPI_M register Value in the receive data buffer matches the value in the SPI_M register Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
There is no indication for a receive overrun condition, so the application system designer must ensure that previous data has been read from the receive buffer before a new transfer is initiated. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The SPI system is enabled by setting the SPI enable (SPE) bit in SPI Control Register 1. While the SPE bit is set, the four associated SPI port pins are dedicated to the SPI function as: • Slave select (SS) • Serial clock (SPSCK) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• In master mode, the function of the serial data output pin (MOSI) and the serial data input pin (MISO) is determined by the SPC0 and BIDIROE control bits. • SS pin MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In slave mode, the function of the serial data output pin (MISO) and serial data input pin (MOSI) is determined by the SPC0 bit and BIDIROE bit in SPI Control Register • SS pin MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 455
SPRF flag in the SPI Status Register is set. Note A change of the bits BIDIROE with SPC0 set, CPOL, CPHA, SSOE, LSBFE, MODFEN, and SPC0 in slave mode will corrupt a transmission in progress and must be avoided. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPSCK cycle before the start of the transfer and goes back high at the end of the eighth bit time of the transfer. The SS IN waveform applies to the slave select input of a slave. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 457
2. A new data byte is written to the transmit buffer before the in-progress transmission is complete. 3. When the in-progress transmission is complete, the new, ready data byte is transmitted immediately. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 458
BIT 1 LSB FIRST BIT 0 BIT 1 BIT 5 BIT 6 BIT 7 MISO (SLAVE OUT) SS OUT (MASTER) SS IN (SLAVE) Figure 16-16. SPI Clock Formats (CPHA = 0) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
1, 2, 3, 4, 5, 6, 7, or 8 BIT RATE 256, or 512 SPPR2:SPPR1:SPPR0 SPR3:SPR2:SPR1:SPR0 Figure 16-17. SPI Baud Rate Generation 16.4.6 Special Features The following section shows the module special features. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The same pin is also the serial input to the shift register. The SPSCK is an output for the master mode and an input for the slave mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MOMI (MOSI in bidirectional mode) is cleared if it was set. No mode fault error occurs in the bidirectional mode for the SPI system configured in slave mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPIx_D to the master, it continues to send the same byte. Otherwise, if the slave is currently sending the last data received byte from the master, it continues to send each previously received data from the master byte). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• If a data transmission occurs in slave mode after a reset without a write to SPIx_D, the transmission consists of "garbage" or the data last received from the master before the reset. • Reading from SPIx_D after reset always returns zeros. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPI Status Register details. If the SPRF is not serviced before the end of the next transfer (that is, SPRF remains active throughout another transfer), the subsequent transfers are ignored and no new data is copied into the Data register. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
5. In the master, read SPIx_S while SPTEF = 1, and then write to the transmit data register (SPIx_D ) to begin transfer. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Flag is set when SPI_M = receive data buffer Bit 5 SPTEF Flag is set when transmit data buffer is empty Bit 4 MODF Mode fault flag for master mode Bit 3:0 Reserved MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 467
SPRF = 1 READ SPIx_D SPMF = 1 READ SPMF WHILE SET TO CLEAR FLAG, THEN WRITE A 1 TO IT CONTINUE Figure 16-18. Initialization Flowchart Example for SPI Master Device MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 468
Initialization/Application Information MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
17.1.1 Features The SPI includes these distinctive features: • Master mode or slave mode operation • Full-duplex or single-wire bidirectional mode • Programmable transmit bit rate MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CPU enters run mode. If the SPI is configured as a slave, reception and transmission of a data continues, so that the slave stays synchronized to the master. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In the external SPI system, simply connect all SPSCK pins to each other, all MISO pins together, and all MOSI pins together. Peripheral devices often use slightly different names for these pins. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPI control bits. When the SPI is disabled (SPE = 0), these four pins revert to other functions that are not controlled by the SPI (based on chip configuration). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPI is enabled as a master and MODFEN is 1, the slave select output enable bit determines whether this pin acts as the mode fault input (SSOE is 0) or as the slave select output (SSOE is 1). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When the FIFO is not supported or not enabled (FIFOMODE is not present or is 0): Enables the interrupt for SPI receive buffer full (SPRF) and mode fault (MODF) events. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 476
When C2[MODFEN] is 0: In master mode, SS pin function is general-purpose I/O (not SPI). In slave mode, SS pin function is slave select input. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
16-bit SPI shift register, match register, and buffers This field is reserved. Reserved Do not write to this reserved bit. Master Mode-Fault Function Enable MODFEN Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Use this register to set the prescaler and bit rate divisor for an SPI master. This register may be read or written at any time. Address: 30A0h base + 2h offset = 30A2h Read SPPR[2:0] SPR[3:0] Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• The RNFULLF and TNEAREF help improve the efficiency of FIFO operation when transfering large amounts of data. These flags provide a "watermark" feature of the FIFOs to allow continuous transmissions of data when running at high speed. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 480
Value in the receive data buffer does not match the value in the MH:ML registers Value in the receive data buffer matches the value in the MH:ML registers Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 481
NOTE: At an initial POR, the values of TNEAREF and RFIFOEF are 0. However, the status (S) register and both TX and RX FIFOs are reset due to a change of SPIMODE, FIFOMODE or SPE. If this Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
17.3.5 SPI data register high (SPIx_DH) Refer to the description of the DL register. Address: 30A0h base + 4h offset = 30A4h Read Bits[15:8] Write Reset SPI1_DH field descriptions Field Description Bits[15:8] Data (high byte) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
16-bit value into the transmit data buffer. Address: 30A0h base + 5h offset = 30A5h Read Bits[7:0] Write Reset SPI1_DL field descriptions Field Description Bits[7:0] Data (low byte) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RNFULLF is set when the receive FIFO has 32 bits or more Interrupt clearing mechanism select INTCLR This bit selects the mechanism by which the SPRF, SPTEF, TNEAREF, and RNFULLF interrupts are cleared. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FIFO are flushed with the corresponding error flags set. These flags are cleared when the CI register is read while the flags are set. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 487
Receive FIFO full flag clear interrupt SPRFCI Writing 1 to this bit clears the SPRF interrupt provided that C3[3] is set. 17.4 Functional description This section provides the functional description of the module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• The SPR3, SPR2, SPR1, and SPR0 baud rate selection bits in conjunction with the SPPR2, SPPR1, and SPPR0 baud rate preselection bits in the SPI Baud Rate register control the baud rate generator and determine the speed of the MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
17.4.3 Slave mode The SPI operates in slave mode when the MSTR bit in SPI Control Register 1 is clear. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 490
Odd numbered edges cause the value previously latched from the serial data input pin to shift into the LSB or MSB of the SPI shift register, depending on C1[LSBFE]. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
SPI system into idle state, and reset all status bits in the SPIx_S register. To initiate a transfer after writing to MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The SS IN waveform applies to the slave select input of a slave. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 494
2. A new data byte is written to the transmit buffer before the in-progress transmission is complete. 3. When the in-progress transmission is complete, the new, ready data byte is transmitted immediately. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 495
BIT 1 LSB FIRST BIT 0 BIT 1 BIT 5 BIT 6 BIT 7 MISO (SLAVE OUT) SS OUT (MASTER) SS IN (SLAVE) Figure 17-26. SPI clock formats (CPHA = 0) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
1, 2, 3, 4, 5, 6, 7, or 8 BIT RATE 256, or 512 SPPR2:SPPR1:SPPR0 SPR3:SPR2:SPR1:SPR0 Figure 17-27. SPI baud rate generation 17.4.8 Special features The following section describes the special features of SPI module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The same pin is also the serial input to the shift register. The SPSCK is an output for the master mode and an input for the slave mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MOMI (MOSI in bidirectional mode) is cleared if it was set. No mode fault error occurs in the bidirectional mode for the SPI system configured in slave mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Otherwise, if the slave is currently sending the last data received byte from the master, it continues to send each previously received data from the master byte). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• If a data transmission occurs in slave mode after a reset without a write to SPIx_DH:SPIx_DL, the transmission consists of "garbage" or the data last received from the master before the reset. • Reading from SPIx_DH:SPIx_DL after reset always returns zeros. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In 8-bit mode, SPRF is set only after all 8 bits have been shifted out of the shift register and into SPIx_DL. In 16-bit mode, SPRF is set only after all 16 bits have been shifted out of the shift register and into SPIx_DH:SPIx_DL. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Clearing this interrupt depends on the state of C3[3] and the status of TNEAREF. Refer to the description of the SPI status (S) register. 17.4.12.6 RNFULLF The RNFULLF bit applies when the FIFO feature is supported. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
2. Clock phase and polarity are set for an active-high SPI clock where the first edge on SPSCK occurs at the start of the first cycle of a data transfer. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 504
In 16-bit mode, this register holds bits 8–15 of the hardware match buffer. In 8-bit mode, writes to this register will be ignored. SPIx_ML = 0xXX Holds bits 0–7 of the hardware match buffer. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 505
SPMF = 1 READ SPMF WHILE SET TO CLEAR FLAG, THEN WRITE A 1 TO IT CONTINUE Figure 17-28. Initialization Flowchart Example for SPI Master Device in 16-bit Mode for FIFOMODE = 0 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 506
TXFULLF = 1 RNFULLF = 1/ SPRF = 1 READ SPIxDH:SPIxDL RFIFOEF = 1 CONTINUE Figure 17-29. Initialization Flowchart Example for SPI Master Device in 16-bit Mode for FIFOMODE = 1 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Arbitration-lost interrupt with automatic mode switching from master to slave • Calling address identification interrupt • START and STOP signal generation and detection • Repeated START signal generation and detection • Acknowledge bit generation and detection MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Stop3 mode. The STOP instruction does not affect the I2C module's register states. 18.1.3 Block diagram The following figure is a functional block diagram of the I2C module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
C are shown in the table found here. Table 18-1. I C signal descriptions Signal Description Bidirectional serial clock line of the I C system. Bidirectional serial data line of the I C system. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
7-bit address scheme and the lower seven bits in the 10-bit address scheme. This field is reserved. Reserved This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
C baud rate of 100 kbit/s. Hold times (μs) MULT SCL Start SCL Stop 3.500 3.000 5.500 2.500 4.000 5.250 2.250 4.000 5.250 2.125 4.250 5.125 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Therefore, for address cycles, this bit is always set. When addressed as a slave this bit must be set by software according to the SRW bit in the status register. Receive Transmit Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
I2C data register in transmit mode. Transfer in progress Transfer complete Addressed As A Slave IAAS This bit is set by one of the following conditions: Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 514
0 or 1 to TXAK after this bit is set in receive mode. • One byte transfer, excluding ACK/NACK bit, completes if FACK is 1. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RSTA (repeated start bit) is used for the address transfer and must consist of the calling address (in bits 7-1) concatenated with the required R/W bit (in position bit 0). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Contains the upper three bits of the slave address in the 10-bit address scheme. This field is valid only while the ADEXT bit is set. 18.3.7 I2C Programmable Input Glitch Filter Register (I2C_FLT) Address: 3070h base + 6h offset = 3076h Read Reserved Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
However, the SHTF1 bit is set to 1 in the bus transmission process with the idle bus state. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 518
(LoValue) and an SCL low timeout occurs. Software clears this bit by writing a logic 1 to it. NOTE: The low timeout function is disabled when the SLT register's value is 0. No low timeout occurs Low timeout occurs Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read-only field is reserved and always has the value 0. 18.3.11 I2C SCL Low Timeout Register High (I2C_SLTH) Address: 3070h base + Ah offset = 307Ah Read SSLT[15:8] Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The value of these resistors depends on the system. Normally, a standard instance of communication is composed of four parts: 1. START signal 2. Slave address transmission 3. Data transfer 4. STOP signal MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The R/W bit tells the slave the desired direction of data transfer. • 1 = Read transfer: The slave transmits data to the master • 0 = Write transfer: The master transmits data to the slave MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
18.4.1.4 STOP signal The master can terminate the communication by generating a STOP signal to free the bus. A STOP signal is defined as a low-to-high transition of SDA while SCL is asserted. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Afterward there is no difference between the device clocks and the state of SCL, and all devices start counting their high periods. The first device to complete its high period pulls SCL low again. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
±2 or ±4 when ICR's value ranges from 00h to 0Fh. These potentially varying SCL divider values are highlighted in the following table. For the actual SCL divider values for your device, see the chip-specific details about the I2C module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 525
(stop) (hex) (hex) value value (clocks) value value 1024 1152 1280 1536 1920 1280 1536 1792 2048 1022 1025 2304 1150 1153 2560 1278 1281 3072 1534 1537 3840 1918 1921 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
A3. The slave-transmitter remains addressed until it receives a STOP condition (P) or a repeated START condition (Sr) followed by a different slave address. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When the I2C module responds to one of these addresses, it acts as a slave-receiver and the IAAS bit is set after the address cycle. Software must read the Data register after the first byte transfer to determine that the address is matched. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When the I2C module is a slave, if it detects the condition, it resets its communication and is then able to receive a new TIMEOUT,MIN START condition. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 529
START to the STOP. When CSMBCLK LOW:SEXT TIMEOUT SEXT occurs, SEXT rises and also triggers SLTF. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
NACK to the bus, so FACK must be switched off before the last byte transmits. 18.4.5 Resets The I2C module is disabled after a reset. The I2C module cannot cause a core reset. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
GCAEN bit is set and a general call is received, the IAAS bit in the Status Register is set. The CPU is interrupted, provided the IICIE bit is set. The CPU must check the SRW bit and set its Tx mode accordingly. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The SHTF2's timeout period is the same as that of SHTF1, which is short compared to that of SLTF, so another control bit, SHTF2IE, is added to enable or disable it. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
To avoid I2C transfer problems resulting from the situation, firmware should prevent the MCU execution of a STOP instruction when the I2C module is in the middle of a transfer. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Data register. An example of an I2C driver which implements many of the steps described here is available in AN4342: Using the Inter-Integrated Circuit on ColdFire+ and Kinetis MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 535
2. When 10-bit addressing addresses a slave, the slave sees an interrupt following the first byte of the extended address. Ensure that for this interrupt, the contents of the Data register are ignored and not treated as a valid data transfer. Figure 18-18. Typical I2C interrupt routine MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 536
(in worst case) of the 9th SCL cycle. 3. This read is a dummy read in order to reset the SMBus receiver state machine. Figure 18-19. Typical I2C SMBus interrupt routine MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Operation in Wait or Stop3 modes for lower noise operation • Asynchronous clock source for lower noise operation • Selectable asynchronous hardware conversion trigger • Automatic compare with interrupt for less-than, or greater-than or equal-to, programmable value MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ASYNC CLOCK GENERATOR ADICLK ADIV Figure 19-1. ADC Block Diagram 19.2 External Signal Description The ADC module supports up to 24 separate analog inputs. It also requires four supply/ reference/ground connections. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 539
In some packages, V REFL REFL connected internally to V . If externally available, connect the V pin to the same REFL voltage potential as V MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADC_SC4[AFDEP]. Any write 0x1F to these bits will reset the FIFO and stop the conversion if it is active. Address: 10h base + 0h offset = 10h Read COCO AIEN ADCO ADCH Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 541
The ADCH bits form a 5-bit field that selects one of the input channels. 00000-01111 AD0-AD15 10000-10011 10100-10101 Reserved 10110 Temperature Sensor 10111 Bandgap 11000-11100 Reserved 11101 REFH 11110 REFL 11111 Module disabled NOTE: Reset FIFO in FIFO mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Indicates that ADC result FIFO have at least one valid new data. Indicates that ADC result FIFO have no valid new data. Result FIFO full FFULL Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Short sample time. Long sample time. 3–2 Conversion Mode Selection MODE MODE bits are used to select between 12-, 10-, or 8-bit operation. 8-bit conversion (N=8) Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
OR all of compare trigger. AND all of compare trigger. 4–3 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADCH. If the MODE bits are changed, any data in ADC_RH becomes invalid. Address: 10h base + 4h offset = 14h Read Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
AFDEP. The AD result FIFO can be read via ADC_RH:ADC_RL continuously by the order set in analog input channel FIFO. Address: 10h base + 5h offset = 15h Read Write Reset ADC_RL field descriptions Field Description Conversion Result[7:0] MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
8 bits of the result following a conversion in 12-bit mode. Address: 10h base + 7h offset = 17h Read Write Reset ADC_CVL field descriptions Field Description Conversion Result[7:0] MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
AD3 pin I/O control disabled. ADC Pin Control 2 ADPC2 ADPC2 controls the pin associated with channel AD2. AD2 pin I/O control enabled. AD2 pin I/O control disabled. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADPC13 controls the pin associated with channel AD13. AD13 pin I/O control enabled. AD13 pin I/O control disabled. ADC Pin Control 12 ADPC12 ADPC12 controls the pin associated with channel AD12. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADC_RL). In 10-bit mode, the result is rounded to 10 bits and placed in the data registers (ADC_RH and ADC_RL). In 8-bit mode, the result is rounded to 8 bits and MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When a pin control register bit is set, the following conditions are forced for the associated MCU pin: • The output buffer is forced to its high impedance state. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
1s) if software triggered operation is selected. • A hardware trigger (ADHWT) event if hardware triggered operation is selected. • The transfer of the result to the data registers when continuous conversion is enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• The current conversion and the rest of conversions will be aborted and no new conversion will be initialed, if ADC_SC4[AFDEP] are not all 0s. • A new conversion will be initiated when the FIFO is re-fulfilled upon the levels indicated by the ADC_SC4[AFDEP] bits). MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADCK for continuous conversions cannot be guaranteed when long sample is enabled (ADC_SC3[ADLSMP] = 1). The maximum total conversion time for different conditions is summarized in the table below. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 555
8 MHz, then the conversion time for a single conversion as given below: The number of bus cycles at 8 MHz is: Note The ADCK frequency must be between f minimum and ADCK maximum to meet ADC specifications. ADCK MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The analog channel must be written to this FIFO in order. The ADC will not start the conversion if the channel FIFO is fulfilled below the level indicated by MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 558
In continuous conversion in which the ADC_SC1[ADCO] bit is set, the ADC starts next conversion immediately when all conversions are completed. ADC module will fetch the analog input channel from the beginning of analog input channel FIFO. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 559
Start FIFOed Conversion when hardware trigger occurs Hardware Triggered Continuous Conversion (Only need one hardware trigger) COCO = 1 The n AD result store Conversions Completed Figure 19-13. ADC FIFO conversion sequence MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If a conversion is in progress when the MCU enters Stop3 mode, it continues until completion. Conversions can be initiated while the MCU is in Stop3 mode by means of the hardware trigger or if continuous conversions are enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ADCK. This register is also used for selecting sample time and low-power configuration. 2. Update status and control register 2 (ADC_SC2) to select the hardware or software conversion trigger and compare function options, if enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
4. Update status and control register 1 (ADC_SC1) to select whether conversions will be continuous or completed only once, and to enable or disable conversion complete interrupts. The input channel on which conversions will be performed is also selected here. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
V pin. This should be the only ground connection between these supplies if possible. The V pin makes a good single point ground location. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
REFL is equal to or exceeds V , the converter circuit converts the signal to 0xFFF (full scale REFH 12-bit representation), 0x3FF (full scale 10-bit representation) or 0xFF (full scale 8-bit MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
System noise that occurs during the sample or conversion process can affect the accuracy of the conversion. The ADC accuracy numbers are guaranteed as specified only if the following conditions are met: MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 567
Four samples are required to eliminate the effect of a 1LSB, one-time error. • Reduce the effect of synchronous noise by operating off the asynchronous clock (ADACK) and averaging. Noise that is synchronous to ADCK cannot be averaged out. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
0x3FE code width and its ideal (1 lsb) is used. • Differential non-linearity (DNL) — This error is defined as the worst-case difference between the actual code width and the ideal code width for all conversions. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Missing codes are those values that are never converted for any input value. In 8-bit or 10-bit mode, the ADC is guaranteed to be monotonic and have no missing codes. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 570
Application information MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Selectable interrupt on rising edge, falling edge, or both rising or falling edges of comparator output • Selectable inversion on comparator output • Up to four selectable comparator inputs • Operational in Stop3 mode MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
20.1.2.3 Operation in Debug mode When the MCU is in Debug mode, the ACMP continues operating normally. 20.1.3 Block diagram The block diagram of the ACMP module is shown in the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Reset value (in bits) page (hex) ACMP Control and Status Register (ACMP_CS) 20.3.1/574 ACMP Control Register 0 (ACMP_C0) 20.3.2/575 ACMP Control Register 1 (ACMP_C1) 20.3.3/575 ACMP Control Register 2 (ACMP_C2) 20.3.4/576 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
ACMP output can be placed onto external pin. ACMOD ACMP MOD Determines the sensitivity modes of the interrupt trigger. ACMP interrupt on output falling edge. ACMP interrupt on output rising edge. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The DAC includes a 64-level DAC (digital to analog converter) and relevant control logic. DAC can select one of two reference inputs, V or on-chip bandgap, as the DAC input V by setting ACMP_C1[DACREF]. After the DAC is enabled, it converts the data MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The two parts of ACMP (DAC and CMP) can be set up and operated independently. But if the DAC works as an input of the CMP, the DAC must be configured before the ACMP is enabled. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
When in stop3 mode, a valid edge on ACMP output generates an asynchronous interrupt that can wake the MCU from stop3. The interrupt can be cleared by writing a 0 to the ACMP_CS[ACF] bit. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TSI Control and Status Register 3 (TSI_CS3) 21.3.4/586 TSI Pin Enable Register 0 (TSI_PEN0) 21.3.5/587 TSI Pin Enable Register 1 (TSI_PEN1) 21.3.6/588 TSI Counter Register: High (TSI_CNTH) 21.3.7/589 TSI Counter Register: Low (TSI_CNTL) 21.3.8/589 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This read-only bit indicates if scan is in progress. When this bit reads zero, there is no scan in progress. When this bit reads set, a scan is in progress. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Electrode Oscillator Frequency divided by 2 Electrode Oscillator Frequency divided by 4 Electrode Oscillator Frequency divided by 8 Electrode Oscillator Frequency divided by 16 Electrode Oscillator Frequency divided by 32 Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 584
26 times per electrode 11010 27 times per electrode 11011 28 times per electrode 11100 29 times per electrode 11101 30 times per electrode 11110 31 times per electrode 11111 32 times per electrode MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
These bits indicate the electrode oscillator charge and discharge current value. 500 nA. 1 μ A. 2 μ A. 4 μ A. 8 μ A. 16 μ A. 32 μ A. 64 μ A. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PEN2 This bit enables the touch sensing input pin. PEN2 is disabled. PEN2 is enabled. PEN1 PEN1 This bit enables the touch sensing input pin. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
PEN12 This bit enables the touch sensing input pin. PEN12 is disabled. PEN12 is enabled. PEN11 PEN11 This bit enables the touch sensing input pin. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
These bits record the accumulated scan counter value ticked by the reference clock with CNTL. 21.3.8 TSI Counter Register: Low (TSI_CNTL) Address: 8h base + 7h offset = Fh Read CNTL Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TSI_CS2[EXTCHRG]. The hysteresis delta voltage is defined in the module electrical specifications present in the device Data Sheet. The figure below shows the voltage amplitude waveform of the electrode capacitance charging and discharging with a programmable current. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
21.4.1.2 Electrode oscillator and counter module control The TSI oscillator frequency signal goes through a prescaler defined by the TSI_CS1[PS] and then enters in a modulus counter. TSI_CS1[NSCN] defines the maximum count value of the modulus counter. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The reference oscillator frequency is given by the following equation: NOTE • The internal reference oscillator must be at least 3 times faster than the external oscillator. • The maximum oscillator frequency is limited within 10 MHz. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TSI_CS0[STPE] bit is set, it allows the TSI module to work in stop3 mode. NOTE To get better performance, set other channels as GPIO output mode and output 0 when scanning a channel. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MCU regulator is partially powered down, which is ideally for low-power touch detection. The charge and discharge difference voltage is configurable upon the setting of TSI_CS2[DVOLT]. The following table shows the all the delta voltage configurations. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
TSI_PENx[PENx] bit. Otherwise, the scan does not work or an invalid result will be asserted. Remember to select the channel number by the TSI_CS3[TSICH] before trigger TSI to work. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Also the external voltage is biased by vmid voltage with a Rs series resistance. The vmid voltage is defined as V(vmid) = (V(vp) + V(vm))/2. The Rs value is defined by TSI_CS2[EXTCHRG] register bits. See Figure 21-14 more information on noise mode TSI circuit. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 598
To determine the noise level, the TSI noise detection algorithm shall be performed by scanning this table following the arrow direction starting at maximum Rs and minimum DVOLT. Rs (Bits) (kΩ) DVOLT (Bits) 0.29 0.43 0.73 1.03 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 599
11. Increase DVOLT to the next level by decrementing TSI_CS2[DVOLT] by 1 and set Rs to the max value, then go to step 4; (It means noise level is higher, so need find high DVOLT) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 600
21-15. Capacitive Noise Noise sense sense sense Figure 21-15. Noise detection/sense algorithm of typical application The following flow chart shows how to detect touch with noise sense and normal capacitive sense. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 601
• The V(vp) and V(vm) thresholds are changed in 34.4 µs (T2). • The Rs series resistance value is changed between 184 kΩ (TSI_CS2[EXTCHRG]=011b) and 32 kΩ (TSI_CS2[EXTCHRG]=101). Because of this Rs change the amplitude of noise waveform change also. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Optional feature to reverse input and output data by bit • Optional final complement output of result • High-speed CRC calculation 22.3 Block diagram The following figure is the CRC block diagram. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CRC 32-bit mode. Only D3 is used to dummy data to CRC. Writing D2 will be ignored when WAS = 0. Address: 3060h base + 1h offset = 3061h Read Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CRC 32-bit mode. Only D3 is used to dummy data to CRC. Writing D2 will be ignored when WAS = 0. Address: 3060h base + 2h offset = 3062h Read Write Reset CRC_D2 field descriptions Field Description CRC Data Bit 15:8 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
LSB 16-bit of CRC polynomial, which is used in both CRC 16- and 32-bit modes. Address: 3060h base + 4h offset = 3064h Read Write Reset CRC_P0 field descriptions Field Description CRC Polynominal Bit 31:24 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
LSB 16-bit of CRC polynomial, which is used in both CRC 16- and 32-bit modes. Address: 3060h base + 6h offset = 3066h Read Write Reset CRC_P2 field descriptions Field Description CRC Polynominal Bit 15:8 MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Reverse of Read TOTR These bits identify the reverse of the output data. No reverse. Bit is reversed in byte; No byte is reversed. Reserved. Reserved. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
8. Get the checksum from CRC_D2:CRC_D3 when all CRC raw data dummied. 22.6.2 32-bit CRC calculation The following steps show how to start a general 32-bit CRC calculation: 1. Set CRC_CTRL[TCRC] bit to enable 32-bit CRC mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CRC data registers. When CRC_CTRL[FXOR] bit is set, the checksum is read by its complement. Otherwise, the raw checksum is accessed. 22.6.5 CCITT compliant CRC example The following code segment shows CCITT CRC-16 compliant example. Example: 22.6.5.1 CCITT CRC-16 compliant example MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 612
CRC_CTRL = 0x00; for ( i = 0 ; i < 128 ; i++ ) CRC_D3 = 'A'; // Dummy 256 `A' CRC_D3 = 'A'; // Get 0xea0b in CRC_D2:CRC_D3 here MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Robust write sequence for counter refresh • Refresh sequence of writing 0xA602 and then 0xB480 within 16 bus clocks • Window mode option for the refresh mechanism • Programmable 16-bit window value MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
(timeout or illegal write to the watchdog), prior to forcing a reset. After the interrupt vector fetch, the reset occurs after a delay of 128 bus clocks. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 616
Watchdog enabled in chip wait mode. Stop Enable STOP This write-once bit enables the watchdog to operate when the chip is in stop mode. Watchdog disabled in chip stop mode. Watchdog enabled in chip stop mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This write-once field indicates the clock source that feeds the watchdog counter. See the Clock source section. Bus clock. 1 kHz internal low-power oscillator (LPOCLK). 32 kHz internal oscillator (ICSIRCLK). External clock source. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
High byte of the Watchdog Counter 23.2.4 Watchdog Counter Register: Low (WDOG_CNTL) See the description of the WDOG_CNTH register. Address: 3030h base + 3h offset = 3033h Read CNTLOW Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
23.2.6 Watchdog Timeout Value Register: Low (WDOG_TOVALL) See the description of the WDOG_TOVALH register. NOTE All the bits reset to 0 in read. Address: 3030h base + 5h offset = 3035h Read TOVALLOW Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
23.2.8 Watchdog Window Register: Low (WDOG_WINL) See the description of the WDOG_WINH register. Address: 3030h base + 7h offset = 3037h Read WINLOW Write Reset WDOG_WINL field descriptions Field Description WINLOW Low byte of Watchdog Window MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In addition, if window mode is used, software must not start the refresh sequence until after the time value set in the WDOG_WINH and WDOG_WINL registers. See the following figure. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The refresh write sequence is a write of 0xA602 followed by a write of 0xB480 to the WDOG_CNTH and WDOG_CNTL registers. The write of the 0xB480 must occur within 16 bus clocks after the write of 0xA602; otherwise, the watchdog resets the MCU. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Otherwise, the WDOG uses the reset values by default. If window mode is not used (CS2[WIN] is 0), writing to WDOG_WINH:L is not required to make the new configuration take effect. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
WDOG_CNT = 0xD928; // write the 2nd unlock word WDOG_TOVAL = 1000; // setting timeout value WDOG_CS2 = WDOG_CS2_CLK_MASK; // setting 1-kHz clock source WDOG_CS1 = WDOG_CS1_EN_MASK; // enable counter running EnableInterrupts; // enable global interrupt MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 625
2.5 periods of the previous clock source and 2.5 periods of the new clock source after the configuration time period (128 bus clocks) ends. This delay ensures a smooth transition before restarting the counter with the new configuration. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
NOTE The watchdog can not generate interrupt in Stop3 mode even if CS1[STOP] is set and will not wake the MCU from Stop3 mode. It can generate reset during Stop3 mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
As an ongoing test when using the default 1-kHz clock source, software can periodically read the WDOG_CNTH and WDOG_CNTL registers to ensure the counter is being incremented. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Active background mode commands for CPU register access • GO and TRACE1 commands • BACKGROUND command can wake CPU from stop or wait modes • One hardware address breakpoint built into BDC MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Non-intrusive commands can be executed at any time even while the user's program is running. Non-intrusive commands allow a user to read or write MCU memory locations or access status and control registers within the background debug controller. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
If a host is attempting to communicate with a target MCU that has an unknown BDC clock rate, a SYNC command may be sent to the target MCU to request a timed sync response signal from which the host can determine the correct communication speed. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Ten target BDC clock cycles later, the target senses the bit level on the BKGD pin. Typically, the host actively drives the pseudo-open-drain BKGD pin during MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 633
1 0 C Y C L E S H O S T S A M P L E S B K G D P IN Figure 24-3. BDC target-to-host serial bit timing (logic 1) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The following table shows all HCS08 BDC commands, a shorthand description of their coding structure, and the meaning of each command. Coding Structure Nomenclature This nomenclature is used in the following table to describe the coding structure of the BDC commands. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 635
TRACE1 Active BDM 10/d Trace 1 user instruction at the address in the PC, then return to active background mode Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 636
• Removes all drive to the BKGD pin so it reverts to high impedance • Monitors the BKGD pin for the sync response pulse MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Because HCS08 devices do not have external address and data buses, the most important functions of an in-circuit emulator have been built onto the chip with the MCU. The debug system consists of an 8-stage FIFO that can store address or data bus information, MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Storage of data bus values into the FIFO • Starting to store change-of-flow addresses into the FIFO (begin type trace) • Stopping the storage of change-of-flow addresses into the FIFO (end type trace) MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBGFL reads needed to initially fill the FIFO. Additional periodic reads of DBGFH and DBGFL return delayed information about executed instructions so the host debugger can develop a profile of executed instruction addresses. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
There is separate opcode tracking logic for each comparator so more than one compare event can be tracked through the instruction queue at a time. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
A Then B ̶ Trigger when the address matches the value in comparator B but only after the address for another cycle matched the value in comparator A. There can be any number of cycles after the A match and before the B match. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CPU. TAG in DBGC controls whether the breakpoint request will be treated as a tag-type breakpoint or a force-type breakpoint. A tag breakpoint causes the current opcode to be marked as it enters the instruction queue. If a tagged opcode reaches MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The reset values shown in the register figure are those in the normal reset conditions. If the MCU is reset in BDM, ENBDM, BDMACT, CLKSW will be reset to 1 and others all be to 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 644
BDC commands work. Whenever the host forces the target MCU into active background mode, the host should issue a READ_STATUS command to check that BDMACT = 1 before attempting other BDC commands. Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Breakpoints are normally set while the target MCU is in active background mode before running the user application program. Address: 0h base + 1h offset = 1h Read A[15:8] Write Reset BDC_BKPTH field descriptions Field Description A[15:8] High 8-bit of hardware breakpoint address. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
BDC_SBDFR field descriptions Field Description 7–1 This field is reserved. Reserved This read-only field is reserved and always has the value 0. Background Debug Force Reset BDFR Table continues on the next page... MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 647
A serial active background mode command such as WRITE_BYTE allows an external debug host to force a target system reset. Writing 1 to this bit forces an MCU reset. This bit cannot be written from a user program. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 648
Memory map and register description MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
• Event only B, store data • A then event only B, store data • Inside range, A ≤ address ≤ B • Outside range, address < A or address > B MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
MCU is secure. The DBG module comparators are disabled when executing a Background Debug Mode (BDM) command. 25.1.3 Block diagram The following figure shows the structure of the DBG module. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Figure 25-1. DBG block diagram 25.2 Signal description The DBG module contains no external signals. 25.3 Memory map and registers This section provides a detailed description of all DBG registers accessible to the end user. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBGEN = 1 and BEGIN = 0, the bits in this register do not change after reset. Address: 3010h base + 0h offset = 3010h Read CA[15:8] Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The Comparator A Low compare bits control whether Comparator A will compare the address bus bits [7:0] to a logic 1 or logic 0. Compare corresponding address bit to a logic 0. Compare corresponding address bit to a logic 1. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBGEN = 1 and BEGIN = 0, the bits in this register do not change after reset. Address: 3010h base + 3h offset = 3013h Read CB[7:0] Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The Comparator C High compare bits control whether Comparator C will compare the address bus bits [15:8] to a logic 1 or logic 0. Compare corresponding address bit to a logic 0. Compare corresponding address bit to a logic 1. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBGEN = 1 and BEGIN = 0, the bits in this register do not change after reset. Address: 3010h base + 6h offset = 3016h Read F[15:8] Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBGFX and DBGFH before reading DBGFL because reading DBGFL causes the FIFO pointers to advance to the next FIFO location. In event-only modes, there is no useful information in DBGFX and DBGFH so it is not necessary to read them before reading DBGFL. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The RWA bit controls whether read or write is used in compare for Comparator A. The RWA bit is not used if RWAEN = 0. Write cycle will be matched. Read cycle will be matched. Reserved This field is reserved. This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RWBEN = 0.In full modes, RWAEN and RWA are used to control comparison of R/W and RWB is ignored. Write cycle will be matched. Read cycle will be matched. Reserved This field is reserved. This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
RWCEN = 0. Write cycle will be matched. Read cycle will be matched. Reserved This field is reserved. This read-only field is reserved and always has the value 0. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
This bit is the most significant bit of the 17-bit core address. 25.3.13 Debug Control Register (DBG_C) Address: 3010h base + Ch offset = 301Ch Read DBGEN BRKEN LOOP1 Write Reset MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In the case of an end- trace to reset where DBGEN=1 and BEGIN=0, the ARM and BRKEN bits are cleared but the remaining control bits in this register do not change after reset. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 663
Event only B. 0100 A then event only B. 0101 A and B (full mode). 0110 A and not B (full mode). 0111 Inside range. 1000 Outside range. 1001-1111 No trigger. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
The ARMF bit indicates whether the debugger is waiting for trigger or waiting for the FIFO to fill. While DBGEN = 1, this status bit is a read-only image of the ARM bit in DBGC. Debugger not armed. Debugger armed. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
1 word valid. 0010 2 words valid. 0011 3 words valid. 0100 4 words valid. 0101 5 words valid. 0110 6 words valid. 0111 7 words valid. 1000 8 words valid. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
FIFO buffer. In loop1 capture mode, comparator C is not available for use as a normal hardware breakpoint. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBG_C[TAG] affect all three comparators. When DBG_C[BRKEN] = 0, no CPU breakpoints are enabled. When DBG_C[BRKEN] = 1, CPU breakpoints are enabled and the DBG_C[TAG] bit determines whether the breakpoints will be tag-type or force-type MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
CPU break will be a tag-type or force-type breakpoint. When DBG_T[TRGSEL] is set, the R/W qualified comparator match signal also passes through the opcode tracking logic. If/when it propagates through this logic, it will cause a MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBG_C[ARM] is written to zero or when the DBG_C[DBGEN] bit is low. The TBC logic determines whether a trigger condition has been met based on the trigger mode and the trigger selection. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
B is compared. When the match condition for A or B is met, the corresponding flag in the DBG_S register is set. The A then event only B trigger mode is considered a begin-trigger type and the DBG_T[BEGIN] bit is ignored. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 671
25.4.4.3.9 Outside range, address < A or address > B In the outside range trigger mode, if the match condition for A or B is met, the corresponding flag in the DBGS register is set. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Start FIFO at trigger address, force CPU breakpoint when FIFO full Start FIFO at trigger opcode (No CPU breakpoint - keep running) Start FIFO at trigger opcode, force CPU breakpoint when FIFO full MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
DBG_C[ARM] and DBG_S[ARMF] will be cleared and no more data will be stored. In non-event only end-trigger modes, if the trigger is at a change of flow address the trigger event will be stored in the FIFO. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
In this scenario, the FIFO captures MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 675
16-bit CPU address 0xFFFE appears during the reset vector fetch • DBG_C = 0xC0 to enable and arm the DBG module • DBG_T = 0x40 to select a force-type trigger, a BEGIN trigger, and A-only trigger mode MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 677
• Added a note and updated the examples in the Pseudo-code example Analog comparator (ACMP) • Corrected ACMPF to ACF in the description of ACMP_CS[ACF] Touch Sense Input (TSI) • Updated features in the Features MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Page 678
• Updated the examples in the TSI electrode oscillator, Electrode oscillator and counter module control, TSI reference oscillator TSI measurement result • Updated the table of the Table 21-12 • Updated Noise detection mode. MC9S08PT60 Reference Manual, Rev. 4, 08/2014 Freescale Semiconductor, Inc.
Need help?
Do you have a question about the MC9S08PT60 and is the answer not in the manual?
Questions and answers