MC9S08JM16 MC9S08JM8 Data Sheet HCS08 Microcontrollers MC9S08JM16 Rev. 2 5/2008 freescale.
MC9S08JM16 Series Features 8-Bit HCS08 Central Processor Unit (CPU) • • • • • 48 MHz HCS08 CPU (central processor unit) 24 MHz internal bus frequency HC08 instruction set with added BGND instruction Background debugging system Breakpoint capability to allow single breakpoint setting during in-circuit debugging (plus two more breakpoints in on-chip debug module) • In-circuit emulator (ICE) debug module containing two comparators and nine trigger modes.
MC9S08JM16 Data Sheet Covers: MC9S08JM16 MC9S08JM8 MC9S08JM16 Rev.
Revision History To provide the most up-to-date information, the version of this document on the World Wide Web will be the most current. Your printed copy may be an earlier revision. To verify you have the latest information available, refer to: http://freescale.com/ The following revision history table summarizes changes contained in this document. For your convenience, the page number designators have been linked to the appropriate location. Revision Number Revision Date Rev.
List of Chapters Chapter Number Title Page Chapter 1 Device Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 Chapter 2 Pins and Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Chapter 3 Modes of Operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 Chapter 4 Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Contents Section Number Title Page Chapter 1 Device Overview 1.1 1.2 1.3 Introduction .....................................................................................................................................19 MCU Block Diagram ......................................................................................................................19 System Clock Distribution ..............................................................................................................
4.5 4.6 4.7 Flash ................................................................................................................................................47 4.5.1 Features .............................................................................................................................47 4.5.2 Program and Erase Times .................................................................................................47 4.5.3 Program and Erase Command Execution ..............................
6.2 6.3 6.4 6.5 Port Data and Data Direction ..........................................................................................................78 Pin Control ......................................................................................................................................79 6.3.1 Internal Pullup Enable ......................................................................................................79 6.3.2 Output Slew Rate Control Enable ...................................
7.5 HCS08 Instruction Set Summary ..................................................................................................108 Chapter 8 Keyboard Interrupt (S08KBIV2) 8.1 8.2 8.3 8.4 Introduction ...................................................................................................................................119 8.1.1 Features ...........................................................................................................................121 8.1.
10.3 Register Definition ........................................................................................................................139 10.3.1 Status and Control Register 1 (ADCSC1) ......................................................................139 10.3.2 Status and Control Register 2 (ADCSC2) ......................................................................141 10.3.3 Data Result High Register (ADCRH) .............................................................................
11.4.3 General Call Address ......................................................................................................173 11.5 Resets ............................................................................................................................................173 11.6 Interrupts .......................................................................................................................................173 11.6.1 Byte Transfer Interrupt ....................................
13.4.1 RTC Operation Example .................................................................................................215 13.5 Initialization/Application Information ..........................................................................................216 Chapter 14 Serial Communications Interface (S08SCIV4) 14.1 Introduction ...................................................................................................................................219 14.1.1 Features ....................
15.4.2 Master Mode ...................................................................................................................252 15.4.3 Slave Mode .....................................................................................................................253 15.4.4 Data Transmission Length ..............................................................................................254 15.4.5 SPI Clock Formats ................................................................................
.2 External Signal Description ..........................................................................................................300 17.2.1 USBDP ............................................................................................................................300 17.2.2 USBDN ...........................................................................................................................300 17.2.3 VUSB33 ..........................................................................
.4 Register Definition ........................................................................................................................341 18.4.1 BDC Registers and Control Bits .....................................................................................341 18.4.2 System Background Debug Force Reset Register (SBDFR) ..........................................343 18.4.3 DBG Registers and Control Bits .....................................................................................
Chapter 1 Device Overview 1.1 Introduction MC9S08JM16 series MCUs are members of the low-cost, high-performance HCS08 family of 8-bit microcontroller units (MCUs). All MCUs in the family use the enhanced HCS08 core and are available with a variety of modules, memory sizes, memory types, and package types. Table 1-1 summarizes the peripheral availability per package type for the devices available in the MC9S08JM16 series. Table 1-1.
Chapter 1 Device Overview CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD 8-CHANNEL, 12-BIT ANALOG-TO-DIGITAL CONVERTER (ADC) VSSAD VREFL VREFH USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 PORT B BDC SS2 SPSCK2 MOSI2 MISO2 RxD2 PORT C IRQ/TPMCLK USB SIE TxD2 SDA SCL
Chapter 1 Device Overview Table 1-2 lists the functional versions of the on-chip modules. Table 1-2. Versions of On-Chip Modules Module 1.
Chapter 1 Device Overview The MCG supplies the following clock sources: • MCGOUT — This clock source is used as the CPU, USB RAM and USB module clock, and is divided by two to generate the peripheral bus clock (BUSCLK).
Chapter 2 Pins and Connections 2.1 Introduction This chapter describes signals that connect to package pins. It includes a pinout diagram, a table of signal properties, and detailed discussion of signals. 2.2 Device Pin Assignment PTG2/KBIP6 37 48 47 PTC4 1 PTD7 PTG3/KBIP7 BKGD/MS PTG4/XTAL PTG5/EXTAL VSSOSC PTC0/SCL PTC1/SDA PTC2 PTC3/TxD2 PTC5/RxD2 Figure 2-1 shows the 48-pin QFN pin assignments for the MC9S08JM16. See Table 2-1 for pin availability by package pin count.
Chapter 2 Pins and Connections PTC2 PTC1/SDA PTC0/SCL VSSOSC PTG5/EXTAL PTG4/XTAL BKGD/MS PTG3/KBIP7 43 42 41 40 39 38 37 36 35 34 44 PTC4 1 PTG2/KBIP6 PTC3/TxD2 PTC5/RxD2 Figure 2-2 shows the 44-pin LQFP pin assignments for the MC9S08JM16 devices. See Table 2-1 for pin availability by package pin count.
PTC0/SCL VSSOSC PTG5/EXTAL PTG4/XTAL BKGD/MS PTG3/KBIP7 PTG2/KBIP6 PTC1/SDA Chapter 2 Pins and Connections 31 30 29 28 27 26 25 32 IRQ/TPMCLK 1 24 PTD2/KBIP2/ACMPO RESET 2 23 VSSAD/VREFL PTF4/TPM2CH0 3 22 VDDAD/VREFH PTF5/TPM2CH1 4 21 PTD1/ADP9/ACMP– PTE0/TxD1 5 20 PTD0/ADP8/ACMP+ PTE1/RxD1 6 19 PTB5/KBIP5/ADP5 PTE2/TPM1CH0 7 18 PTB4/KBIP4/ADP4 PTE3/TPM1CH1 8 17 VUSB33 10 11 12 13 14 15 16 PTE5/MOSI1 PTE6/SPSCK1 PTE7/SS1 VDD VSS USBDN USBPDP 32-Pin
Chapter 2 Pins and Connections VREFH MC9S08JM16 VDDAD CBYAD 0.1 μF VSSAD VREFL VDD VDD SYSTEM POWER + 5V CBLK + 10 μF CBY 0.1 μF PORT B VSS NOTE 1 PORT A PTA0, PTA5 PTB0/MISO2/ADP0 PTB1/MOSI2/ADP1 PTB2/SPSCK2/ADP2 PTB3/SS2/ADP3 PTB4/KBIP4/ADP4 PTB5/KBIP5/ADP5 RF C1 C2 X1 XTAL RS PORT C VSSOSC EXTAL BACKGROUND HEADER VDD BKGD/MS PORT D VDD 4.7 kΩ–10 kΩ RESET 4.7 kΩ– 10 kΩ IRQ/TPMCLK IRQ 0.1 μF PORT E 3.3-V Reference + 4.7 μF 0.
Chapter 2 Pins and Connections 2.3.1 Power (VDD, VSS, VSSOSC, VDDAD, VSSAD, VUSB33) VDD and VSS are the primary power supply pins for the MCU. This voltage source supplies power to all I/O buffer circuitry and to an internal voltage regulator. The internal voltage regulator provides regulated lower-voltage source to the CPU and other internal circuitry of the MCU. Typically, application systems have two separate capacitors across the power pins.
Chapter 2 Pins and Connections 2.3.3 RESET Pin RESET is a dedicated pin with a built-in pullup device. It has input hysteresis, a high current output driver, and no output slew rate control. Internal power-on reset and low-voltage reset circuitry typically make external reset circuitry unnecessary. This pin is normally connected to the standard 6-pin background debug connector, so a development system can directly reset the MCU system.
Chapter 2 Pins and Connections 2.3.7 USB Data Pins (USBDP, USBDN) The USBDP (D+) and USBDN (D–) pins are the analog input/output lines to/from full-speed internal USB transceiver. An optional internal pullup resistor for the USBDP pin, RPUDP, is available. 2.3.8 General-Purpose I/O and Peripheral Ports The MC9S08JM16 series of MCUs support up to 37 general-purpose I/O pins, which are shared with on-chip peripheral functions (timers, serial I/O, ADC, keyboard interrupts, etc.).
Chapter 2 Pins and Connections Table 2-1.
Chapter 3 Modes of Operation 3.1 Introduction The operating modes of the MC9S08JM16 series are described in this chapter. Entry into each mode, exit from each mode, and functionality while in each mode are described. 3.2 • • • 3.
Chapter 3 Modes of Operation After entering active background mode, the CPU is held in a suspended state waiting for serial background commands rather than executing instructions from the user application program. Background commands are of two types: • Non-intrusive commands, defined as commands that can be issued while the user program is running.
Chapter 3 Modes of Operation 3.6 Stop Modes One of two stop modes is entered upon execution of a STOP instruction when STOPE in SOPT1 is set. In any stop mode, the bus and CPU clocks are halted. The MCG module can be configured to leave the reference clocks running. See Chapter 12, “Multi-Purpose Clock Generator (S08MCGV1),” for more information. HCS08 devises that are designed for low-voltage operation (1.8 to 3.6 V) support stop1 mode. The MC9S08JM16 series of MCUs do not support stop1 mode.
Chapter 3 Modes of Operation For the ACMP to operate when ACGBS in ACMPSC is set, the LVD must be left enabled when entering stop3. For the XOSC to operate with an external reference when RANGE in MCGC2 is set, the LVD must be left enabled when entering stop3. 3.6.1.2 Active BDM Enabled in Stop Mode Entry into the active background mode from run mode is enabled if ENBDM in BDCSCR is set. This register is described in Chapter 18, “Development Support.
Chapter 3 Modes of Operation To maintain I/O states for pins configured as general-purpose I/O before entering stop2, the user must restore the contents of the I/O port registers, which have been saved in RAM, to the port registers before writing to the PPDACK bit. If the port registers are not restored from RAM before writing to PPDACK, then the pins will switch to their reset states when PPDACK is written.
Chapter 3 Modes of Operation 5 ERCLKEN and EREFSTEN set in MCGC2, else in standby. For high frequency range (RANGE in MCGC2 set), it also requires the LVD to be enabled in stop3. 6 USBEN in CTL is set and USBPHYEN in USBCTL0 is set, else off. MC9S08JM16 Series Data Sheet, Rev.
Chapter 4 Memory 4.1 MC9S08JM16 Series Memory Map Figure 4-1 shows the memory map for the MC9S08JM16 series. On-chip memory in the MC9S08JM16 series of MCUs consists of RAM, flash program memory for nonvolatile data storage, plus I/O and control/status registers. The registers are divided into three groups: • Direct-page registers (0x0000 through 0x00AF) • High-page registers (0x1800 through 0x185F) • Nonvolatile registers (0xFFB0 through 0xFFBF) MC9S08JM16 Series Data Sheet, Rev.
Chapter 4 Memory MC9S08JM16 MC9S08JM8 0x0000 0x0000 Direct Page Registers 0x00AF 0x00B0 Direct Page Registers 0x00AF 0x00B0 RAM 1,024 Bytes 0x04AF 0x04B0 RAM 1,024 Bytes 0x04AF 0x04B0 Unimplemented Unimplemented 0x08AF 0x08B0 0x08AF 0x08B0 Unimplemented Unimplemented 0x17FF 0x1800 0x17FF 0x1800 High Page Registers 0x185F 0x1860 High Page Registers 0x185F 0x1860 USB RAM — 256 BYTES 0x195F 0x1960 USB RAM — 256 BYTES 0x195F 0x1960 Unimplemented Unimplemented 0xBFFF 0xC000 Flash 16,384 byt
Chapter 4 Memory 4.1.1 Reset and Interrupt Vector Assignments Figure 4-1 shows address assignments for reset and interrupt vectors. The vector names shown in this table are the labels used in the Freescale-provided equate file for the MC9S08JM16 series. For more details about resets, interrupts, interrupt priority, and local interrupt mask controls, refer to Chapter 5, “Resets, Interrupts, and System Configuration.” Table 4-1.
Chapter 4 Memory Table 4-1. Reset and Interrupt Vectors (continued) 4.
Chapter 4 Memory Table 4-2.
Chapter 4 Memory Table 4-2.
Chapter 4 Memory Table 4-2.
Chapter 4 Memory Table 4-2.
Chapter 4 Memory Table 4-3.
Chapter 4 Memory 1 This reserved bit must always be written to 0. Nonvolatile flash registers, shown in Table 4-4, are located in the flash memory. These registers include an 8-byte backdoor key which optionally can be used to gain access to secure memory resources.
Chapter 4 Memory LDHX TXS #RamLast+1 ;point one past RAM ;SP<-(H:X-1) When security is enabled, the RAM is considered a secure memory resource and is not accessible through BDM or through code executing from non-secure memory. See Section 4.6, “Security,” for a detailed description of the security feature. 4.4 USB RAM USB RAM is discussed in detail in Chapter 17, “Universal Serial Bus Device Controller (S08USBV1).” 4.5 Flash Flash memory is used for program storage.
Chapter 4 Memory and erase pulses. An integer number of these timing pulses are used by the command processor to complete a program or erase command. Table 4-5 shows program and erase times. The bus clock frequency and FCDIV determine the frequency of FCLK (fFCLK). The time for one cycle of FCLK is tFCLK = 1/fFCLK. The times are shown as a number of cycles of FCLK and as an absolute time for the case where tFCLK = 5 μs.
Chapter 4 Memory Aborting a command in this way sets the FACCERR access error flag which must be cleared before starting a new command. A strictly monitored procedure must be obeyed or the command will not be accepted. This minimizes the possibility of any unintended changes to the flash memory contents. The command complete flag (FCCF) indicates when a command is complete. The command sequence must be completed by clearing FCBEF to launch the command.
Chapter 4 Memory is issued, an internal charge pump associated with the flash memory must be enabled to supply high voltage to the array. Upon completion of the command, the charge pump is turned off. When a burst program command is issued, the charge pump is enabled and then remains enabled after completion of the burst program operation if these two conditions are met: • The next burst program command has been queued before the current program operation has completed.
Chapter 4 Memory WRITE TO FCDIV1 FLASH BURST PROGRAM FLOW START FACCERR? 1 0 CLEAR ERROR FCBEF? 1 0 WRITE TO FLASH TO BUFFER ADDRESS AND DATA WRITE COMMAND (0x25) TO FCMD WRITE 1 TO FCBEF TO LAUNCH COMMAND AND CLEAR FCBEF2 FPVIO OR FACCERR? NO YES YES ERROR EXIT NEW BURST COMMAND? NO 0 FCCF? 1 DONE 1 2 Required only once after reset. Wait at least four bus cycles before checking FCBEF or FCCF. Figure 4-3. Flash Burst Program Flowchart 4.5.
Chapter 4 Memory • • • • • • • • 4.5.
Chapter 4 Memory Block protection can block-protect an area of flash memory for a bootloader program. This bootloader program then can be used to erase the rest of the flash memory and reprogram it. Because the bootloader is protected, it remains intact even if MCU power is lost in the middle of an erase or reprogram operation. 4.5.7 Vector Redirection Whenever any block protection is enabled, the reset and interrupt vectors will be protected.
Chapter 4 Memory is no way to disengage security without completely erasing all flash locations. If KEYEN is 1, a secure user program can temporarily disengage security by: 1. Writing 1 to KEYACC in the FCNFG register. This makes the flash module interpret writes to the backdoor comparison key locations (NVBACKKEY through NVBACKKEY+7) as values to be compared against the key rather than as the first step in a flash program or erase command. 2.
Chapter 4 Memory 4.7.1 Flash Clock Divider Register (FCDIV) Bit 7 of this register is a read-only status flag. Bits 6 through 0 may be read at any time but can be written only one time. Before any erase or programming operations are possible, write to this register to set the frequency of the clock for the nonvolatile memory system within acceptable limits.
Chapter 4 Memory Table 4-7. Flash Clock Divider Settings fBus PRDIV8 (Binary) DIV5:DIV0 (Decimal) fFCLK Program/Erase Timing Pulse (5 μs Min, 6.7 μs Max) 24 MHz 1 14 200 kHz 5 μs 20 MHz 1 12 192.3 kHz 5.2 μs 10 MHz 0 49 200 kHz 5 μs 8 MHz 0 39 200 kHz 5 μs 4 MHz 0 19 200 kHz 5 μs 2 MHz 0 9 200 kHz 5 μs 1 MHz 0 4 200 kHz 5 μs 200 kHz 0 0 200 kHz 5 μs 150 kHz 0 0 150 kHz 6.7 μs 4.7.
Chapter 4 Memory Table 4-9. Security States SEC01:SEC00 Description 0:0 Secure 0:1 Secure 1:0 Unsecured 1:1 Secure SEC01:SEC00 changes to 1:0 after successful backdoor key entry or a successful blank check of flash. 4.7.3 Flash Configuration Register (FCNFG) Bits 7 through 5 may be read or written at any time. Bits 4 through 0 always read 0 and cannot be written. R 7 6 0 0 5 4 3 2 1 0 0 0 0 0 0 0 0 0 0 0 KEYACC W Reset 0 0 0 = Unimplemented or Reserved Figure 4-7.
Chapter 4 Memory Table 4-11. FPROT Register Field Descriptions Field Description 7:1 FPS[7:1] Flash Protect Select Bits — When FPDIS = 0, this 7-bit field determines the ending address of unprotected flash locations at the high address end of the flash. Protected flash locations cannot be erased or programmed. 0 FPDIS 4.7.5 Flash Protection Disable 0 Flash block specified by FPS[7:1] is block protected (program and erase are not allowed). 1 No flash block is protected.
Chapter 4 Memory Table 4-12. FSTAT Register Field Descriptions (continued) Field Description 4 FACCERR Access Error Flag — FACCERR is set automatically when the proper command sequence is not obeyed exactly (the erroneous command is ignored). If a program or erase operation is attempted before the FCDIV register has been initialized, or if the MCU enters stop while a command was in progress. For a more detailed discussion of the exact actions that are considered access errors, see Section 4.5.
Chapter 4 Memory It is not necessary to perform a blank check command after a mass erase operation. Blank check is required only as part of the security unlocking mechanism. MC9S08JM16 Series Data Sheet, Rev.
Chapter 5 Resets, Interrupts, and System Configuration 5.1 Introduction This chapter discusses basic reset and interrupt mechanisms and the various sources of reset and interrupts in the MC9S08JM16 series. Some interrupt sources from peripheral modules are discussed in greater detail in other chapters of this reference manual. This chapter gathers basic information about all reset and interrupt sources in one place for easy reference.
Chapter 5 Resets, Interrupts, and System Configuration Each of these sources, with the exception of the background debug forced reset, has an associated bit in the system reset status (SRS) register. 5.4 Computer Operating Properly (COP) Watchdog The COP watchdog is used to force a system reset when the application software fails to execute as expected. To prevent a system reset from the COP timer (when it is enabled), application software must reset the COP counter periodically.
Chapter 5 Resets, Interrupts, and System Configuration 5.5 Interrupts Interrupts provide a way to save the current CPU status and registers, execute an interrupt service routine (ISR), and then restore the CPU status so processing resumes where it left off before the interrupt. Other than the software interrupt (SWI), which is a program instruction, interrupts are caused by hardware events such as an edge on the IRQ pin or a timer-overflow event.
Chapter 5 Resets, Interrupts, and System Configuration 5.5.1 Interrupt Stack Frame Figure 5-1 shows the contents and organization of a stack frame. Before the interrupt, the stack pointer (SP) points at the next available byte location on the stack. The current values of CPU registers are stored on the stack starting with the low-order byte of the program counter (PCL) and ending with the CCR.
Chapter 5 Resets, Interrupts, and System Configuration The IRQ pin, when enabled, defaults to use an internal pull device (IRQPDD = 0), the device is a pullup or pulldown depending on the polarity chosen. If the user desires to use an external pullup or pulldown, the IRQPDD can be written to a 1 to turn off the internal device. BIH and BIL instructions may be used to detect the level on the IRQ pin when the pin is configured to act as the IRQ input.
Chapter 5 Resets, Interrupts, and System Configuration Table 5-1.
Chapter 5 Resets, Interrupts, and System Configuration Table 5-1.
Chapter 5 Resets, Interrupts, and System Configuration 5.6.3 LVD Interrupt Operation When a low voltage condition is detected and the LVD circuit is configured for interrupt operation (LVDE set, LVDIE set, and LVDRE clear), then LVDF will be set and an LVD interrupt will occur. 5.6.4 Low-Voltage Warning (LVW) The LVD system has a low voltage warning flag to indicate the user that the supply voltage is approaching, but is still above, the LVD voltage.
Chapter 5 Resets, Interrupts, and System Configuration Table 5-2. IRQSC Register Field Descriptions Field Description 6 IRQPDD Interrupt Request (IRQ) Pull Device Disable — This read/write control bit is used to disable the internal pullup device when the IRQ pin is enabled (IRQPE = 1) allowing for an external device to be used. 0 IRQ pull device enabled if IRQPE = 1. 1 IRQ pull device disabled if IRQPE = 1.
Chapter 5 Resets, Interrupts, and System Configuration R 7 6 5 4 3 2 1 0 POR PIN COP ILOP 0 LOC LVD — 0 1 0 W Writing any value to SRS address clears COP watchdog timer.
Chapter 5 Resets, Interrupts, and System Configuration R 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 BDFR1 W Reset 0 0 0 0 0 0 0 0 = Unimplemented or Reserved 1 BDFR is writable only through serial background debug commands, not from user programs. Figure 5-4. System Background Debug Force Reset Register (SBDFR) Table 5-4.
Chapter 5 Resets, Interrupts, and System Configuration Table 5-6. COP Configuration Options Control Bits COPCLKS Clock Source COP Window1 Opens (COPW = 1) COP Overflow Count COPT[1:0] N/A 0:0 N/A N/A COP is disabled 0 0:1 1 kHz LPO clock N/A 25 cycles (32 ms2) 0 1:0 1 kHz LPO clock N/A 28 cycles (256 ms1) 0 1:1 1 kHz LPO clock N/A 210 cycles (1.
Chapter 5 Resets, Interrupts, and System Configuration Table 5-7. SOPT2 Register Field Descriptions (continued) Field 1 SPI2FE 0 ACIC 5.7.6 Description SPI2 Ports Input Filter Enable 0 Disable input filter on SPI2 port pins to allow for higher maximum SPI baud rate. 1 Enable input filter on SPI2 port pins to eliminate noise and restrict maximum SPI baud rate Analog Comparator to Input Capture Enable— This bit connects the output of ACMP to TPM input channel 0.
Chapter 5 Resets, Interrupts, and System Configuration 5.7.7 System Power Management Status and Control 1 Register (SPMSC1) This high page register contains status and control bits to support the low-voltage detect function, and to enable the bandgap voltage reference for use by the ADC module. This register must be written during the user’s reset initialization program to set the desired controls even if the desired settings are the same as the reset settings.
Chapter 5 Resets, Interrupts, and System Configuration 5.7.8 System Power Management Status and Control 2 Register (SPMSC2) This register is used to report the status of the low-voltage warning function, and to configure the stop mode behavior of the MCU. This register must be written during the user’s reset initialization program to set the desired controls even if the desired settings are the same as the reset settings.
Chapter 5 Resets, Interrupts, and System Configuration MC9S08JM16 Series Data Sheet, Rev.
Chapter 6 Parallel Input/Output 6.1 Introduction This chapter explains software controls related to parallel input/output (I/O). The MC9S08JM16 has seven I/O ports which include a total of 37 general-purpose I/O pins. See Chapter 2, “Pins and Connections,” for more information about the logic and hardware aspects of these pins. Not all pins are available on all devices. See Table 2-1 to determine which functions are available for a specific device.
Chapter 6 Parallel Input/Output 6.2 Port Data and Data Direction Reading and writing of parallel I/O is done through the port data registers. The direction, input or output, is controlled through the port data direction registers. The parallel I/O port function for an individual pin is illustrated in the block diagram below. PTxDDn D Output Enable Q PTxDn D Output Data Q 1 Port Read Data 0 Synchronizer Input Data BUSCLK Figure 6-1.
Chapter 6 Parallel Input/Output 6.3 Pin Control The pin control registers are located in the high page register block of the memory. These registers are used to control pullups, slew rate, and drive strength for the I/O pins. The pin control registers operate independently of the parallel I/O registers. 6.3.1 Internal Pullup Enable An internal pullup device can be enabled for each port pin by setting the corresponding bit in one of the pullup enable registers (PTxPEn).
Chapter 6 Parallel Input/Output 6.5 Parallel I/O and Pin Control Registers This section provides information about the registers associated with the parallel I/O ports and pin control functions. These parallel I/O registers are located in page zero of the memory map and the pin control registers are located in the high page register section of memory. Refer to tables in Chapter 4, “Memory,” for the absolute address assignments for all parallel I/O and pin control registers.
Chapter 6 Parallel Input/Output 6.5.2 Port A Pin Control Registers (PTAPE, PTASE, PTADS) In addition to the I/O control, port A pins are controlled by the registers listed below. 7 6 5 4 3 2 1 0 R PTAPE5 PTAPE0 W Reset 0 0 0 0 0 0 0 0 Figure 6-4. Internal Pullup Enable for Port A (PTAPE) Table 6-3.
Chapter 6 Parallel Input/Output Table 6-5. PTASE Register Field Descriptions Field Description 5,0 Output Drive Strength Selection for Port A Bits — Each of these control bits selects between low and high PTADS[5,0] output drive for the associated PTA pin. 0 Low output drive enabled for port A bit n. 1 High output drive enabled for port A bit n. 6.5.3 Port B I/O Registers (PTBD and PTBDD) Port B parallel I/O function is controlled by the registers listed below.
Chapter 6 Parallel Input/Output 6.5.4 Port B Pin Control Registers (PTBPE, PTBSE, PTBDS) In addition to the I/O control, port B pins are controlled by the registers listed below. 7 6 5 4 3 2 1 0 PTBPE5 PTBPE4 PTBPE3 PTBPE2 PTBPE1 PTBPE0 0 0 0 0 0 0 R W Reset 0 0 Figure 6-9. Internal Pullup Enable for Port B (PTBPE) Table 6-8.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTBDS5 PTBDS4 PTBDS3 PTBDS2 PTBDS1 PTBDS0 0 0 0 0 0 0 R W Reset 0 0 Figure 6-11. Output Drive Strength Selection for Port B (PTBDS) Table 6-10. PTBDS Register Field Descriptions Field Description 5:0 Output Drive Strength Selection for Port B Bits — Each of these control bits selects between low and high PTBDS[5:0] output drive for the associated PTB pin. 0 Low output drive enabled for port B bit n.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTCDD5 PTCDD4 PTCDD3 PTCDD2 PTCDD1 PTCDD0 0 0 0 0 0 0 R W Reset 0 0 Figure 6-13. Data Direction for Port C (PTCDD) Table 6-12. PTCDD Register Field Descriptions Field Description 5:0 Data Direction for Port C Bits — These read/write bits control the direction of port C pins and what is read for PTCDD[5:0] PTCD reads. 0 Input (output driver disabled) and reads return the pin value.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTCSE5 PTCSE4 PTCSE3 PTCSE2 PTCSE1 PTCSE0 1 1 1 1 1 1 R W Reset 0 0 Figure 6-15. Output Slew Rate Control Enable for Port C (PTCSE) Table 6-14. PTCSE Register Field Descriptions Field Description 5:0 Output Slew Rate Control Enable for Port C Bits — Each of these control bits determine whether output slew PTCSE[5:0] rate control is enabled for the associated PTC pin.
Chapter 6 Parallel Input/Output 6.5.7 Port D I/O Registers (PTDD and PTDDD) Port D parallel I/O function is controlled by the registers listed below. 7 6 5 4 3 2 1 0 PTDD2 PTDD1 PTDD0 0 0 0 R PTDD7 W Reset 0 0 0 0 0 Figure 6-17. Port D Data Register (PTDD) Table 6-16. PTDD Register Field Descriptions Field Description 7, 2:0 Port D Data Register Bits — For port D pins that are inputs, reads return the logic level on the pin.
Chapter 6 Parallel Input/Output 6.5.8 Port D Pin Control Registers (PTDPE, PTDSE, PTDDS) In addition to the I/O control, port D pins are controlled by the registers listed below. 7 6 5 4 3 2 1 0 PTDPE2 PTDPE1 PTDPE0 0 0 0 R PTDPE7 W Reset 0 0 0 0 0 Figure 6-19. Internal Pullup Enable for Port D (PTDPE) Table 6-18.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTDDS2 PTDDS1 PTDDS0 0 0 0 R PTDDS7 W Reset 0 0 0 0 0 Figure 6-21. Output Drive Strength Selection for Port D (PTDDS) Table 6-20. PTDDS Register Field Descriptions Field Description 7, 2:0 Output Drive Strength Selection for Port D Bits — Each of these control bits selects between low and high PTDDS[7, 2:0] output drive for the associated PTD pin. 0 Low output drive enabled for port D bit n. 1 High output drive enabled for port D bit n.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTEDD7 PTEDD6 PTEDD5 PTEDD4 PTEDD3 PTEDD2 PTEDD1 PTEDD0 0 0 0 0 0 0 0 0 R W Reset Figure 6-23. Data Direction for Port E (PTEDD) Table 6-22. PTEDD Register Field Descriptions Field Description 7:0 Data Direction for Port E Bits — These read/write bits control the direction of port E pins and what is read for PTEDD[7:0] PTED reads. 0 Input (output driver disabled) and reads return the pin value.
Chapter 6 Parallel Input/Output 6.5.10 Port E Pin Control Registers (PTEPE, PTESE, PTEDS) In addition to the I/O control, port E pins are controlled by the registers listed below. 7 6 5 4 3 2 1 0 PTEPE7 PTEPE6 PTEPE5 PTEPE4 PTEPE3 PTEPE2 PTEPE1 PTEPE0 0 0 0 0 0 0 0 0 R W Reset Figure 6-24. Internal Pullup Enable for Port E (PTEPE) Table 6-23.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTEDS7 PTEDS6 PTEDS5 PTEDS4 PTEDS3 PTEDS2 PTEDS1 PTEDS0 0 0 0 0 0 0 0 0 R W Reset Figure 6-26. Output Drive Strength Selection for Port E (PTEDS) Table 6-25. PTEDS Register Field Descriptions Field Description 7:0 Output Drive Strength Selection for Port E Bits — Each of these control bits selects between low and high PTEDS[7:0] output drive for the associated PTE pin. 0 Low output drive enabled for port E bit n.
Chapter 6 Parallel Input/Output 7 6 5 4 3 PTFDD6 PTFDD5 PTFDD4 0 0 0 2 1 0 PTFDD1 PTFDD0 0 0 R W Reset 0 0 0 Figure 6-28. Data Direction for Port F (PTFDD) Table 6-27. PTFDD Register Field Descriptions Field Description 6:4, 1:0 PTFDD [6:4, 1:0] Data Direction for Port F Bits — These read/write bits control the direction of port F pins and what is read for PTFD reads. 0 Input (output driver disabled) and reads return the pin value.
Chapter 6 Parallel Input/Output 7 6 5 4 3 PTFSE6 PTFSE5 PTFSE4 1 1 1 2 1 0 PTFSE1 PTFSE0 1 1 R W Reset 0 1 1 Figure 6-30. Output Slew Rate Control Enable for Port F (PTFSE) Table 6-29. PTFSE Register Field Descriptions Field Description 6:4, 1:0 PTFSE [6:4, 1:0] Output Slew Rate Control Enable for Port F Bits — Each of these control bits determine whether output slew rate control is enabled for the associated PTF pin.
Chapter 6 Parallel Input/Output 6.5.13 Port G I/O Registers (PTGD and PTGDD) Port G parallel I/O function is controlled by the registers listed below. 7 6 5 4 3 2 1 0 PTGD5 PTGD4 PTGD3 PTGD2 PTGD1 PTGD0 0 0 0 0 0 0 R W Reset 0 0 Figure 6-32. Port G Data Register (PTGD) Table 6-31. PTGD Register Field Descriptions Field Description 5:0 PTGD[5:0] Port G Data Register Bits — For port G pins that are inputs, reads return the logic level on the pin.
Chapter 6 Parallel Input/Output 6.5.14 Port G Pin Control Registers (PTGPE, PTGSE, PTGDS) In addition to the I/O control, port G pins are controlled by the registers listed below. 7 6 5 4 3 2 1 0 PTGPE5 PTGPE4 PTGPE3 PTGPE2 PTGPE1 PTGPE0 0 0 0 0 0 0 R W Reset 0 0 Figure 6-34. Internal Pullup Enable for Port G Bits (PTGPE) Table 6-33.
Chapter 6 Parallel Input/Output 7 6 5 4 3 2 1 0 PTGDS5 PTGDS4 PTGDS3 PTGDS2 PTGDS1 PTGDS0 0 0 0 0 0 0 R W Reset 0 0 Figure 6-36. Output Drive Strength Selection for Port G (PTGDS) Table 6-35. PTGDS Register Field Descriptions Field 5:0 PTGDSn Description Output Drive Strength Selection for Port G Bits — Each of these control bits selects between low and high output drive for the associated PTG pin. 0 Low output drive enabled for port G bit n.
Chapter 6 Parallel Input/Output MC9S08JM16 Series Data Sheet, Rev.
Chapter 7 Central Processor Unit (S08CPUV2) 7.1 Introduction This section provides summary information about the registers, addressing modes, and instruction set of the CPU of the HCS08 Family. For a more detailed discussion, refer to the HCS08 Family Reference Manual, volume 1, Freescale Semiconductor document order number HCS08RMV1/D. The HCS08 CPU is fully source- and object-code-compatible with the M68HC08 CPU.
Chapter 7 Central Processor Unit (S08CPUV2) 7.2 Programmer’s Model and CPU Registers Figure 7-1 shows the five CPU registers. CPU registers are not part of the memory map. 0 7 ACCUMULATOR A 16-BIT INDEX REGISTER H:X H INDEX REGISTER (HIGH) 8 15 INDEX REGISTER (LOW) 7 0 SP STACK POINTER 15 X 0 PROGRAM COUNTER 7 0 CONDITION CODE REGISTER V 1 1 H I N Z C PC CCR CARRY ZERO NEGATIVE INTERRUPT MASK HALF-CARRY (FROM BIT 3) TWO’S COMPLEMENT OVERFLOW Figure 7-1. CPU Registers 7.2.
Chapter 7 Central Processor Unit (S08CPUV2) 7.2.3 Stack Pointer (SP) This 16-bit address pointer register points at the next available location on the automatic last-in-first-out (LIFO) stack. The stack may be located anywhere in the 64-Kbyte address space that has RAM and can be any size up to the amount of available RAM. The stack is used to automatically save the return address for subroutine calls, the return address and CPU registers during interrupts, and for local variables.
Chapter 7 Central Processor Unit (S08CPUV2) 7 0 CONDITION CODE REGISTER V 1 1 H I N Z C CCR CARRY ZERO NEGATIVE INTERRUPT MASK HALF-CARRY (FROM BIT 3) TWO’S COMPLEMENT OVERFLOW Figure 7-2. Condition Code Register Table 7-1. CCR Register Field Descriptions Field Description 7 V Two’s Complement Overflow Flag — The CPU sets the overflow flag when a two’s complement overflow occurs. The signed branch instructions BGT, BGE, BLE, and BLT use the overflow flag.
Chapter 7 Central Processor Unit (S08CPUV2) 7.3 Addressing Modes Addressing modes define the way the CPU accesses operands and data. In the HCS08, all memory, status and control registers, and input/output (I/O) ports share a single 64-Kbyte linear address space so a 16-bit binary address can uniquely identify any memory location. This arrangement means that the same instructions that access variables in RAM can also be used to access I/O and control registers or nonvolatile program space.
Chapter 7 Central Processor Unit (S08CPUV2) 7.3.5 Extended Addressing Mode (EXT) In extended addressing mode, the full 16-bit address of the operand is located in the next two bytes of program memory after the opcode (high byte first). 7.3.6 Indexed Addressing Mode Indexed addressing mode has seven variations including five that use the 16-bit H:X index register pair and two that use the stack pointer as the base reference. 7.3.6.
Chapter 7 Central Processor Unit (S08CPUV2) 7.3.6.7 SP-Relative, 16-Bit Offset (SP2) This variation of indexed addressing uses the 16-bit value in the stack pointer (SP) plus a 16-bit offset included in the instruction as the address of the operand needed to complete the instruction. 7.4 Special Operations The CPU performs a few special operations that are similar to instructions but do not have opcodes like other CPU instructions.
Chapter 7 Central Processor Unit (S08CPUV2) interrupt service routine, this would allow nesting of interrupts (which is not recommended because it leads to programs that are difficult to debug and maintain). For compatibility with the earlier M68HC05 MCUs, the high-order half of the H:X index register pair (H) is not saved on the stack as part of the interrupt sequence.
Chapter 7 Central Processor Unit (S08CPUV2) 7.4.5 BGND Instruction The BGND instruction is new to the HCS08 compared to the M68HC08. BGND would not be used in normal user programs because it forces the CPU to stop processing user instructions and enter the active background mode. The only way to resume execution of the user program is through reset or by a host debug system issuing a GO, TRACE1, or TAGGO serial command through the background debug interface.
Chapter 7 Central Processor Unit (S08CPUV2) 7.5 HCS08 Instruction Set Summary Table 7-2 provides a summary of the HCS08 instruction set in all possible addressing modes. The table shows operand construction, execution time in internal bus clock cycles, and cycle-by-cycle details for each addressing mode variation of each instruction.
Chapter 7 Central Processor Unit (S08CPUV2) Operation Object Code Cycles Source Form Address Mode Table 7-2. .
Chapter 7 Central Processor Unit (S08CPUV2) BRA rel Operation Object Code Branch Always (if I = 1) REL 20 rr BRCLR n,opr8a,rel Branch if Bit n in Memory Clear (if (Mn) = 0) DIR (b0) DIR (b1) DIR (b2) DIR (b3) DIR (b4) DIR (b5) DIR (b6) DIR (b7) 01 03 05 07 09 0B 0D 0F BRN rel Branch Never (if I = 0) REL 21 rr Branch if Bit n in Memory Set (if (Mn) = 1) DIR (b0) DIR (b1) DIR (b2) DIR (b3) DIR (b4) DIR (b5) DIR (b6) DIR (b7) 00 02 04 06 08 0A 0C 0E dd dd dd dd dd dd dd dd BSET n,opr8a Set
Chapter 7 Central Processor Unit (S08CPUV2) CMP CMP CMP CMP CMP CMP CMP CMP #opr8i opr8a opr16a oprx16,X oprx8,X ,X oprx16,SP oprx8,SP Operation Compare Accumulator with Memory A–M (CCR Updated But Operands Not Changed) Object Code IMM DIR EXT IX2 IX1 IX SP2 SP1 A1 B1 C1 D1 E1 F1 9E D1 9E E1 ii dd hh ll ee ff ff ee ff ff Cycles Source Form Address Mode Table 7-2. .
Chapter 7 Central Processor Unit (S08CPUV2) INC opr8a INCA INCX INC oprx8,X INC ,X INC oprx8,SP Operation Increment M ← (M) + $01 A ← (A) + $01 X ← (X) + $01 M ← (M) + $01 M ← (M) + $01 M ← (M) + $01 Object Code Cycles Source Form Address Mode Table 7-2. .
Chapter 7 Central Processor Unit (S08CPUV2) Operation Object Code MOV opr8a,opr8a MOV opr8a,X+ MOV #opr8i,opr8a MOV ,X+,opr8a Move (M)destination ← (M)source In IX+/DIR and DIR/IX+ Modes, H:X ← (H:X) + $0001 DIR/DIR DIR/IX+ IMM/DIR IX+/DIR 4E 5E 6E 7E MUL Unsigned multiply X:A ← (X) × (A) INH NEG opr8a NEGA NEGX NEG oprx8,X NEG ,X NEG oprx8,SP Negate M ← – (M) = $00 – (M) (Two’s Complement) A ← – (A) = $00 – (A) X ← – (X) = $00 – (X) M ← – (M) = $00 – (M) M ← – (M) = $00 – (M) M ← – (M) = $00 – (
Chapter 7 Central Processor Unit (S08CPUV2) Operation Object Code Cycles Source Form Address Mode Table 7-2. .
Chapter 7 Central Processor Unit (S08CPUV2) SUB SUB SUB SUB SUB SUB SUB SUB #opr8i opr8a opr16a oprx16,X oprx8,X ,X oprx16,SP oprx8,SP Operation Object Code IMM DIR EXT IX2 IX1 IX SP2 SP1 A0 B0 C0 D0 E0 F0 9E D0 9E E0 SWI Software Interrupt PC ← (PC) + $0001 Push (PCL); SP ← (SP) – $0001 Push (PCH); SP ← (SP) – $0001 Push (X); SP ← (SP) – $0001 Push (A); SP ← (SP) – $0001 Push (CCR); SP ← (SP) – $0001 I ← 1; PCH ← Interrupt Vector High Byte PCL ← Interrupt Vector Low Byte INH TAP Transfer Accumul
Chapter 7 Central Processor Unit (S08CPUV2) Operation Object Code Cycles Source Form Address Mode Table 7-2. . Instruction Set Summary (Sheet 9 of 9) Cyc-by-Cyc Details Affect on CCR VH I N Z C TXS Transfer Index Reg. to SP SP ← (H:X) – $0001 INH 94 2 fp –– – – – – WAIT Enable Interrupts; Wait for Interrupt I bit ← 0; Halt CPU INH 8F 2+ fp...
Chapter 7 Central Processor Unit (S08CPUV2) Table 7-3.
Chapter 7 Central Processor Unit (S08CPUV2) Table 7-3.
Chapter 8 Keyboard Interrupt (S08KBIV2) 8.1 Introduction The MC9S08JM16 series have one KBI module with seven keyboard interrupt inputs. See Chapter 2, “Pins and Connections,” for more information about the logic and hardware aspects of these pins. NOTE MC9S08JM16 series devices operate at a higher voltage range (2.7 V to 5.5 V) and do not include stop1 mode. Therefore, please disregard references to stop1. MC9S08JM16 Series Data Sheet, Rev.
Keyboard Interrupt (KBI) ModuleChapter 8 Keyboard Interrupt (S08KBIV2) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SE
Keyboard Interrupts (S08KBIV2) 8.1.1 Features The KBI features include: • Up to eight keyboard interrupt pins with individual pin enable bits. • Each keyboard interrupt pin is programmable as falling edge (or rising edge) only, or both falling edge and low level (or both rising edge and high level) interrupt sensitivity. • One software enabled keyboard interrupt. • Exit from low-power modes. 8.1.2 Modes of Operation This section defines the KBI operation in wait, stop, and background debug modes. 8.
Keyboard Interrupts (S08KBIV2) BUSCLK KBACK VDD 1 KBIP0 0 S RESET KBF D CLR Q KBIPE0 SYNCHRONIZER CK KBEDG0 KEYBOARD INTERRUPT FF 1 KBIPn 0 S STOP STOP BYPASS KBI INTERRUPT REQUEST KBMOD KBIPEn KBIE KBEDGn Figure 8-2. KBI Block Diagram 8.2 External Signal Description The KBI input pins can be used to detect either falling edges, or both falling edge and low level interrupt requests.
Keyboard Interrupts (S08KBIV2) R 7 6 5 4 3 2 0 0 0 0 KBF 0 W Reset: 1 0 KBIE KBMOD 0 0 KBACK 0 0 0 0 0 0 = Unimplemented Figure 8-3. KBI Status and Control Register Table 8-2. KBISC Register Field Descriptions Field Description 7:4 Unused register bits, always read 0. 3 KBF Keyboard Interrupt Flag — KBF indicates when a keyboard interrupt is detected. Writes have no effect on KBF. 0 No keyboard interrupt detected. 1 Keyboard interrupt detected.
Keyboard Interrupts (S08KBIV2) 7 6 5 4 3 2 1 0 KBEDG7 KBEDG6 KBEDG5 KBEDG4 KBEDG3 KBEDG2 KBEDG1 KBEDG0 0 0 0 0 0 0 0 0 R W Reset: Figure 8-5. KBI Edge Select Register Table 8-4. KBIES Register Field Descriptions Field 7:0 KBEDGn 8.4 Description Keyboard Edge Selects — Each of the KBEDGn bits selects the falling edge/low level or rising edge/high level function of the corresponding pin). 0 Falling edge/low level. 1 Rising edge/high level.
Keyboard Interrupts (S08KBIV2) KBISC provided all enabled keyboard inputs are at their deasserted levels. KBF will remain set if any enabled KBI pin is asserted while attempting to clear by writing a 1 to KBACK. 8.4.3 KBI Pullup/Pulldown Resistors The KBI pins can be configured to use an internal pullup/pulldown resistor using the associated I/O port pullup enable register.
Keyboard Interrupts (S08KBIV2) MC9S08JM16 Series Data Sheet, Rev.
Chapter 9 5 V Analog Comparator (S08ACMPV2) 9.1 Introduction The analog comparator module (ACMP) provides a circuit for comparing two analog input voltages or for comparing one analog input voltage to an internal reference voltage. The comparator circuit is designed to operate across the full range of the supply voltage (rail to rail operation). NOTE MC9S08JM16 series devices operate at a higher voltage range (2.7 V to 5.5 V) and do not include stop1 mode. Therefore, please disregard references to stop1.
Chapter 9 5 V Analog Comparator (S08ACMPV2) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SERIAL PERIPHERAL INTERFACE M
Analog Comparator (S08ACMPV2) 9.1.3 Features The ACMP has the following features: • Full rail to rail supply operation. • Selectable interrupt on rising edge, falling edge, or either rising or falling edges of comparator output. • Option to compare to fixed internal bandgap reference voltage. • Option to allow comparator output to be visible on a pin, ACMPO. • Can operate in stop3 mode 9.1.4 Modes of Operation This section defines the ACMP operation in wait, stop and background debug modes. 9.1.4.
Analog Comparator (S08ACMPV2) Internal Bus Internal Reference ACMP INTERRUPT REQUEST ACIE ACBGS Status & Control Register ACME ACF ACMP+ + set ACF ACMOD ACOPE Interrupt Control Comparator ACMP– ACMPO Figure 9-2. Analog Comparator 5V (ACMP5) Block Diagram 9.2 External Signal Description The ACMP has two analog input pins, ACMP+ and ACMP– and one digital output pin ACMPO. Each of these pins can accept an input voltage that varies across the full operating voltage range of the MCU.
Analog Comparator (S08ACMPV2) • An 8-bit status and control register Refer to the direct-page register summary in the memory section of this data sheet for the absolute address assignments for all ACMP registers.This section refers to registers and control bits only by their names. Some MCUs may have more than one ACMP, so register names include placeholder characters to identify which ACMP is being referenced. 9.3.1.
Analog Comparator (S08ACMPV2) Table 9-2. ACMP Status and Control Register Field Descriptions (continued) Field Description 2 ACOPE Analog Comparator Output Pin Enable — ACOPE is used to enable the comparator output to be placed onto the external pin, ACMPO. 0 Analog comparator output not available on ACMPO 1 Analog comparator output is driven out on ACMPO 1:0 ACMOD Analog Comparator Mode — ACMOD selects the type of compare event which sets ACF.
Chapter 10 Analog-to-Digital Converter (S08ADC12V1) 10.1 Overview The 12-bit analog-to-digital converter (ADC) is a successive approximation ADC designed for operation within an integrated microcontroller system-on-chip. NOTE MC9S08JM16 series devices operate at a higher voltage range (2.7 V to 5.5 V) and do not include stop1 mode. Therefore, please disregard references to stop1. 10.1.1 Module Configurations This section provides information for configuring the ADC on this device. 10.1.1.
Chapter 10 Analog-to-Digital Converter (S08ADC12V1) Table 10-1. ADC Channel Assignment (continued) 1 ADCH Channel Input Pin Control ADCH Channel Input Pin Control 01111 AD15 VREFL ADPC15 11111 module disabled None N/A For more information, see Section 10.1.1.5, “Temperature Sensor.” NOTE Selecting the internal bandgap channel requires BGBE =1 in SPMSC1, see Section 5.7.7, “System Power Management Status and Control 1 Register (SPMSC1).
Chapter 10 Analog-to-Digital Converter (S08ADC12V1) — VTEMP25 is the voltage of the temperature sensor channel at 25°C. — m is the hot or cold voltage versus temperature slope in V/°C. For temperature calculations, use the VTEMP25 and m values from the Appendix A.9, “ADC Characteristics.” In application code, the user reads the temperature sensor channel, calculates VTEMP, and compares to VTEMP25. If VTEMP is greater than VTEMP25, the cold slope value is applied in Equation 10-1.
Chapter 10 Analog-to-Digital Converter (S08ADC12V1) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SERIAL PERIPHERAL INT
Analog-to-Digital Converter (S08ADC12V1) 10.1.
Analog-to-Digital Converter (S08ADC12V1) ADIV ADLPC MODE ADLSMP ADTRG 2 ADCO ADCH 1 ADCCFG complete COCO ADCSC1 ADICLK Compare true AIEN 3 Async Clock Gen ADACK MCU STOP ADCK ÷2 ALTCLK abort transfer convert initialize ••• AD0 sample Control Sequencer ADHWT Bus Clock Clock Divide AIEN 1 COCO 2 ADVIN Interrupt SAR Converter AD27 VREFH Data Registers Sum VREFL Compare true 3 Compare Value Registers ACFGT Value Compare Logic ADCSC2 Figure 10-2.
Analog-to-Digital Converter (S08ADC12V1) 10.2.1 Analog Power (VDDAD) The ADC analog portion uses VDDAD as its power connection. In some packages, VDDAD is connected internally to VDD. If externally available, connect the VDDAD pin to the same voltage potential as VDD. External filtering may be necessary to ensure clean VDDAD for good results. 10.2.2 Analog Ground (VSSAD) The ADC analog portion uses VSSAD as its ground connection. In some packages, VSSAD is connected internally to VSS.
Analog-to-Digital Converter (S08ADC12V1) 7 R 6 5 AIEN ADCO 0 0 4 3 2 1 0 1 1 COCO ADCH W Reset: 0 1 1 1 Figure 10-3. Status and Control Register (ADCSC1) Table 10-3. ADCSC1 Field Descriptions Field Description 7 COCO Conversion Complete Flag. The COCO flag is a read-only bit set each time a conversion is completed when the compare function is disabled (ACFE = 0).
Analog-to-Digital Converter (S08ADC12V1) 10.3.2 Status and Control Register 2 (ADCSC2) The ADCSC2 register controls the compare function, conversion trigger, and conversion active of the ADC module. 7 R 6 5 4 ADTRG ACFE ACFGT 0 0 0 ADACT 3 2 0 0 0 0 1 0 R1 R1 0 0 W Reset: 1 0 Bits 1 and 0 are reserved bits that must always be written to 0. Figure 10-4. Status and Control Register 2 (ADCSC2) Table 10-5.
Analog-to-Digital Converter (S08ADC12V1) If the MODE bits are changed, any data in ADCRH becomes invalid. R 7 6 5 4 3 2 1 0 0 0 0 0 ADR11 ADR10 ADR9 ADR8 0 0 0 0 0 0 0 0 W Reset: Figure 10-5. Data Result High Register (ADCRH) 10.3.4 Data Result Low Register (ADCRL) ADCRL contains the lower eight bits of the result of a 12-bit or 10-bit conversion, and all eight bits of an 8-bit conversion.
Analog-to-Digital Converter (S08ADC12V1) 10.3.6 Compare Value Low Register (ADCCVL) This register holds the lower 8 bits of the 12-bit or 10-bit compare value or all 8 bits of the 8-bit compare value. When the compare function is enabled, bits ADCV[7:0] are compared to the lower 8 bits of the result following a conversion in 12-bit, 10-bit or 8-bit mode. 7 6 5 4 3 2 1 0 ADCV7 ADCV6 ADCV5 ADCV4 ADCV3 ADCV2 ADCV1 ADCV0 0 0 0 0 0 0 0 0 R W Reset: Figure 10-8.
Analog-to-Digital Converter (S08ADC12V1) Table 10-7. Clock Divide Select ADIV Divide Ratio Clock Rate 00 1 Input clock 01 2 Input clock ÷ 2 10 4 Input clock ÷ 4 11 8 Input clock ÷ 8 Table 10-8. Conversion Modes MODE Mode Description 00 8-bit conversion (N=8) 01 12-bit conversion (N=12) 10 10-bit conversion (N=10) 11 Reserved Table 10-9. Input Clock Select ADICLK 10.3.
Analog-to-Digital Converter (S08ADC12V1) Table 10-10. APCTL1 Register Field Descriptions (continued) Field Description 5 ADPC5 ADC Pin Control 5. ADPC5 controls the pin associated with channel AD5. 0 AD5 pin I/O control enabled 1 AD5 pin I/O control disabled 4 ADPC4 ADC Pin Control 4. ADPC4 controls the pin associated with channel AD4. 0 AD4 pin I/O control enabled 1 AD4 pin I/O control disabled 3 ADPC3 ADC Pin Control 3. ADPC3 controls the pin associated with channel AD3.
Analog-to-Digital Converter (S08ADC12V1) Table 10-11. APCTL2 Register Field Descriptions (continued) Field Description 4 ADPC12 ADC Pin Control 12. ADPC12 controls the pin associated with channel AD12. 0 AD12 pin I/O control enabled 1 AD12 pin I/O control disabled 3 ADPC11 ADC Pin Control 11. ADPC11 controls the pin associated with channel AD11. 0 AD11 pin I/O control enabled 1 AD11 pin I/O control disabled 2 ADPC10 ADC Pin Control 10. ADPC10 controls the pin associated with channel AD10.
Analog-to-Digital Converter (S08ADC12V1) Table 10-12. APCTL3 Register Field Descriptions (continued) Field Description 3 ADPC19 ADC Pin Control 19. ADPC19 controls the pin associated with channel AD19. 0 AD19 pin I/O control enabled 1 AD19 pin I/O control disabled 2 ADPC18 ADC Pin Control 18. ADPC18 controls the pin associated with channel AD18. 0 AD18 pin I/O control enabled 1 AD18 pin I/O control disabled 1 ADPC17 ADC Pin Control 17. ADPC17 controls the pin associated with channel AD17.
Analog-to-Digital Converter (S08ADC12V1) • The asynchronous clock (ADACK). This clock is generated from a clock source within the ADC module. When selected as the clock source, this clock remains active while the MCU is in wait or stop3 mode and allows conversions in these modes for lower noise operation. Whichever clock is selected, its frequency must fall within the specified frequency range for ADCK. If the available clocks are too slow, the ADC do not perform according to specifications.
Analog-to-Digital Converter (S08ADC12V1) If continuous conversions are enabled, a new conversion is automatically initiated after the completion of the current conversion. In software triggered operation, continuous conversions begin after ADCSC1 is written and continue until aborted. In hardware triggered operation, continuous conversions begin after a hardware trigger event and continue until aborted. 10.4.4.
Analog-to-Digital Converter (S08ADC12V1) 10.4.4.5 Sample Time and Total Conversion Time The total conversion time depends on the sample time (as determined by ADLSMP), the MCU bus frequency, the conversion mode (8-bit, 10-bit or 12-bit), and the frequency of the conversion clock (fADCK). After the module becomes active, sampling of the input begins. ADLSMP selects between short (3.5 ADCK cycles) and long (23.5 ADCK cycles) sample times.
Analog-to-Digital Converter (S08ADC12V1) NOTE The ADCK frequency must be between fADCK minimum and fADCK maximum to meet ADC specifications. 10.4.5 Automatic Compare Function The compare function can be configured to check for an upper or lower limit. After the input is sampled and converted, the result is added to the two’s complement of the compare value (ADCCVH and ADCCVL). When comparing to an upper limit (ACFGT = 1), if the result is greater-than or equal-to the compare value, COCO is set.
Analog-to-Digital Converter (S08ADC12V1) are unaffected by stop3 mode. After exiting from stop3 mode, a software or hardware trigger is required to resume conversions. 10.4.7.2 Stop3 Mode With ADACK Enabled If ADACK is selected as the conversion clock, the ADC continues operation during stop3 mode. For guaranteed ADC operation, the MCU’s voltage regulator must remain active during stop3 mode. Consult the module introduction for configuration information for this MCU.
Analog-to-Digital Converter (S08ADC12V1) 10.5.1 ADC Module Initialization Example 10.5.1.1 Initialization Sequence Before the ADC module can be used to complete conversions, an initialization procedure must be performed. A typical sequence is as follows: 1. Update the configuration register (ADCCFG) to select the input clock source and the divide ratio used to generate the internal clock, ADCK. This register is also used for selecting sample time and low-power configuration. 2.
Analog-to-Digital Converter (S08ADC12V1) APCTL1=0x02 AD1 pin I/O control disabled. All other AD pins remain general purpose I/O pins APCTL2=0x00 All other AD pins remain general purpose I/O pins Reset Initialize ADC ADCCFG = 0x98 ADCSC2 = 0x00 ADCSC1 = 0x41 Check COCO=1? No Yes Read ADCRH Then ADCRL To Clear COCO Bit Continue Figure 10-13. Initialization Flowchart for Example 10.6 Application Information This section contains information for using the ADC module in applications.
Analog-to-Digital Converter (S08ADC12V1) devices, VSSAD and VDDAD are shared with the MCU digital supply pins. In these cases, there are separate pads for the analog supplies bonded to the same pin as the corresponding digital supply so that some degree of isolation between the supplies is maintained.
Analog-to-Digital Converter (S08ADC12V1) than VREFL, the converter circuit converts it to 0x000. Input voltages between VREFH and VREFL are straight-line linear conversions. There is a brief current associated with VREFL when the sampling capacitor is charging. The input is sampled for 3.5 cycles of the ADCK source when ADLSMP is low, or 23.5 cycles when ADLSMP is high.
Analog-to-Digital Converter (S08ADC12V1) • There is no I/O switching, input or output, on the MCU during the conversion. There are some situations where external system activity causes radiated or conducted noise emissions or excessive VDD noise is coupled into the ADC. In these situations, or when the MCU cannot be placed in wait or stop3 or I/O activity cannot be halted, these recommended actions may reduce the effect of noise on the accuracy: • Place a 0.
Analog-to-Digital Converter (S08ADC12V1) • • Integral non-linearity (INL) — This error is defined as the highest-value the (absolute value of the) running sum of DNL achieves. More simply, this is the worst-case difference of the actual transition voltage to a given code and its corresponding ideal transition voltage, for all codes.
Chapter 11 Inter-Integrated Circuit (S08IICV2) 11.1 Introduction The MC9S08JM16 series of microcontrollers have an inter-integrated circuit (IIC) module for communication with other integrated circuits. The two pins associated with this module, SCL and SDA, are shared with PTC0 and PTC1, respectively. NOTE MC9S08JM16 devices operate at a higher voltage range (2.7 V to 5.5 V) and do not include stop1 mode. Therefore, please disregard references to stop1. MC9S08JM16 Series Data Sheet, Rev.
Chapter 11 Inter-Integrated Circuit (S08IICV2) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SERIAL PERIPHERAL INTERFAC
Inter-Integrated Circuit (S08IICV2) 11.1.
Inter-Integrated Circuit (S08IICV2) Address Data Bus Interrupt ADDR_DECODE CTRL_REG DATA_MUX FREQ_REG ADDR_REG STATUS_REG DATA_REG Input Sync Start Stop Arbitration Control Clock Control In/Out Data Shift Register Address Compare SCL SDA Figure 11-2. IIC Functional Block Diagram 11.2 External Signal Description This section describes each user-accessible pin signal. 11.2.1 SCL — Serial Clock Line The bidirectional SCL is the serial clock line of the IIC system. 11.2.
Inter-Integrated Circuit (S08IICV2) Freescale-provided equate or header file is used to translate these names into the appropriate absolute addresses. 11.3.1 IIC Address Register (IICA) 7 6 5 4 3 2 1 AD7 AD6 AD5 AD4 AD3 AD2 AD1 0 0 0 0 0 0 0 R 0 0 W Reset 0 = Unimplemented or Reserved Figure 11-3. IIC Address Register (IICA) Table 11-1. IICA Field Descriptions Field Description 7–1 AD[7:1] Slave Address.
Inter-Integrated Circuit (S08IICV2) Table 11-2. IICF Field Descriptions Field 7–6 MULT 5–0 ICR Description IIC Multiplier Factor. The MULT bits define the multiplier factor, mul. This factor, along with the SCL divider, generates the IIC baud rate. The multiplier factor mul as defined by the MULT bits is provided below. 00 mul = 01 01 mul = 02 10 mul = 04 11 Reserved IIC Clock Rate. The ICR bits are used to prescale the bus clock for bit rate selection.
Inter-Integrated Circuit (S08IICV2) Table 11-4.
Inter-Integrated Circuit (S08IICV2) 11.3.3 IIC Control Register (IICC1) 7 6 5 4 3 IICEN IICIE MST TX TXAK R W Reset 2 1 0 0 0 0 0 0 RSTA 0 0 0 0 0 0 = Unimplemented or Reserved Figure 11-5. IIC Control Register (IICC1) Table 11-5. IICC1 Field Descriptions Field Description 7 IICEN IIC Enable. The IICEN bit determines whether the IIC module is enabled. 0 IIC is not enabled 1 IIC is enabled 6 IICIE IIC Interrupt Enable.
Inter-Integrated Circuit (S08IICV2) Table 11-6. IICS Field Descriptions Field Description 7 TCF Transfer Complete Flag. This bit is set on the completion of a byte transfer. This bit is only valid during or immediately following a transfer to the IIC module or from the IIC module.The TCF bit is cleared by reading the IICD register in receive mode or writing to the IICD in transmit mode. 0 Transfer in progress 1 Transfer complete 6 IAAS Addressed as a Slave.
Inter-Integrated Circuit (S08IICV2) Table 11-7. IICD Field Descriptions Field Description 7–0 DATA Data — In master transmit mode, when data is written to the IICD, a data transfer is initiated. The most significant bit is sent first. In master receive mode, reading this register initiates receiving of the next byte of data.
Inter-Integrated Circuit (S08IICV2) 11.4 Functional Description This section provides a complete functional description of the IIC module. 11.4.1 IIC Protocol The IIC bus system uses a serial data line (SDA) and a serial clock line (SCL) for data transfer. All devices connected to it must have open drain or open collector outputs. A logic AND function is exercised on both lines with external pullup resistors. The value of these resistors is system dependent.
Inter-Integrated Circuit (S08IICV2) 11.4.1.2 Slave Address Transmission The first byte of data transferred immediately after the start signal is the slave address transmitted by the master. This is a seven-bit calling address followed by a R/W bit. 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.
Inter-Integrated Circuit (S08IICV2) 11.4.1.5 Repeated Start Signal As shown in Figure 11-9, a repeated start signal is a start signal generated without first generating a stop signal to terminate the communication. This is used by the master to communicate with another slave or with the same slave in different mode (transmit/receive mode) without releasing the bus. 11.4.1.6 Arbitration Procedure The IIC bus is a true multi-master bus that allows more than one master to be connected on it.
Inter-Integrated Circuit (S08IICV2) 11.4.1.8 Handshaking The clock synchronization mechanism can be used as a handshake in data transfer. Slave devices may hold the SCL low after completion of one byte transfer (9 bits). In such a case, it halts the bus clock and forces the master clock into wait states until the slave releases the SCL line. 11.4.1.9 Clock Stretching The clock synchronization mechanism can be used by slaves to slow down the bit rate of a transfer.
Inter-Integrated Circuit (S08IICV2) After a repeated start condition (Sr), all other slave devices also compare the first seven bits of the first byte of the slave address with their own addresses and test the eighth (R/W) bit. However, none of them are addressed because R/W = 1 (for 10-bit devices) or the 11110XX slave address (for 7-bit devices) does not match.
Inter-Integrated Circuit (S08IICV2) 11.6.2 Address Detect Interrupt When the calling address matches the programmed slave address (IIC address register) or when the 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 is set. The CPU must check the SRW bit and set its Tx mode accordingly. 11.6.3 Arbitration Lost Interrupt The IIC is a true multi-master bus that allows more than one master to be connected on it.
Inter-Integrated Circuit (S08IICV2) 11.7 Initialization/Application Information Module Initialization (Slave) 1. Write: IICC2 — to enable or disable general call — to select 10-bit or 7-bit addressing mode 2. Write: IICA — to set the slave address 3. Write: IICC1 — to enable IIC and interrupts 4. Initialize RAM variables (IICEN = 1 and IICIE = 1) for transmit data 5. Initialize RAM variables used to achieve the routine shown in Figure 11-12 Module Initialization (Master) 1.
Inter-Integrated Circuit (S08IICV2) Clear IICIF Master Mode ? Y TX N Arbitration Lost ? Y RX Tx/Rx ? N Last Byte Transmitted ? N Clear ARBL Y RXAK=0 ? Last Byte to Be Read ? N N N Y Y IAAS=1 ? Y IAAS=1 ? Y Address Transfer See Note 1 Y End of Addr Cycle (Master Rx) ? Y Y (Read) 2nd Last Byte to Be Read ? N SRW=1 ? Write Next Byte to IICD Set TXACK =1 Generate Stop Signal (MST = 0) TX Y Set TX Mode RX TX/RX ? N (Write) N N Data Transfer See Note 2 ACK from Receiver ?
Chapter 12 Multi-Purpose Clock Generator (S08MCGV1) 12.1 Introduction The multi-purpose clock generator (MCG) module provides several clock source choices for the MCU, which contains a frequency-locked loop (FLL) and a phase-locked loop (PLL) The module can select either of the FLL or PLL clocks, or either of the internal or external reference clocks as a source for the MCU system clock.
Chapter 12 Multi-Purpose Clock Generator (S08MCGV1) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SERIAL PERIPHERAL INT
Multi-Purpose Clock Generator (S08MCGV1) 12.1.1 Features Key features of the MCG module are: • Frequency-locked loop (FLL) — 0.
Multi-Purpose Clock Generator (S08MCGV1) External Oscillator (XOSC) RANGE EREFS ERCLKEN MCGERCLK HGO EREFSTEN IRCLKEN MCGIRCLK CME IREFSTEN CLKS Clock Monitor LOC BDIV / 2n Internal Reference Clock OSCINIT 9 IREFS MCGOUT n=0-3 LP DCO DCOOUT TRIM PLLS /2 n RDIV_CLK Lock Detector Filter n=0-7 FLL LOLS LOCK MCGFFCLK RDIV LP VCOOUT Phase Detector Charge Pump VDIV Internal Filter MCGLCLK /2 VCO PLL /(4,8,12,...,40) Multi-purpose Clock Generator (MCG) Figure 12-2.
Multi-Purpose Clock Generator (S08MCGV1) 12.1.2 Modes of Operation There are nine modes of operation for the MCG: • FLL Engaged Internal (FEI) • FLL Engaged External (FEE) • FLL Bypassed Internal (FBI) • FLL Bypassed External (FBE) • PLL Engaged External (PEE) • PLL Bypassed External (PBE) • Bypassed Low Power Internal (BLPI) • Bypassed Low Power External (BLPE) • Stop For details see Section 12.4.1, “Operational Modes.” 12.2 External Signal Description There are no MCG signals that connect off chip.
Multi-Purpose Clock Generator (S08MCGV1) 12.3 Register Definition 12.3.1 MCG Control Register 1 (MCGC1) 7 6 5 4 3 2 1 0 IREFS IRCLKEN IREFSTEN 1 0 0 R CLKS RDIV W Reset: 0 0 0 0 0 Figure 12-3. MCG Control Register 1 (MCGC1) Table 12-1. MCG Control Register 1 Field Descriptions Field Description 7:6 CLKS Clock Source Select — Selects the system clock source. 00 Encoding 0 — Output of FLL or PLL is selected. 01 Encoding 1 — Internal reference clock is selected.
Multi-Purpose Clock Generator (S08MCGV1) 12.3.2 MCG Control Register 2 (MCGC2) 7 6 5 4 3 2 RANGE HGO LP EREFS 0 0 0 0 1 0 R BDIV ERCLKEN EREFSTEN W Reset: 0 1 0 0 Figure 12-4. MCG Control Register 2 (MCGC2) Table 12-2. MCG Control Register 2 Field Descriptions Field Description 7:6 BDIV Bus Frequency Divider — Selects the amount to divide down the clock source selected by the CLKS bits in the MCGC1 register. This controls the bus frequency.
Multi-Purpose Clock Generator (S08MCGV1) 12.3.3 MCG Trim Register (MCGTRM) 7 6 5 4 3 2 1 0 R TRIM W POR: 1 0 0 0 0 0 0 0 Reset: U U U U U U U U Figure 12-5. MCG Trim Register (MCGTRM) Table 12-3. MCG Trim Register Field Descriptions Field Description 7:0 TRIM MCG Trim Setting — Controls the internal reference clock frequency by controlling the internal reference clock period. The TRIM bits are binary weighted (i.e., bit 1 will adjust twice as much as bit 0).
Multi-Purpose Clock Generator (S08MCGV1) 12.3.4 MCG Status and Control Register (MCGSC) R 7 6 5 4 3 LOLS LOCK PLLST IREFST 2 CLKST 1 0 OSCINIT FTRIM W POR: Reset: 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 U Figure 12-6. MCG Status and Control Register (MCGSC) Table 12-4. MCG Status and Control Register Field Descriptions Field Description 7 LOLS Loss of Lock Status — This bit is a sticky indication of lock status for the FLL or PLL.
Multi-Purpose Clock Generator (S08MCGV1) Table 12-4. MCG Status and Control Register Field Descriptions (continued) Field Description 1 OSCINIT OSC Initialization — If the external reference clock is selected by ERCLKEN or by the MCG being in FEE, FBE, PEE, PBE, or BLPE mode, and if EREFS is set, then this bit is set after the initialization cycles of the external oscillator clock have completed.
Multi-Purpose Clock Generator (S08MCGV1) Table 12-5. MCG PLL Register Field Descriptions (continued) Field Description 5 CME Clock Monitor Enable — Determines if a reset request is made following a loss of external clock indication. The CME bit must only be set to a logic 1 when either the MCG is in an operational mode that uses the external clock (FEE, FBE, PEE, PBE, or BLPE) or the external reference is enabled (ERCLKEN=1 in the MCGC2 register).
Multi-Purpose Clock Generator (S08MCGV1) 12.4 Functional Description 12.4.
Multi-Purpose Clock Generator (S08MCGV1) In FLL engaged internal mode, the MCGOUT clock is derived from the FLL clock, which is controlled by the internal reference clock. The FLL clock frequency locks to 1024 times the reference frequency, as selected by the RDIV bits. The MCGLCLK is derived from the FLL and the PLL is disabled in a low power state. 12.4.1.
Multi-Purpose Clock Generator (S08MCGV1) • • • • • CLKS bits are written to 10 IREFS bit is written to 0 PLLS bit is written to 0 RDIV bits are written to divide reference clock to be within the range of 31.25 kHz to 39.0625 kHz LP bit is written to 0 In FLL bypassed external mode, the MCGOUT clock is derived from the external reference clock. The external reference clock which is enabled can be an external crystal/resonator or it can be another external clock source.
Multi-Purpose Clock Generator (S08MCGV1) 12.4.1.6 PLL Bypassed External (PBE) In PLL bypassed external (PBE) mode, the MCGOUT clock is derived from the external reference clock and the PLL is operational but its output clock is not used. This mode is useful to allow the PLL to acquire its target frequency while the MCGOUT clock is driven from the external reference clock.
Multi-Purpose Clock Generator (S08MCGV1) In bypassed low power external mode, the MCGOUT clock is derived from the external reference clock. The external reference clock which is enabled can be an external crystal/resonator or it can be another external clock source. The PLL and the FLL are disabled at all times in BLPE mode and the MCGLCLK will not be available for BDC communications.
Multi-Purpose Clock Generator (S08MCGV1) 12.4.4 Low Power Bit Usage The low power bit (LP) is provided to allow the FLL or PLL to be disabled and thus conserve power when these systems are not being used. However, in some applications it may be desirable to enable the FLL or PLL and allow it to lock for maximum accuracy before switching to an engaged mode. Do this by writing the LP bit to 0. 12.4.
Multi-Purpose Clock Generator (S08MCGV1) • BDIV=00 (divide by 1), RDIV < 010 BDIV=01 (divide by 2), RDIV < 011 12.5 Initialization / Application Information This section describes how to initialize and configure the MCG module in application. The following sections include examples on how to initialize the MCG and properly switch between the various available modes. 12.5.1 MCG Module Initialization Sequence The MCG comes out of reset configured for FEI mode with the BDIV set for divide-by-2.
Multi-Purpose Clock Generator (S08MCGV1) minimum power consumption, leave the internal reference disabled while in an external clock mode. 3. After the proper configuration bits have been set, wait for the affected bits in the MCGSC register to be changed appropriately, reflecting that the MCG has moved into the proper mode.
Multi-Purpose Clock Generator (S08MCGV1) The table below shows MCGOUT frequency calculations using RDIV, BDIV, and VDIV settings for each clock mode. The bus frequency is equal to MCGOUT divided by 2. Table 12-6. MCGOUT Frequency Calculation Options fMCGOUT1 Clock Mode Note FEI (FLL engaged internal) (fint * 1024) / B Typical fMCGOUT = 16 MHz immediately after reset. RDIV bits set to %000. FEE (FLL engaged external) (fext / R *1024) / B fext / R must be in the range of 31.25 kHz to 39.
Multi-Purpose Clock Generator (S08MCGV1) – CLKS (bits 7 and 6) set to %10 in order to select external reference clock as system clock source – RDIV (bits 5-3) set to %111, or divide-by-128 because 4 MHz / 128 = 31.25 kHz which is in the 31.25 kHz to 39.
Multi-Purpose Clock Generator (S08MCGV1) START IN FEI MODE MCGC2 = $36 IN BLPE MODE ? (LP=1) CHECK NO NO YES OSCINIT = 1 ? MCGC2 = $36 (LP = 0) YES MCGC1 = $B8 CHECK PLLST = 1? CHECK NO NO YES IREFST = 0? YES CHECK LOCK = 1? CHECK CLKST = %10? NO NO YES MCGC1 = $10 YES ENTER BLPE MODE ? NO CHECK CLKST = %11? NO YES YES MCGC2 = $3E (LP = 1) CONTINUE IN PEE MODE MCGC1 = $90 MCGC3 = $44 Figure 12-9.
Multi-Purpose Clock Generator (S08MCGV1) 12.5.2.2 Example # 2: Moving from PEE to BLPI Mode: External Crystal = 4 MHz, Bus Frequency =16 kHz In this example, the MCG will move through the proper operational modes from PEE mode with a 4 MHz crystal configured for an 8 MHz bus frequency (see previous example) to BLPI mode with a 16 kHz bus frequency.First, the code sequence will be described. Then a flowchart will be included which illustrates the sequence. 1.
Multi-Purpose Clock Generator (S08MCGV1) 4. Lastly, FBI transitions into FBILP mode. a) MCGC2 = 0x08 (%00001000) – LP (bit 3) in MCGSC is 1 START IN PEE MODE MCGC1 = $90 CHECK PLLST = 0? CHECK NO CLKST = %10 ? YES YES OPTIONAL: CHECK LOCK = 1? ENTER NO NO NO BLPE MODE ? YES MCGC1 = $44 YES MCGC2 = $3E CHECK IREFST = 0? MCGC1 = $B8 MCGC3 = $04 IN BLPE MODE ? (LP=1) NO YES NO CHECK CLKST = %01? NO YES YES MCGC2 = $36 (LP = 0) MCGC2 = $08 CONTINUE IN BLPI MODE Figure 12-10.
Multi-Purpose Clock Generator (S08MCGV1) 12.5.2.3 Example #3: Moving from BLPI to FEE Mode: External Crystal = 4 MHz, Bus Frequency = 16 MHz In this example, the MCG will move through the proper operational modes from BLPI mode at a 16 kHz bus frequency running off of the internal reference clock (see previous example) to FEE mode using a 4 MHz crystal configured for a 16 MHz bus frequency. First, the code sequence will be described. Then a flowchart will be included which illustrates the sequence. 1.
Multi-Purpose Clock Generator (S08MCGV1) START IN BLPI MODE CHECK NO IREFST = 0? MCGC2 = $00 YES OPTIONAL: CHECK LOCK = 1? NO OPTIONAL: CHECK LOCK = 1? NO YES YES MCGC2 = $36 CHECK CLKST = %00? CHECK NO NO YES OSCINIT = 1 ? CONTINUE YES IN FEE MODE MCGC1 = $38 Figure 12-11. Flowchart of BLPI to FEE Mode Transition using a 4 MHz Crystal 12.5.2.
Multi-Purpose Clock Generator (S08MCGV1) external crystal and a maximum reference divider factor of 128, the resulting frequency of the reference clock for the FLL is 62.5 kHz (greater than the 39.0625 kHz maximum allowed). Care must be taken in the software to minimize the amount of time spent in this state where the FLL is operating in this condition.
Multi-Purpose Clock Generator (S08MCGV1) c) MCGC1 = 0x98 (%10011000) – RDIV (bits 5-3) set to %011, or divide-by-8 because 8 MHz / 8= 1 MHz which is in the 1 MHz to 2 MHz range required by the PLL. In BLPE mode, the configuration of the RDIV does not matter because both the FLL and PLL are disabled. Changing them only sets up the the dividers for PLL usage in PBE mode d) MCGC3 = 0x44 (%01000100) – PLLS (bit 6) set to 1, selects the PLL.
Multi-Purpose Clock Generator (S08MCGV1) START IN FEI MODE MCGC2 = $36 CHECK NO CHECK PLLST = 1? NO OSCINIT = 1 ? YES YES MCGC2 = $36 (LP = 0) MCGC1 = $B8 CHECK NO IREFST = 0? CHECK LOCK = 1? NO YES YES CHECK CLKST = %10? NO MCGC1 = $18 YES CHECK CLKST = %11? MCGC2 = $3E (LP = 1) NO YES MCGC1 = $98 MCGC3 = $44 CONTINUE IN PEE MODE Figure 12-12. Flowchart of FEI to PEE Mode Transition using a 8 MHz Crystal MC9S08JM16 Series Data Sheet, Rev.
Multi-Purpose Clock Generator (S08MCGV1) 12.5.3 Calibrating the Internal Reference Clock (IRC) The IRC is calibrated by writing to the MCGTRM register first, then using the FTRIM bit to “fine tune” the frequency. We will refer to this total 9-bit value as the trim value, ranging from 0x000 to 0x1FF, where the FTRIM bit is the LSB. The trim value after a POR is always 0x100 (MCGTRM = 0x80 and FTRIM = 0). Writing a larger value will decrease the frequency and smaller values will increase the frequency.
Multi-Purpose Clock Generator (S08MCGV1) Initial conditions: 1) Clock supplied from ATE has 500 μs duty period 2) MCG configured for internal reference with 8MHz bus START TRIM PROCEDURE TRMVAL = $100 n=1 MEASURE INCOMING CLOCK WIDTH (COUNT = # OF BUS CLOCKS / 8) COUNT < EXPECTED = 500 (RUNNING TOO SLOW) .
Multi-Purpose Clock Generator (S08MCGV1) MC9S08JM16 Series Data Sheet, Rev.
Chapter 13 Real-Time Counter (S08RTCV1) 13.1 Introduction The real-time counter (RTC) consists of one 8-bit counter, one 8-bit comparator, several binary-based and decimal-based prescaler dividers, two clock sources, and one programmable periodic interrupt. This module can be used for time-of-day, calendar or any task scheduling functions. It can also serve as a cyclic wakeup from low power modes without the need for external components. MC9S08JM16 Series Data Sheet, Rev.
Chapter 13 Real-Time Counter (S08RTCV1) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODUL
Real-Time Counter (S08RTCV1) 13.1.1 Features Features of the RTC module include: • 8-bit up-counter — 8-bit modulo match limit — Software controllable periodic interrupt on match • Three software selectable clock sources for input to prescaler with selectable binary-based and decimal-based divider values — 1 kHz internal low-power oscillator (LPO) — External clock (ERCLK) — 32 kHz internal clock (IRCLK) 13.1.
Real-Time Counter (S08RTCV1) 13.1.3 Block Diagram The block diagram for the RTC module is shown in Figure 13-2. LPO Clock Source Select ERCLK IRCLK 8-Bit Modulo (RTCMOD) RTCLKS VDD RTCLKS[0] RTCPS Prescaler Divide-By Q D Background Mode E 8-Bit Comparator RTC Clock RTC Interrupt Request RTIF R Write 1 to RTIF 8-Bit Counter (RTCCNT) RTIE Figure 13-2. Real-Time Counter (RTC) Block Diagram 13.2 External Signal Description The RTC does not include any off-chip signals. 13.
Real-Time Counter (S08RTCV1) 13.3.1 RTC Status and Control Register (RTCSC) RTCSC contains the real-time interrupt status flag (RTIF), the clock select bits (RTCLKS), the real-time interrupt enable bit (RTIE), and the prescaler select bits (RTCPS). 7 6 5 4 3 2 1 0 0 0 R RTIF RTCLKS RTIE RTCPS W Reset: 0 0 0 0 0 0 Figure 13-3. RTC Status and Control Register (RTCSC) Table 13-2.
Real-Time Counter (S08RTCV1) 13.3.2 RTCCNT RTC Counter Register (RTCCNT) is the read-only value of the current RTC count of the 8-bit counter. 7 6 5 4 R 3 2 1 0 0 0 0 0 RTCCNT W Reset: 0 0 0 0 Figure 13-4. RTC Counter Register (RTCCNT) Table 13-4. RTCCNT Field Descriptions Field Description 7:0 RTCCNT RTC Count. These eight read-only bits contain the current value of the 8-bit counter. Writes have no effect to this register.
Real-Time Counter (S08RTCV1) RTCPS and the RTCLKS[0] bit select the desired divide-by value. If a different value is written to RTCPS, the prescaler and RTCCNT counters are reset to 0x00. Table 13-6 shows different prescaler period values. Table 13-6. Prescaler Period RTCPS 1 kHz Internal Clock (RTCLKS = 00) 1 MHz External Clock 32 kHz Internal Clock 32 kHz Internal Clock (RTCLKS = 01) (RTCLKS = 10) (RTCLKS = 11) 0000 Off Off Off Off 0001 8 ms 1.024 ms 250 μs 32 ms 0010 32 ms 2.
Real-Time Counter (S08RTCV1) Internal 1 kHz Clock Source RTC Clock (RTCPS = 0xA) RTCCNT 0x52 0x53 0x54 0x55 0x00 0x01 RTIF RTCMOD 0x55 Figure 13-6. RTC Counter Overflow Example In the example of Figure 13-6, the selected clock source is the 1 kHz internal oscillator clock source. The prescaler (RTCPS) is set to 0xA or divide-by-4. The modulo value in the RTCMOD register is set to 0x55.
Real-Time Counter (S08RTCV1) RTCSC.byte = RTCSC.byte | 0x80; /* RTC interrupts every 1 Second */ Seconds++; /* 60 seconds in a minute */ if (Seconds > 59){ Minutes++; Seconds = 0; } /* 60 minutes in an hour */ if (Minutes > 59){ Hours++; Minutes = 0; } /* 24 hours in a day */ if (Hours > 23){ Days ++; Hours = 0; } MC9S08JM16 Series Data Sheet, Rev.
Real-Time Counter (S08RTCV1) MC9S08JM16 Series Data Sheet, Rev.
Chapter 14 Serial Communications Interface (S08SCIV4) 14.1 Introduction The MC9S08JM16 series include two independent serial communications interface (SCI) modules, which are sometimes called universal asynchronous receiver/transmitters (UARTs). Typically, these systems are used to connect to the RS232 serial input/output (I/O) port of a personal computer or workstation, but they can also be used to communicate with other embedded controllers.
Chapter 14 Serial Communications Interface (S08SCIV4) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT FULL SPEED USB USB ENDPOINT TRANSCEIVER RAM 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS INTERFACE MODULE (SCI2) COP IRQ LVD IIC MODULE (IIC) VDDAD USER FLASH (IN BYTES) MC9S08JM16 = 16,384 MC9S08JM8 = 8,192 SS2 SPSCK2 MOSI2 MISO2 RxD2 TxD2 SDA SCL 6 ANALOG COMPARATOR (ACMP) ACMP+ 8-/16-BIT SERIAL PERIPHERAL I
Serial Communications Interface (S08SCIV4) 14.1.
Serial Communications Interface (S08SCIV4) 14.1.3 Block Diagram Figure 14-2 shows the transmitter portion of the SCI.
Serial Communications Interface (S08SCIV4) Figure 14-3 shows the receiver portion of the SCI.
Serial Communications Interface (S08SCIV4) 14.2 Register Definition The SCI has eight 8-bit registers to control baud rate, select SCI options, report SCI status, and for transmit/receive data. Refer to the direct-page register summary in the Memory chapter of this data sheet for the absolute address assignments for all SCI registers. This section refers to registers and control bits only by their names.
Serial Communications Interface (S08SCIV4) 7 6 5 4 3 2 1 0 SBR7 SBR6 SBR5 SBR4 SBR3 SBR2 SBR1 SBR0 0 0 0 0 0 1 0 0 R W Reset Figure 14-5. SCI Baud Rate Register (SCIxBDL) Table 14-2. SCIxBDL Field Descriptions Field 7:0 SBR[7:0] 14.2.2 Description Baud Rate Modulo Divisor — These 13 bits in SBR[12:0] are referred to collectively as BR, and they set the modulo divide rate for the SCI baud rate generator.
Serial Communications Interface (S08SCIV4) Table 14-3. SCIxC1 Field Descriptions (continued) Field 3 WAKE Description Receiver Wakeup Method Select — Refer to Section 14.3.3.2, “Receiver Wakeup Operation” for more information. 0 Idle-line wakeup. 1 Address-mark wakeup. 2 ILT Idle Line Type Select — Setting this bit to 1 ensures that the stop bit and logic 1 bits at the end of a character do not count toward the 10 or 11 bit times of logic high level needed by the idle line detection logic.
Serial Communications Interface (S08SCIV4) Table 14-4. SCIxC2 Field Descriptions (continued) Field Description 3 TE Transmitter Enable 0 Transmitter off. 1 Transmitter on. TE must be 1 in order to use the SCI transmitter. When TE = 1, the SCI forces the TxD pin to act as an output for the SCI system. When the SCI is configured for single-wire operation (LOOPS = RSRC = 1), TXDIR controls the direction of traffic on the single SCI communication line (TxD pin).
Serial Communications Interface (S08SCIV4) Table 14-5. SCIxS1 Field Descriptions Field Description 7 TDRE Transmit Data Register Empty Flag — TDRE is set out of reset and when a transmit data value transfers from the transmit data buffer to the transmit shifter, leaving room for a new character in the buffer. To clear TDRE, read SCIxS1 with TDRE = 1 and then write to the SCI data register (SCIxD). 0 Transmit data register (buffer) full. 1 Transmit data register (buffer) empty.
Serial Communications Interface (S08SCIV4) Table 14-5. SCIxS1 Field Descriptions (continued) Field Description 1 FE Framing Error Flag — FE is set at the same time as RDRF when the receiver detects a logic 0 where the stop bit was expected. This suggests the receiver was not properly aligned to a character frame. To clear FE, read SCIxS1 with FE = 1 and then read the SCI data register (SCIxD). 0 No framing error detected. This does not guarantee the framing is correct. 1 Framing error.
Serial Communications Interface (S08SCIV4) Table 14-6. SCIxS2 Field Descriptions (continued) 1 Field Description 1 LBKDE LIN Break Detection Enable— LBKDE is used to select a longer break character detection length. While LBKDE is set, framing error (FE) and receive data register full (RDRF) flags are prevented from setting. 0 Break character is detected at length of 10 bit times (11 if M = 1). 1 Break character is detected at length of 11 bit times (12 if M = 1).
Serial Communications Interface (S08SCIV4) Table 14-7. SCIxC3 Field Descriptions (continued) Field 4 TXINV1 1 Description Transmit Data Inversion — Setting this bit reverses the polarity of the transmitted data output. 0 Transmit data not inverted 1 Transmit data inverted 3 ORIE Overrun Interrupt Enable — This bit enables the overrun flag (OR) to generate hardware interrupt requests. 0 OR interrupts disabled (use polling). 1 Hardware interrupt requested when OR = 1.
Serial Communications Interface (S08SCIV4) MODULO DIVIDE BY (1 THROUGH 8191) BUSCLK SBR12:SBR0 BAUD RATE GENERATOR OFF IF [SBR12:SBR0] = 0 DIVIDE BY 16 Tx BAUD RATE Rx SAMPLING CLOCK (16 × BAUD RATE) BAUD RATE = BUSCLK [SBR12:SBR0] × 16 Figure 14-12. SCI Baud Rate Generation SCI communications require the transmitter and receiver (which typically derive baud rates from independent clock sources) to use the same baud rate.
Serial Communications Interface (S08SCIV4) Writing 0 to TE does not immediately release the pin to be a general-purpose I/O pin. Any transmit activity that is in progress must first be completed. This includes data characters in progress, queued idle characters, and queued break characters. 14.3.2.1 Send Break and Queued Idle The SBK control bit in SCIxC2 is used to send break characters which were originally used to gain the attention of old teletype receivers.
Serial Communications Interface (S08SCIV4) status flag is set. If RDRF was already set indicating the receive data register (buffer) was already full, the overrun (OR) status flag is set and the new data is lost. Because the SCI receiver is double-buffered, the program has one full character time after RDRF is set before the data in the receive data buffer must be read to avoid a receiver overrun.
Serial Communications Interface (S08SCIV4) message characters. At the end of a message, or at the beginning of the next message, all receivers automatically force RWU to 0 so all receivers wake up in time to look at the first character(s) of the next message. 14.3.3.2.1 Idle-Line Wakeup When WAKE = 0, the receiver is configured for idle-line wakeup. In this mode, RWU is cleared automatically when the receiver detects a full character time of the idle-line level.
Serial Communications Interface (S08SCIV4) Instead of hardware interrupts, software polling may be used to monitor the TDRE and TC status flags if the corresponding TIE or TCIE local interrupt masks are 0s. When a program detects that the receive data register is full (RDRF = 1), it gets the data from the receive data register by reading SCIxD. The RDRF flag is cleared by reading SCIxS1 while RDRF = 1 and then reading SCIxD.
Serial Communications Interface (S08SCIV4) 14.3.5.2 Stop Mode Operation During all stop modes, clocks to the SCI module are halted. In stop1 and stop2 modes, all SCI register data is lost and must be re-initialized upon recovery from these two stop modes. No SCI module registers are affected in stop3 mode. The receive input active edge detect circuit is still active in stop3 mode, but not in stop2.
Serial Communications Interface (S08SCIV4) MC9S08JM16 Series Data Sheet, Rev.
Chapter 15 16-Bit Serial Peripheral Interface (S08SPI16V1) 15.1 Introduction The 8- or 16-bit selectable serial peripheral interface (SPI) module provides for full-duplex, synchronous, serial communication between the MCU and peripheral devices. These peripheral devices can include other microcontrollers, analog-to-digital converters, shift registers, sensors, memories, etc. The SPI runs at a baud rate up to the bus clock divided by two in master mode and up to the bus clock divided by four in slave mode.
Chapter 15 16-Bit Serial Peripheral Interface (S08SPI16V1) USBDP USBDN HCS08 CORE PORT A ON-CHIP ICE AND DEBUG MODULE (DBG) USB SIE RESET IRQ/TPMCLK CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT COP IRQ 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS VDDAD IIC MODULE (IIC) SDA SCL 6 ACMPO VDD VSS VUSB33 LOW-POWER OSCILLATOR SYSTEM VOLTAGE REGULATOR PTE5/MOSI1 SERIAL COMMUNICATIONS INTERFACE MODULE (SCI1) 2-CHANNEL TIMER/PWM
Serial Peripheral Interface (S08SPI16V1) Module Initialization (Slave): Write: SPIxC1 to configure interrupts, set primary SPI options, slave mode select, and system enable. Write: SPIxC2 to configure optional SPI features, hardware match interrupt enable, and 8- or 16-bit data transmission length Write: SPIxMH:SPIxML to set hardware compare value that triggers SPMF (optional) when value in receive data buffer equals this value.
Serial Peripheral Interface (S08SPI16V1) 15.1.
Serial Peripheral Interface (S08SPI16V1) 15.1.4.1 SPI System Block Diagram Figure 15-3 shows the SPI modules of two MCUs connected in a master-slave arrangement. The master device initiates all SPI data transfers. During a transfer, the master shifts data out (on the MOSI pin) to the slave while simultaneously shifting data in (on the MISO pin) from the slave. The transfer effectively exchanges the data that was in the SPI shift registers of the two SPI systems.
Serial Peripheral Interface (S08SPI16V1) PIN CONTROL M SPE MOSI (MOMI) S Tx BUFFER (WRITE SPIxDH:SPIxDL) ENABLE SPI SYSTEM M SHIFT OUT SPIMODE 8 OR 16 BIT MODE SHIFT IN SPI SHIFT REGISTER MISO (SISO) S SPC0 Rx BUFFER (READ SPIxDH:SPIxDL) BIDIROE LSBFE SHIFT DIRECTION SHIFT CLOCK Rx BUFFER FULL Tx BUFFER EMPTY MASTER CLOCK BUS RATE CLOCK SPIBR CLOCK GENERATOR MSTR CLOCK LOGIC SLAVE CLOCK MASTER/SLAVE M SPSCK S MASTER/ SLAVE MODE SELECT MODFEN SSOE MODE FAULT DETECTION 16-BIT COMPA
Serial Peripheral Interface (S08SPI16V1) 15.2.2 MOSI — Master Data Out, Slave Data In When the SPI is enabled as a master and SPI pin control zero (SPC0) is 0 (not bidirectional mode), this pin is the serial data output. When the SPI is enabled as a slave and SPC0 = 0, this pin is the serial data input. If SPC0 = 1 to select single-wire bidirectional mode, and master mode is selected, this pin becomes the bidirectional data I/O pin (MOMI).
Serial Peripheral Interface (S08SPI16V1) Table 15-1. SPIxC1 Field Descriptions Field Description 7 SPIE SPI Interrupt Enable (for SPRF and MODF) — This is the interrupt enable for SPI receive buffer full (SPRF) and mode fault (MODF) events. 0 Interrupts from SPRF and MODF inhibited (use polling) 1 When SPRF or MODF is 1, request a hardware interrupt 6 SPE SPI System Enable — This bit enables the SPI system and dedicates the SPI port pins to SPI system functions.
Serial Peripheral Interface (S08SPI16V1) 7 6 5 SPMIE SPIMODE 0 0 R 4 3 MODFEN BIDIROE 0 0 0 2 1 0 SPISWAI SPC0 0 0 0 W Reset 0 0 = Unimplemented or Reserved Figure 15-6. SPI Control Register 2 (SPIxC2) Table 15-3. SPIxC2 Register Field Descriptions Field 7 SPMIE Description SPI Match Interrupt Enable — This is the interrupt enable for the SPI receive data buffer hardware match (SPMF) function. 0 Interrupts from SPMF inhibited (use polling).
Serial Peripheral Interface (S08SPI16V1) Table 15-4. Bidirectional Pin Configurations Pin Mode SPC0 BIDIROE MISO MOSI Master Mode of Operation Normal 0 X Master In Master Out Bidirectional 1 0 MISO not used by SPI Master In 1 Master I/O Slave Mode of Operation 15.3.3 Normal 0 X Slave Out Slave In Bidirectional 1 0 Slave In MOSI not used by SPI 1 Slave I/O SPI Baud Rate Register (SPIxBR) This register is used to set the prescaler and bit rate divisor for an SPI master.
Serial Peripheral Interface (S08SPI16V1) Table 15-6. SPI Baud Rate Prescaler Divisor SPPR2:SPPR1:SPPR0 Prescaler Divisor 0:0:0 1 0:0:1 2 0:1:0 3 0:1:1 4 1:0:0 5 1:0:1 6 1:1:0 7 1:1:1 8 Table 15-7. SPI Baud Rate Divisor 15.3.4 SPR2:SPR1:SPR0 Rate Divisor 0:0:0 2 0:0:1 4 0:1:0 8 0:1:1 16 1:0:0 32 1:0:1 64 1:1:0 128 1:1:1 256 SPI Status Register (SPIxS) This register has four read-only status bits. Bits 3 through 0 are not implemented and always read 0.
Serial Peripheral Interface (S08SPI16V1) Table 15-8. SPIxS Register Field Descriptions Field Description 7 SPRF SPI Read Buffer Full Flag — SPRF is set at the completion of an SPI transfer to indicate that received data may be read from the SPI data register (SPIxDH:SPIxDL). SPRF is cleared by reading SPRF while it is set, then reading the SPI data register. 0 No data available in the receive data buffer. 1 Data available in the receive data buffer.
Serial Peripheral Interface (S08SPI16V1) When the SPI is configured as a master, data queued in the transmit data buffer is transmitted immediately after the previous transmission has completed. The SPI transmit buffer empty flag (SPTEF) in the SPIxS register indicates when the transmit data buffer is ready to accept new data. SPIxS must be read when SPTEF is set before writing to the SPI data registers, or the write will be ignored.
Serial Peripheral Interface (S08SPI16V1) 15.4 15.4.1 Functional Description General The SPI system is enabled by setting the SPI enable (SPE) bit in SPI Control Register 1.
Serial Peripheral Interface (S08SPI16V1) and SPSCK lines. In this case, the SPI immediately switches to slave mode, by clearing the MSTR bit and also disables the slave output buffer MISO (or SISO in bidirectional mode). So the result is that all outputs are disabled and SPSCK, MOSI and MISO are inputs. If a transmission is in progress when the mode fault occurs, the transmission is aborted and the SPI is forced into idle state.
Serial Peripheral Interface (S08SPI16V1) NOTE When peripherals with duplex capability are used, take care not to simultaneously enable two receivers whose serial outputs drive the same system slave’s serial data output line. As long as no more than one slave device drives the system slave’s serial data output line, it is possible for several slaves to receive the same transmission from a master, although the master would not receive return information from all of the receiving slaves.
Serial Peripheral Interface (S08SPI16V1) Any switching between 8- and 16-bit data transmission length (controlled by SPIMODE bit) in master mode will abort a transmission in progress, force the SPI system into idle state, and reset all status bits in the SPIxS register. To initiate a transfer after writing to SPIMODE, the SPIxS register must be read with SPTEF = 1, and data must be written to SPIxDH:SPIxDL in 16-bit mode (SPIMODE = 1) or SPIxDL in 8-bit mode (SPIMODE = 0).
Serial Peripheral Interface (S08SPI16V1) BIT TIME # (REFERENCE) 1 2 ... 6 7 8 BIT 7 BIT 0 BIT 6 BIT 1 ... ... BIT 2 BIT 5 BIT 1 BIT 6 BIT 0 BIT 7 SPSCK (CPOL = 0) SPSCK (CPOL = 1) SAMPLE IN (MISO OR MOSI) MOSI (MASTER OUT) MSB FIRST LSB FIRST MISO (SLAVE OUT) SS OUT (MASTER) SS IN (SLAVE) Figure 15-13. SPI Clock Formats (CPHA = 1) When CPHA = 1, the slave begins to drive its MISO output when SS goes to active low, but the data is not defined until the first SPSCK edge.
Serial Peripheral Interface (S08SPI16V1) SPSCK cycle after the end of the eighth bit time of the transfer. The SS IN waveform applies to the slave select input of a slave. BIT TIME # (REFERENCE) 1 2 BIT 7 BIT 0 BIT 6 BIT 1 ... 6 7 8 BIT 2 BIT 5 BIT 1 BIT 6 BIT 0 BIT 7 SPSCK (CPOL = 0) SPSCK (CPOL = 1) SAMPLE IN (MISO OR MOSI) MOSI (MASTER OUT) MSB FIRST LSB FIRST ... ... MISO (SLAVE OUT) SS OUT (MASTER) SS IN (SLAVE) Figure 15-14.
Serial Peripheral Interface (S08SPI16V1) The baud rate divisor equation is as follows: BaudRateDivisor = ( SPPR + 1 ) • 2 ( SPR + 1 ) The baud rate can be calculated with the following equation: Baud Rate = BusClock ⁄ BaudRateDivisor BUS CLOCK PRESCALER BAUD RATE DIVIDER DIVIDE BY 1, 2, 3, 4, 5, 6, 7, or 8 DIVIDE BY 2, 4, 8, 16, 32, 64, 128, or 256 SPPR2:SPPR1:SPPR0 SPR2:SPR1:SPR0 MASTER SPI BIT RATE Figure 15-15. SPI Baud Rate Generation 15.4.7 15.4.7.
Serial Peripheral Interface (S08SPI16V1) Table 15-9. Normal Mode and Bidirectional Mode When SPE = 1 Master Mode MSTR = 1 Serial Out Normal Mode SPC0 = 0 SPI SPI Serial Out MISO Serial Out SPI MOSI Serial In MOSI Serial In Bidirectional Mode SPC0 = 1 Slave Mode MSTR = 0 MOMI MISO Serial In BIDIROE SPI BIDIROE Serial In Serial Out SISO . The direction of each serial I/O pin depends on the BIDIROE bit.
Serial Peripheral Interface (S08SPI16V1) In the special case where the SPI is in master mode and MODFEN bit is cleared, the SS pin is not used by the SPI. In this special case, the mode fault error function is inhibited and MODF remains cleared. In case the SPI system is configured as a slave, the SS pin is a dedicated input pin. Mode fault error doesn’t occur in slave mode. If a mode fault error occurs the SPI is switched to slave mode, with the exception that the slave output buffer is disabled.
Serial Peripheral Interface (S08SPI16V1) NOTE Care must be taken when expecting data from a master while the slave is in wait or stop3 mode. Even though the shift register will continue to operate, the rest of the SPI is shut down (i.e. a SPRF interrupt will not be generated until exiting stop or wait mode). Also, the data from the shift register will not be copied into the SPIxDH:SPIxDL registers until after the slave SPI has exited wait or stop mode.
Serial Peripheral Interface (S08SPI16V1) flag bits to determine what event caused the interrupt. The service routine must also clear the flag bit(s) before returning from the ISR (usually near the beginning of the ISR). 15.4.10.1 MODF MODF occurs when the master detects an error on the SS pin. The master SPI must be configured for the MODF feature (see Table 15-2). Once MODF is set, the current transfer is aborted and the following bit is changed: • MSTR=0, The master bit in SPIxC1 resets.
Serial Peripheral Interface (S08SPI16V1) 15.5 Initialization/Application Information 15.5.1 SPI Module Initialization Example 15.5.1.1 Initialization Sequence Before the SPI module can be used for communication, an initialization procedure must be carried out, as follows: 1. Update control register 1 (SPIxC1) to enable the SPI and to control interrupt enables. This register also sets the SPI as master or slave, determines clock phase and polarity, and configures the main SPI options. 2.
Serial Peripheral Interface (S08SPI16V1) SPIxC2 = 0xC0(%11000000) Bit 7 SPMIE = 1 SPI hardware match interrupt enabled Bit 6 SPIMODE = 1 Configures SPI for 16-bit mode = 0 Unimplemented = 0 Disables mode fault function Bit 5 Bit 4 MODFEN Bit 3 BIDIROE Bit 2 = 0 SPI data I/O pin acts as input = 0 Unimplemented Bit 1 SPISWAI = 0 SPI clocks operate in wait mode Bit 0 SPC0 = 0 uses separate pins for data input and output SPIxBR = 0x00(%00000000) Bit 7 = 0 Unimplemented Bit 6:4
Serial Peripheral Interface (S08SPI16V1) RESET INITIALIZE SPI SPIxC1 = 0x54 SPIxC2 = 0xC0 SPIxBR = 0x00 SPIxMH = 0xXX YES SPTEF = 1 ? NO YES WRITE TO SPIxDH:SPIxDL SPRF = 1 ? NO YES READ SPIxDH:SPIxDL SPMF = 1 ? NO YES READ SPMF WHILE SET TO CLEAR FLAG, THEN WRITE A 1 TO IT CONTINUE Figure 15-16. Initialization Flowchart Example for SPI Master Device in 16-bit Mode MC9S08JM16 Series Data Sheet, Rev.
Serial Peripheral Interface (S08SPI16V1) MC9S08JM16 Series Data Sheet, Rev.
Chapter 16 Timer/Pulse-Width Modulator (S08TPMV2) 16.1 Introduction The MC9S08JM16 series includes two independent timer/PWM (TPM) modules (up to 6 channels) that support traditional input capture, output compare, or buffered edge-aligned pulse-width modulation (PWM) on each channel. A control bit in each TPM configures all channels in that timer to operate as center-aligned PWM functions.
Chapter 16 Timer/Pulse-Width Modulator (S08TPMV2) pullup CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT COP IRQ 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS VDDAD USER Flash (IN BYTES) MC9S08JM60 = 60,912 MC9S08JM32 = 32,768 RxD2 TxD2 IIC MODULE (IIC) SDA SCL 12-CHANNEL, 12-BIT ANALOG-TO-DIGITAL CONVERTER (ADC) VSSAD VREFL VREFH SS2 SPSCK2 MOSI2 MISO2 INTERFACE MODULE (SCI2) LVD PORT B BDC FULL SPEED USB USB ENDPOINT TRANSCEI
16.1.
• • Edge-aligned PWM mode The value of a 16-bit modulo register plus 1 sets the period of the PWM output signal. The channel value register sets the duty cycle of the PWM output signal. The user may also choose the polarity of the PWM output signal. Interrupts are available at the end of the period and at the duty-cycle transition point.
BUS CLOCK FIXED SYSTEM CLOCK SYNC EXTERNAL CLOCK CLOCK SOURCE SELECT OFF, BUS, FIXED SYSTEM CLOCK, EXT PRESCALE AND SELECT ³1, 2, 4, 8, 16, 32, 64, or ³128 CLKSB:CLKSA PS2:PS1:PS0 CPWMS 16-BIT COUNTER TOF COUNTER RESET TOIE INTERRUPT LOGIC 16-BIT COMPARATOR TPMxMODH:TPMxMODL CHANNEL 0 ELS0B ELS0A PORT LOGIC TPMxCH0 16-BIT COMPARATOR CH0F TPMxC0VH:TPMxC0VL INTERNAL BUS 16-BIT LATCH CHANNEL 1 MS0B MS0A ELS1B ELS1A CH0IE INTERRUPT LOGIC PORT LOGIC TPMxCH1 16-BIT COMPARATOR CH1F T
The TPM channels are programmable independently as input capture, output compare, or edge-aligned PWM channels. Alternately, the TPM can be configured to produce CPWM outputs on all channels. When the TPM is configured for CPWMs, the counter operates as an up/down counter; input capture, output compare, and EPWM functions are not practical. If a channel is configured as input capture, an internal pullup device may be enabled for that channel.
16.2.1.1 EXTCLK — External Clock Source Control bits in the timer status and control register allow the user to select nothing (timer disable), the bus-rate clock (the normal default source), a crystal-related clock, or an external clock as the clock which drives the TPM prescaler and subsequently the 16-bit TPM counter. The external clock source is synchronized in the TPM.
When a channel is configured for edge-aligned PWM (CPWMS=0, MSnB=1 and ELSnB:ELSnA not = 0:0), the data direction is overridden, the TPMxCHn pin is forced to be an output controlled by the TPM, and ELSnA controls the polarity of the PWM output signal on the pin. When ELSnB:ELSnA=1:0, the TPMxCHn pin is forced high at the start of each new period (TPMxCNT=0x0000), and the pin is forced low when the channel value register matches the timer counter.
When the TPM is configured for center-aligned PWM (and ELSnB:ELSnA not = 0:0), the data direction for all channels in this TPM are overridden, the TPMxCHn pins are forced to be outputs controlled by the TPM, and the ELSnA bits control the polarity of each TPMxCHn output.
16.3 Register Definition This section consists of register descriptions in address order. A typical MCU system may contain multiple TPMs, and each TPM may have one to eight channels, so register names include placeholder characters to identify which TPM and which channel is being referenced. For example, TPMxCnSC refers to timer (TPM) x, channel n. TPM1C2SC would be the status and control register for channel 2 of timer 1. 16.3.
Table 16-2. TPMxSC Field Descriptions (continued) Field Description 4–3 Clock source selects. As shown in Table 16-3, this 2-bit field is used to disable the TPM system or select one of CLKS[B:A] three clock sources to drive the counter prescaler. The fixed system clock source is only meaningful in systems with a PLL-based or FLL-based system clock. When there is no PLL or FLL, the fixed-system clock source is the same as the bus rate clock.
Reset clears the TPM counter registers. Writing any value to TPMxCNTH or TPMxCNTL also clears the TPM counter (TPMxCNTH:TPMxCNTL) and resets the coherency mechanism, regardless of the data involved in the write. R 7 6 5 4 3 2 1 0 Bit 15 14 13 12 11 10 9 Bit 8 0 0 W Reset Any write to TPMxCNTH clears the 16-bit counter 0 0 0 0 0 0 Figure 16-8.
When BDM is active, the coherency mechanism is frozen (unless reset by writing to TPMxSC register) such that the buffer latches remain in the state they were in when the BDM became active, even if one or both halves of the modulo register are written while BDM is active. Any write to the modulo registers bypasses the buffer latches and directly writes to the modulo register while BDM is active. 7 6 5 4 3 2 1 0 Bit 15 14 13 12 11 10 9 Bit 8 0 0 0 0 0 0 0 0 R W Reset Figure 16-10.
Table 16-5. TPMxCnSC Field Descriptions Field Description 7 CHnF Channel n flag. When channel n is an input-capture channel, this read/write bit is set when an active edge occurs on the channel n pin. When channel n is an output compare or edge-aligned/center-aligned PWM channel, CHnF is set when the value in the TPM counter registers matches the value in the TPM channel n value registers.
Table 16-6. Mode, Edge, and Level Selection CPWMS MSnB:MSnA ELSnB:ELSnA Mode Configuration 0 00 01 Input capture Capture on rising edge only 01 10 Capture on falling edge only 11 Capture on rising or falling edge 01 1X Output compare 10 Clear output on compare 11 Set output on compare 10 Edge-aligned PWM X1 1 XX High-true pulses (clear output on compare) Low-true pulses (set output on compare) 10 Center-aligned PWM X1 16.3.
(becomes unlatched) when the TPMxCnSC register is written (whether BDM mode is active or not). Any write to the channel registers will be ignored during the input capture mode. When BDM is active, the coherency mechanism is frozen (unless reset by writing to TPMxCnSC register) such that the buffer latches remain in the state they were in when the BDM became active, even if one or both halves of the channel register are read while BDM is active.
The following sections describe the main counter and each of the timer operating modes (input capture, output compare, edge-aligned PWM, and center-aligned PWM). Because details of pin operation and interrupt activity depend upon the operating mode, these topics will be covered in the associated mode explanation sections. 16.4.1 Counter All timer functions are based on the main 16-bit counter (TPMxCNTH:TPMxCNTL). This section discusses selection of the clock source, end-of-count overflow, up-counting vs.
Table 16-7. TPM Clock Source Selection CLKSB:CLKSA TPM Clock Source to Prescaler Input 00 No clock selected (TPM counter disabled) 01 Bus rate clock 10 Fixed system clock 11 External source The bus rate clock is the main system bus clock for the MCU. This clock source requires no synchronization because it is the clock that is used for all internal MCU activities including operation of the CPU and buses.
16.4.1.3 Counting Modes The main timer counter has two counting modes. When center-aligned PWM is selected (CPWMS=1), the counter operates in up/down counting mode. Otherwise, the counter operates as a simple up counter. As an up counter, the timer counter counts from 0x0000 through its terminal count and then continues with 0x0000. The terminal count is 0xFFFF or a modulus value in TPMxMODH:TPMxMODL.
In output compare mode, values are transferred to the corresponding timer channel registers only after both 8-bit halves of a 16-bit register have been written and according to the value of CLKSB:CLKSA bits, so: • If (CLKSB:CLKSA = 0:0), the registers are updated when the second byte is written • If (CLKSB:CLKSA not = 0:0), the registers are updated at the next change of the TPM counter (end of the prescaler counting) after the second byte is written.
the TPM counter is a free-running counter then the update is made when the TPM counter changes from 0xFFFE to 0xFFFF. 16.4.2.4 Center-Aligned PWM Mode This type of PWM output uses the up/down counting mode of the timer counter (CPWMS=1). The output compare value in TPMxCnVH:TPMxCnVL determines the pulse width (duty cycle) of the PWM signal while the period is determined by the value in TPMxMODH:TPMxMODL.
Input capture, output compare, and edge-aligned PWM functions do not make sense when the counter is operating in up/down counting mode so this implies that all active channels within a TPM must be used in CPWM mode when CPWMS=1. The TPM may be used in an 8-bit MCU. The settings in the timer channel registers are buffered to ensure coherent 16-bit updates and to avoid unexpected PWM pulse widths. Writes to any of the registers TPMxMODH, TPMxMODL, TPMxCnVH, and TPMxCnVL, actually write to buffer registers.
All TPM interrupts are listed in Table 16-8 which shows the interrupt name, the name of any local enable that can block the interrupt request from leaving the TPM and getting recognized by the separate interrupt processing logic. Table 16-8.
16.6.2.1.2 Center-Aligned PWM Case When CPWMS=1, TOF gets set when the timer counter changes direction from up-counting to down-counting at the end of the terminal count (the value in the modulo register). In this case the TOF corresponds to the end of a PWM period. 16.6.2.2 Channel Event Interrupt Description The meaning of channel interrupts depends on the channel’s current mode (input-capture, output-compare, edge-aligned PWM, or center-aligned PWM). 16.6.2.2.
— This read coherency mechanism is cleared in TPM v3 in BDM mode if there is a write to TPMxSC, TPMxCNTH or TPMxCNTL. Instead, in these conditions the TPM v2 does not clear this read coherency mechanism. 3. Read of TPMxCnVH:L registers (Section 16.3.5, “TPM Channel Value Registers (TPMxCnVH:TPMxCnVL)) — In TPM v3, any read of TPMxCnVH:L registers during BDM mode returns the value of the TPMxCnVH:L register.
In this case, the TPM v3 produces almost 100% duty cycle. Instead, the TPM v2 produces 0% duty cycle. — TPMxCnVH:L is changed from 0x0000 to a non-zero value [SE110-TPM case 3 and 5] In this case, the TPM v3 waits for the start of a new PWM period to begin using the new duty cycle setting. Instead, the TPM v2 changes the channel output at the middle of the current PWM period (when the count reaches 0x0000).
MC9S08JM16 Series Data Sheet, Rev.
MC9S08JM16 Series Data Sheet, Rev.
Chapter 17 Universal Serial Bus Device Controller (S08USBV1) 17.1 Introduction This chapter describes an universal serial bus device controller (S08USBV1) module that is based on the Universal Serial Bus Specification Rev 2.0. The USB bus is designed to replace existing bus interfaces such as RS-232, PS/2, and IEEE 1284 for PC peripherals.
Chapter 17 Universal Serial Bus Device Controller (S08USBV1) Table 17-1. USBVREN Configuration USBVREN VDD Supply Voltage Range 3.3 V Regulator 0 External 3.3 V Regulator (as input to VUSB33 pin) VUSB33 ≤ VDD Supply Voltage 1 Internal 3.3 V Regulator (no external supply connected to VUSB33 pin) 3.9 V ≤ VDD Supply Voltage ≤ 5.5 V MC9S08JM16 Series Data Sheet, Rev.
Chapter 17 Universal Serial Bus Device Controller (S08USBV1) IRQ/TPMCLK USB SIE CPU HCS08 SYSTEM CONTROL RESETS AND INTERRUPTS MODES OF OPERATION POWER MANAGEMENT COP IRQ 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI2) SERIAL COMMUNICATIONS VDDAD IIC MODULE (IIC) SDA SCL 6 8-/16-BIT SERIAL PERIPHERAL INTERFACE MODULE (SPI16) ACMP+ ACMPO PTE6/SPSCK1 MOSI1 PTE5/MOSI1 VSS VUSB33 SYSTEM VOLTAGE REGULATOR SERIAL COMMUNICATIONS INTERFACE MODULE (SCI1) 2-CHANNEL TIMER/PWM MODULE (TPM2) R
Universal Serial Bus Device Controller (S08USBV1) 17.1.4 Features Features of the USB module include: • USB 2.
Universal Serial Bus Device Controller (S08USBV1) Table 17-2. Operating Modes (continued) Mode Description Stop3 The USB module is optionally available in stop3. A reduced current consumption mode may be required for USB suspend mode per USB Specification Rev. 2.0, and stop3 mode is useful for achieving lower current consumption for the MCU and hence the overall USB device.
Universal Serial Bus Device Controller (S08USBV1) 17.2 External Signal Description The USB module requires both data and power pins. Table 17-3 describes each of the USB external pin Table 17-3. USB External Pins Name Port Direction Positive USB differential signal USBDP I/O Differential USB signaling. High impedance Negative USB differential signal USBDN I/O Differential USB signaling. High impedance USB voltage regulator power pin VUSB33 Power 17.2.1 Function Reset State 3.
Universal Serial Bus Device Controller (S08USBV1) 17.3.1 USB Control Register 0 (USBCTL0) 7 R 6 5 USBPU USBRESMEN 0 0 0 4 3 LPRESF 0 2 1 0 0 USBVREN USBPHYEN W USBRESET Reset 0 0 0 0 0 0 = Unimplemented or Reserved Figure 17-3. USB Transceiver and Regulator Control Register 0 (USBCTL0) Table 17-4. USBCTL0 Field Descriptions Field Description 7 USBRESET USB Reset — This bit generates a hard reset of the USB module, USBPHYEN and USBVREGEN bits will also be cleared.
Universal Serial Bus Device Controller (S08USBV1) R 7 6 5 4 3 2 1 0 0 0 ID5 ID4 ID3 ID2 ID1 ID0 0 0 0 0 0 1 0 0 W Reset = Unimplemented or Reserved Figure 17-4. Peripheral ID Register (PERID) Table 17-5. PERID Field Descriptions Field 5:0 ID[5:0] 17.3.3 Description Peripheral Configuration Number —This number is set to 0x04 and indicates that the peripheral is the full-speed USB module.
Universal Serial Bus Device Controller (S08USBV1) Table 17-7. REV Field Descriptions Field 8–0 REV[7:0] 17.3.5 Description Revision — Revision number of the USB module. Interrupt Status Register (INTSTAT) The INTSTAT contains bits for each of the interrupt source within the USB module. Each of these bits is qualified with its respective interrupt enable bits (see the interrupt enable register).
Universal Serial Bus Device Controller (S08USBV1) Table 17-9. INTSTAT Field Descriptions (continued) Field Description 1 ERRORF Error Flag — This bit is set when any of the error conditions within the ERRSTAT register has occurred. The firmware must then read the ERRSTAT register to determine the source of the error.
Universal Serial Bus Device Controller (S08USBV1) Table 17-10. INTENB Field Descriptions (continued) Field Description 1 ERROR ERROR Interrupt Enable — Setting this bit will enable ERROR interrupts. 0 Interrupt disabled 1 Interrupt enabled 0 USBRST USBRST Interrupt Enable — Setting this bit will enable USBRST interrupts. 0 Interrupt disabled 1 Interrupt enabled 17.3.7 Error Interrupt Status Register (ERRSTAT) The ERRSTAT contains bits for each of the error sources within the USB module.
Universal Serial Bus Device Controller (S08USBV1) Table 17-11. ERRSTAT Field Descriptions (continued) Field Description 3 DFN8F Data Field Error Flag — The data field received was not an interval of 8 bits. The USB Specification specifies that the data field must be an integer number of bytes. If the data field was not an integer number of bytes, this bit will be set.
Universal Serial Bus Device Controller (S08USBV1) Table 17-12. ERRSTAT Field Descriptions (continued) Field 1 CRC5 0 PIDERR 17.3.9 Description CRC5 Interrupt Enable — Setting this bit will enable CRC5 interrupts. 0 Interrupt disabled 1 Interrupt enabled PIDERR Interrupt Enable — Setting this bit will enable PIDERR interrupts. 0 Interrupt disabled 1 Interrupt enabled Status Register (STAT) The STAT reports the transaction status within the USB module.
Universal Serial Bus Device Controller (S08USBV1) Table 17-13. STAT Field Descriptions (continued) Field 3 IN 2 ODD Description In/Out Transaction — This bit indicates whether the last BDT updated was for a transmit (IN) transfer or a receive (OUT) data transfer.
Universal Serial Bus Device Controller (S08USBV1) 17.3.11 Address Register (ADDR) The ADDR register contains the unique 7-bit address the device will be recognized as through USB. The register is reset to 0x00 after the reset input has gone active or the USB module has decoded USB reset signaling. That will initialize the address register to decode address 0x00 as required by the USB specification. Firmware will change the value when it processes a SET_ADDRESS request.
Universal Serial Bus Device Controller (S08USBV1) R 7 6 5 4 3 2 1 0 0 0 0 0 0 FRM10 FRM9 FRM8 0 0 0 0 0 0 0 0 W Reset = Unimplemented or Reserved Figure 17-16. Frame Number Register High (FRMNUMH) Table 17-17. FRMNUMH Field Descriptions Field 2–0 FRM[10:8] Description Frame Number — These bits represent the high order bits of the 11-bit frame number. 17.3.
Universal Serial Bus Device Controller (S08USBV1) Table 17-18. EPCTLn Field Descriptions (continued) Field Description 1 EPSTALL Endpoint Stall — When set, this bit indicates that the endpoint is stalled. This bit has priority over all other control bits in the endpoint control register, but is only valid if EPTXEN=1 or EPRXEN=1. Any access to this endpoint will cause the USB module to return a STALL handshake. Once an endpoint is stalled it requires intervention from the host controller.
Universal Serial Bus Device Controller (S08USBV1) internal basic virtual component interface (BVCI) compliant target and initiator buses. The BVCI target interface is used to configure the USB SIE and to provide status and interrupts to CPU. The BVCI initiator interface provides the integrated DMA controller access to the buffer descriptor table (BDT), and transfers USB data to or from USB RAM memory. 17.4.1.1.
Universal Serial Bus Device Controller (S08USBV1) • Bit stuffing violation If a properly formatted packet is received, the receiver logic initiates a handshake response to the host. If the packet is not decoded correctly due to bit stuff violation, CRC error or other packet level problem, the receiver ignores it. The USB host will eventually time-out waiting for a response, and retransmit the packet.
Universal Serial Bus Device Controller (S08USBV1) 17.4.1.5 USB On-Chip Voltage Regulator (VREG) The on-chip 3.3 V regulator provides a stable power source to power the USB internal transceiver and provide for the termination of an internal or external pullup resistor. When the on-chip regulator is enabled, it requires a voltage supply input in the range from 3.9 V to 5.5 V, and the voltage regulator output will be in the range of 3.0 V to 3.6 V. With a dedicated on-chip USB 3.
Universal Serial Bus Device Controller (S08USBV1) USB DEVICE 3.3 V VUSB33 RDPPU USBDP USBDN Figure 17-18. USBDP/USBDN Pullup Resistor Configuration for USB module 17.4.1.7 USB Powering and USBDP Pullup Enable Options The USB module provides a single-chip solution for USB device applications that are self-powered or bus-powered. The USB device needs to know when it has a valid USB connection in order to enable or disable the pullup resistor on the USBDP line.
Universal Serial Bus Device Controller (S08USBV1) 17.4.2 Buffer Descriptor Table (BDT) To efficiently manage USB endpoint communications, the USB module implements a buffer descriptor table (BDT) comprised of buffer descriptors (BD) in the local USB RAM. The BD entries provide status or control information for a corresponding endpoint. The BD entries also provide an address to the endpoint’s buffer. A single BD for an endpoint direction requires 3-bytes.
Universal Serial Bus Device Controller (S08USBV1) Table 17-21. USB RAM Organization USB RAM Offset USB RAM Description of Contents 0x00 Endpoint 0 IN Endpoint 0, OUT Endpoint 1 Endpoint 2 BDT Endpoint 3 Endpoint 4 Endpoint 5, Buffer EVEN Endpoint 5, Buffer ODD Endpoint 6, Buffer EVEN 0x1D Endpoint 6, Buffer ODD 0x1E RESERVED 0x1F RESERVED 0x20 USB RAM available for endpoint buffers 0xFF When the USB module receives a USB token on an enabled endpoint, it interrogates the BDT.
Universal Serial Bus Device Controller (S08USBV1) • • How much data was transmitted or received. Where the buffer resides in buffer memory The BDT is composed of buffer descriptors (BD) which are used to define and control the actual buffers in the USB RAM space. BDs always occur as a 3-bytes block. See Figure 17-19 for the BD example of Endpoint 0 IN start from USB RAM offset 0x00. The format for the buffer descriptor is shown in Table 17-22.
Universal Serial Bus Device Controller (S08USBV1) Table 17-22. Buffer Descriptor Table Fields (continued) Field BC[7:0] EPADR[9:4] 17.4.3 Description Byte Count — The Byte Count bits represent the 8-bit byte count. The USB module serial interface engine (SIE) will change this field upon the completion of a RX transfer with the byte count of the data received. Note that while USB supports packets as large as 1023 bytes for isochronous endpoints, this module limits packet size to 64 bytes.
Universal Serial Bus Device Controller (S08USBV1) = USB Host USB RST = Function SOF USBRST Interrupt Generated SETUP TOKEN SOF Interrupt Generated DATA ACK TOKDNE Interrupt Generated IN TOKEN DATA ACK TOKDNE Interrupt Generated OUT TOKEN DATA ACK TOKDNE Interrupt Generated Figure 17-20. USB Packet Flow The USB has two sources of data overrun error: • The memory latency to the local USB RAM interface may be too high and cause the receive buffer to overflow.
Universal Serial Bus Device Controller (S08USBV1) appropriate course of action for future transactions — stalling the endpoint, canceling the transfer, disabling the endpoint, etc. 17.4.4 USB Packet Processing Packet processing for a USB device consists of managing buffers for IN (to the USB Host) and OUT (to the USB device) transactions. Packet processing is further divided into request processing on Endpoint 0, and data packet processing on the data endpoints. 17.4.4.
Universal Serial Bus Device Controller (S08USBV1) 2. Create BDT entries for Endpoint 0 OUT, and set the DTS and OWN bits to 1. 3. Wait for interrupt TOKDNE. 4. Read STAT register. — The status register must show Endpoint 0, RX. If it does not, then assert the EPSTALL bit in the endpoint control register. 5. Read Endpoint 0 OUT BD. — Verify that the token type is a SETUP token. If it is not, then assert the EPSTALL bit in the endpoint control register. 6. Decode and process the setup packet.
Universal Serial Bus Device Controller (S08USBV1) 17.4.6 Suspend/Resume The USB supports a single low-power mode called suspend. Getting into and out of the suspend state is described in the following sections. 17.4.6.1 Suspend The USB host can put a single device or the entire bus into the suspend state at any time. The MCU supports suspend mode for low power. Suspend mode will be entered when the USB data lines are in the idle state for more than 3 ms.
Universal Serial Bus Device Controller (S08USBV1) indicating a resume from low-power suspend. This will trigger an asynchronous interrupt to wake the CPU from stop3 mode and resume clocks to the USB module. NOTE As a precaution, after LPRESF is set, firmware must check the state of the USB bus to see if the K-state was a result of a transient event and not a true host-initiated resume. If this is the case, then the device can drop back into stop3 if necessary.
Universal Serial Bus Device Controller (S08USBV1) • • • • USB transceiver disabled USBDP pullup disabled Endpoints disabled USB address register set to zero 17.4.8 Interrupts Interrupts from the INTSTAT register signify events which occur during normal operation — USB start of frame tokens (TOKSOF), packet completion (TOKDNE), USB bus reset (USBRST), endpoint errors (ERROR), suspend and resume (SLEEP and RESUME), and endpoint stalled (STALL).
Universal Serial Bus Device Controller (S08USBV1) MC9S08JM16 Series Data Sheet, Rev.
Chapter 18 Development Support 18.1 Introduction This chapter describes the single-wire background debug mode (BDM), which uses the on-chip background debug controller (BDC) module, and the independent on-chip real-time in-circuit emulation (ICE) system, which uses the on-chip debug (DBG) module. 18.1.1 Forcing Active Background The method for forcing active background mode depends on the specific HCS08 derivative.
Development Support 18.1.
Development Support • 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. Typically, a relatively simple interface pod is used to translate commands from a host computer into commands for the custom serial interface to the single-wire background debug system.
Development Support When no debugger pod is connected to the 6-pin BDM interface connector, the internal pullup on BKGD chooses normal operating mode. When a debug pod is connected to BKGD it is possible to force the MCU into active background mode after reset. The specific conditions for forcing active background depend upon the HCS08 derivative (refer to the introduction to this Development Support section).
Development Support Figure 18-2 shows an external host transmitting a logic 1 or 0 to the BKGD pin of a target HCS08 MCU. The host is asynchronous to the target so there is a 0-to-1 cycle delay from the host-generated falling edge to where the target perceives the beginning of the bit time. 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 host-to-target transmissions to speed up rising edges.
Development Support Figure 18-3 shows the host receiving a logic 1 from the target HCS08 MCU. Because the host is asynchronous to the target MCU, there is a 0-to-1 cycle delay from the host-generated falling edge on BKGD to the perceived start of the bit time in the target MCU. The host holds the BKGD pin low long enough for the target to recognize it (at least two target BDC cycles).
Development Support Figure 18-4 shows the host receiving a logic 0 from the target HCS08 MCU. Because the host is asynchronous to the target MCU, there is a 0-to-1 cycle delay from the host-generated falling edge on BKGD to the start of the bit time as perceived by the target MCU. The host initiates the bit time but the target HCS08 finishes it.
Development Support 18.2.3 BDC Commands BDC commands are sent serially from a host computer to the BKGD pin of the target HCS08 MCU. All commands and data are sent MSB-first using a custom BDC communications protocol. Active background mode commands require that the target MCU is currently in the active background mode while non-intrusive commands may be issued at any time whether the target MCU is in active background mode or running a user application program.
Development Support Table 18-1. BDC Command Summary Command Mnemonic 1 Active BDM/ Non-intrusive Coding Structure Description SYNC Non-intrusive n/a1 Request a timed reference pulse to determine target BDC communication speed ACK_ENABLE Non-intrusive D5/d Enable acknowledge protocol. Refer to Freescale document order no. HCS08RMv1/D. ACK_DISABLE Non-intrusive D6/d Disable acknowledge protocol. Refer to Freescale document order no. HCS08RMv1/D.
Development Support The SYNC command is unlike other BDC commands because the host does not necessarily know the correct communications speed to use for BDC communications until after it has analyzed the response to the SYNC command. To issue a SYNC command, the host: • Drives the BKGD pin low for at least 128 cycles of the slowest possible BDC clock (The slowest clock is normally the reference oscillator/64 or the self-clocked rate/64.
Development Support 18.3 On-Chip Debug System (DBG) 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, and a flexible trigger system to decide when to capture bus information and what information to capture.
Development Support the host must perform ((8 – CNT) – 1) dummy reads of the FIFO to advance it to the first significant entry in the FIFO. In most trigger modes, the information stored in the FIFO consists of 16-bit change-of-flow addresses. In these cases, read DBGFH then DBGFL to get one coherent word of information out of the FIFO. Reading DBGFL (the low-order byte of the FIFO data port) causes the FIFO to shift so the next word of information is available at the FIFO data port.
Development Support A force-type breakpoint waits for the current instruction to finish and then acts upon the breakpoint request. The usual action in response to a breakpoint is to go to active background mode rather than continuing to the next instruction in the user application program. The tag vs. force terminology is used in two contexts within the debug module. The first context refers to breakpoint requests from the debug module to the CPU.
Development Support A-Only — Trigger when the address matches the value in comparator A A OR B — Trigger when the address matches either the value in comparator A or the value in comparator B 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.
Development Support 18.3.6 Hardware Breakpoints The BRKEN control bit in the DBGC register may be set to 1 to allow any of the trigger conditions described in Section 18.3.5, “Trigger Modes,” to be used to generate a hardware breakpoint request to the 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.
Development Support 18.4.1.1 BDC Status and Control Register (BDCSCR) This register can be read or written by serial BDC commands (READ_STATUS and WRITE_CONTROL) but is not accessible to user programs because it is not located in the normal memory map of the MCU. 7 R 6 5 4 3 BKPTEN FTS CLKSW BDMACT ENBDM 2 1 0 WS WSF DVF W Normal Reset 0 0 0 0 0 0 0 0 Reset in Active BDM: 1 1 0 0 1 0 0 0 = Unimplemented or Reserved Figure 18-5.
Development Support Table 18-2. BDCSCR Register Field Descriptions (continued) Field Description 2 WS Wait or Stop Status — When the target CPU is in wait or stop mode, most BDC commands cannot function. However, the BACKGROUND command can be used to force the target CPU out of wait or stop and into active background mode where all BDC commands work.
Development Support Table 18-3. SBDFR Register Field Description Field Description 0 BDFR Background Debug Force Reset — 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. 18.4.3 DBG Registers and Control Bits The debug module includes nine bytes of register space for three 16-bit registers and three 8-bit control and status registers.
Development Support 18.4.3.6 Debug FIFO Low Register (DBGFL) This register provides read-only access to the low-order eight bits of the FIFO. Writes to this register have no meaning or effect. Reading DBGFL causes the FIFO to shift to the next available word of information. When the debug module is operating in event-only modes, only 8-bit data is stored into the FIFO (high-order half of each FIFO word is unused).
Development Support 18.4.3.7 Debug Control Register (DBGC) This register can be read or written at any time. 7 6 5 4 3 2 1 0 DBGEN ARM TAG BRKEN RWA RWAEN RWB RWBEN 0 0 0 0 0 0 0 0 R W Reset Figure 18-7. Debug Control Register (DBGC) Table 18-4. DBGC Register Field Descriptions Field Description 7 DBGEN Debug Module Enable — Used to enable the debug module. DBGEN cannot be set to 1 if the MCU is secure.
Development Support 18.4.3.8 Debug Trigger Register (DBGT) This register can be read any time, but may be written only if ARM = 0, except bits 4 and 5 are hard-wired to 0s. 7 6 TRGSEL BEGIN 0 0 R 5 4 0 0 3 2 1 0 TRG3 TRG2 TRG1 TRG0 0 0 0 0 W Reset 0 0 = Unimplemented or Reserved Figure 18-8. Debug Trigger Register (DBGT) Table 18-5.
Development Support 18.4.3.9 Debug Status Register (DBGS) This is a read-only status register. R 7 6 5 4 3 2 1 0 AF BF ARMF 0 CNT3 CNT2 CNT1 CNT0 0 0 0 0 0 0 0 0 W Reset = Unimplemented or Reserved Figure 18-9. Debug Status Register (DBGS) Table 18-6. DBGS Register Field Descriptions Field Description 7 AF Trigger Match A Flag — AF is cleared at the start of a debug run and indicates whether a trigger match A condition was met since arming.
Appendix A Electrical Characteristics A.1 Introduction This appendix contains electrical and timing specifications for the MC9S08JM16 series of microcontrollers available at the time of publication. A.2 Parameter Classification The electrical parameters shown in this supplement are guaranteed by various methods. To give the customer a better understanding, the following classification is used and the parameters are tagged accordingly in the tables where appropriate: Table A-1.
Appendix A Electrical Characteristics Table A-2. Absolute Maximum Ratings Rating Symbol Value Unit Supply voltage VDD –0.3 to 5.8 V Input voltage VIn –0.3 to VDD + 0.3 V Instantaneous maximum current Single pin limit (applies to all port pins)1, 2, 3 ID ±25 mA IDD 120 mA Tstg –55 to 150 °C Maximum current into VDD Storage temperature 1 Input must be current limited to the value specified.
Appendix A Electrical Characteristics The average chip-junction temperature (TJ) in °C can be obtained from: TJ = TA + (PD × θJA) Eqn. A-1 where: TA = Ambient temperature, °C θJA = Package thermal resistance, junction-to-ambient, °C/W PD = Pint + PI/O Pint = IDD × VDD, Watts — chip internal power PI/O = Power dissipation on input and output pins — user determined For most applications, PI/O << Pint and can be neglected.
Appendix A Electrical Characteristics Table A-5. ESD and Latch-up Protection Characteristics Num A.6 Rating Symbol Min Max Unit 1 Human body model (HBM) VHBM ±2000 — V 2 Charge device model (CDM) VCDM ±500 — V 3 Latch-up current at TA = 85°C ILAT ±100 — mA DC Characteristics This section includes information about power supply requirements, I/O pin characteristics, and power supply current in various operating modes. Table 7.
Appendix A Electrical Characteristics Table 7. DC Characteristics (continued) Num C 11 Parameter P Internal pullup resistors3 4 12 P Internal pulldown resistors 13 T Internal pullup resistor to USBDP (to VUSB33) Symbol Min Typical1 Max. Unit RPU 20 45 65 kΩ RPD 20 45 65 kΩ 900 1425 1300 2400 1575 3090 kΩ 0 0 — — 2 –0.
Appendix A Electrical Characteristics 3 4 5 6 7 8 Measured with VIn = VSS. Measured with VIn = VDD. Power supply must maintain regulation within operating VDD range during instantaneous and operating maximum current conditions. If positive injection current (VIn > VDD) is greater than IDD, the injection current may flow out of VDD and could result in external power supply going out of regulation. Ensure external VDD load will shunt current greater than maximum injection current.
Appendix A Electrical Characteristics Typical VDD - VOH vs. IOH AT VDD=3V Typical VDD - VOH vs. IOH AT VDD = 5V 0.6 0.4 1.2 Hot (85°C) Room (25°C) VDD - VOH (v) VDD - VOH (v) 0.8 Cold (-40°C) 0.2 Hot (85°C) 1.0 Room (25°C) 0.8 Cold (-40°C) 0.6 0.4 0.2 0.0 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 0.0 0 IOH (mA) -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 IOH (mA) Figure A-3.
Appendix A Electrical Characteristics A.7 Supply Current Characteristics Table A-6. Supply Current Characteristics VDD (V) Typical1 Max2 5 1.1 1.6 3 0.8 1.6 5 4.0 7 3 3.8 7 5 22 30 3 21 30 5 0.80 –40 °C 25 °C 85 °C 3 0.80 –40 °C 25 °C 85 °C 5 0.90 3 0.
Appendix A Electrical Characteristics 6 Here USB module is enabled and clocked at 48 MHz (USBEN = 1, USBVREN =1, USBPHYEN = 1 and USBPU = 1), and D+ and D– pull down by two 15.1 kΩ resisters independently. The current consumption may be much higher when the packets are being transmitted through the attached cable. 7 MCU enters stop3 mode, USB bus in idle state. The USB suspend current will be dominated by the D+ pullup resister. A.8 Analog Comparator (ACMP) Electricals Table A-7.
Appendix A Electrical Characteristics Table A-8. 5 Volt 12-bit ADC Operating Conditions (continued) Characteristic Conditions ADC Conversion Clock Freq. Symbol High Speed (ADLPC=0) fADCK Low Power (ADLPC=1) Min. Typical1 Max. 0.4 — 8.0 0.4 — 4.0 Unit Comment MHz Typical values assume VDDAD = 5.0 V, Temp = 25 °C, fADCK= 1.0 MHz unless otherwise stated. Typical values are for reference only and are not tested in production. 2 DC potential difference.
Appendix A Electrical Characteristics Table A-9. 5 Volt 12-bit ADC Characteristics (VREFH = VDDAD, VREFL = VSSAD) C Symbol Min. Typical1 Max. Unit Supply Current ADLPC=1 ADLSMP=1 ADCO=1 T IDDAD — 133 — μA Supply Current ADLPC=1 ADLSMP=0 ADCO=1 T IDDAD — 218 — μA Supply Current ADLPC=0 ADLSMP=1 ADCO=1 T IDDAD — 327 — μA Supply Current ADLPC=0 ADLSMP=0 ADCO=1 T IDDAD — 0.582 1 mA IDDAD — 0.011 1 μA 2 3.3 5 1.25 2 3.3 — 20 — — 40 — — 3.5 — — 23.
Appendix A Electrical Characteristics Table A-9. 5 Volt 12-bit ADC Characteristics (VREFH = VDDAD, VREFL = VSSAD) (continued) Min. Typical1 Max. — ±1 ±4.0 — ±0.5 ±1 — ±0.5 ±0.5 — –1 to 0 –1 to 0 — — ±0.5 8 bit mode — — ±0.5 12 bit mode — ±1 ±10 — ±0.2 ±2.5 — ±0.1 ±1 — 1.396 — — 3.266 — — 3.
Appendix A Electrical Characteristics A.10 External Oscillator (XOSC) Characteristics Table A-10.
Appendix A Electrical Characteristics A.11 MCG Specifications Table A-11. MCG Frequency Specifications (Temperature Range = –40 to 125°C Ambient) Num C Rating Internal reference frequency — factory trimmed at VDD = 5 V and temperature = 25 °C Typical Max. Unit fint_ft — 31.25 — kHz P 2 P Average internal reference frequency — untrimmed1 fint_ut 25 32.7 41.66 kHz 3 P Average internal reference frequency — user trimmed fint_t 31.25 — 39.
Appendix A Electrical Characteristics 3 This specification applies to any time the PLL VCO divider or reference divider is changed, or changing from PLL disabled (BLPE, BLPI) to PLL enabled (PBE, PEE). If a crystal/resonator is being used as the reference, this specification assumes it is already running. 4 Jitter is the average deviation from the programmed frequency measured over the specified interval at maximum fBus.
Appendix A Electrical Characteristics textrst RESET PIN Figure A-6. Reset Timing tIHIL IRQ/KBIPx IRQ/KBIPx tILIH Figure A-7. IRQ/KBIPx Timing A.12.2 Timer/PWM (TPM) Module Timing Synchronizer circuits determine the shortest input pulses that can be recognized or the fastest clock that can be used as the optional external source to the timer counter. These synchronizers operate from the current bus rate clock. Table A-13.
Appendix A Electrical Characteristics tICPW TPMxCHn TPMxCHn tICPW Figure A-9. Timer Input Capture Pulse A.12.3 SPI Characteristics Table A-14 and Figure A-10 through Figure A-13 describe the timing requirements for the SPI system. Table A-14.
Appendix A Electrical Characteristics 1 Refer to Figure A-10 through Figure A-13. All timing is shown with respect to 20% VDD and 70% VDD, unless noted; 100 pF load on all SPI pins. All timing assumes slew rate control disabled and high drive strength enabled for SPI output pins. 3 Time to data active from high-impedance state. 4 Hold time to high-impedance state. 2 SS1 (OUTPUT) 5 4 SCK (CPOL = 1) (OUTPUT) 5 4 6 MISO (INPUT) 7 MSB IN2 10 MOSI (OUTPUT) 3 1 2 SCK (CPOL = 0) (OUTPUT) BIT 6 . . .
Appendix A Electrical Characteristics SS(1) (OUTPUT) 1 3 2 SCK (CPOL = 0) (OUTPUT) 5 4 SCK (CPOL = 1) (OUTPUT) 5 4 6 MISO (INPUT) 7 MSB IN(2) BIT 6 . . . 1 LSB IN 11 10 MOSI (OUTPUT) MSB OUT(2) BIT 6 . . . 1 LSB OUT NOTES: 1. SS output mode (MODFEN = 1, SSOE = 1). 2. LSBF = 0. For LSBF = 1, bit order is LSB, bit 1, ..., bit 6, MSB. Figure A-11.
Appendix A Electrical Characteristics SS (INPUT) 3 1 2 SCK (CPOL = 0) (INPUT) 5 4 SCK (CPOL = 1) (INPUT) 5 4 10 MISO (OUTPUT) SEE NOTE 8 MOSI (INPUT) SLAVE 11 MSB OUT 6 BIT 6 . . . 1 9 SLAVE LSB OUT 7 MSB IN BIT 6 . . . 1 LSB IN NOTE: 1. Not defined but normally LSB of character just received Figure A-13. SPI Slave Timing (CPHA = 1) MC9S08JM16 Series Data Sheet, Rev.
Appendix A Electrical Characteristics A.13 Flash Specifications This section provides details about program/erase times and program-erase endurance for the flash memory. Program and erase operations do not require any special power sources other than the normal VDD supply. For more detailed information about program/erase operations. Table A-15. Flash Characteristics Num C Characteristic Symbol Min Typical1 Max Unit 1 Supply voltage for program/erase Vprog/erase 2.7 5.
Appendix A Electrical Characteristics If the Freescale S08USBV1 implementation has electrical characteristics that deviate from the standard or require additional information, this space would be used to communicate that information. Table A-16. Internal USB 3.3V Voltage Regulator Characteristics Symbol Unit Min Typ Max Regulator operating voltage Vregin V 3.9 — 5.5 VREG output Vregout V 3 3.3 3.6 VUSB33 input with internal VREG disabled Vusb33in V 3 3.3 3.
MC9S08JM16 Series Data Sheet, Rev.
Appendix A Electrical Characteristics MC9S08JM16 Series Data Sheet, Rev.
Appendix B Ordering Information and Mechanical Drawings B.1 Ordering Information This section contains ordering numbers for MC9S08JM16 series devices. See below for an example of the device numbering system. Table B-1. Device Numbering System Device 1 2 B.2 Available Packages2 Memory Number1 Flash RAM Type MC9S08JM16 16,384 1024 MC9S08JM8 8,192 1024 48-pin QFN 44-pin LQFP 32-pin LQFP See Table 1-1 for a complete description of modules included on each device.
How to Reach Us: Home Page: www.freescale.com Web Support: http://www.freescale.com/support USA/Europe or Locations Not Listed: Freescale Semiconductor, Inc. Technical Information Center, EL516 2100 East Elliot Road Tempe, Arizona 85284 1-800-521-6274 or +1-480-768-2130 www.freescale.