To provide the most up-to-date information, the revision of our documents 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.
Revision
Number
1.04/25/2003Initial release
1.1Electricals change, appendix A only
1.2Electricals change, appendix A only
1.310/2/2003Added module version table; clarifications
1.410/29/2003Fixed typos and made corrections and clarifications
1.511/12/2003Added 1-MHz I
22/10/2004
2.29/2/2004
2.312/01/2004
Revision
Date
Description of Changes
values to Electricals, appendix A
DD
Changed format of register names to enable reuse of code (from SCIBD to SCI1BD, even when
only one instance of a module on a chip)
Added new device: MC9S08GT16 to book. Added new 48-pin QFN package to book. BKGDPE
description in Section 5 — changed PTD0 to PTG0. Changed typo in CPU section that listed
MOV instruction as being 6 cycles instead of 5 (Table 8-2).
Format to Freescale look-and-feel; Clarified RTI clock sources and other changes in Chapter 5;
updated ICG initialization examples; expanded descriptions of LOLS and LOCS bits in ICGS1;
updated ICG electricals Table A-9 and added a figure
Minor changes to Table 7-4, Table 7-5, Table A-9;
Clarifications in Section 11.10.6, “SCI x Control Register 3 (SCIxC3)”, Section 11.7, “Interrupts
and Status Flags”, Section 11.8.1, “8- and 9-Bit Data Modes”, PTG availability in 48-pin
package (see Table 2-2)
This product incorporates SuperFlash® technology licensed from SST.
10.2 Features .........................................................................................................................................151
11.2 Features .........................................................................................................................................169
11.3 SCI System Description ................................................................................................................169
11.10 SCI Registers and Control Bits .....................................................................................................177
11.10.1 SCI x Baud Rate Registers (SCIxBDH, SCIxBDL) ......................................................177
11.10.2 SCI x Control Register 1 (SCIxC1) ...............................................................................178
11.10.3 SCI x Control Register 2 (SCIxC2) ...............................................................................180
11.10.4 SCI x Status Register 1 (SCIxS1) ..................................................................................181
11.10.5 SCI x Status Register 2 (SCIxS2) ..................................................................................183
11.10.6 SCI x Control Register 3 (SCIxC3) ...............................................................................184
11.10.7 SCI x Data Register (SCIxD) ........................................................................................185
Chapter 12
Serial Peripheral Interface (SPI) Module
12.1 Features .........................................................................................................................................189
15.2 Features .........................................................................................................................................236
The MC9S08GB/GT 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.
1.2Features
Features have been organized to reflect:
•Standard features of the HCS08 Family
•Features of the MC9S08GB/GT MCU
1.2.1Standard Features of the HCS08 Family
•40-MHz HCS08 CPU (central processor unit)
•HC08 instruction set with added BGND instruction
•Background debugging system (see also Chapter 15, “Development Support”)
•Breakpoint capability to allow single breakpoint setting during in-circuit debugging (plus two more
breakpoints in on-chip debug module)
•Debug module containing two comparators and nine trigger modes. Eight deep FIFO for storing
change-of-flow addresses and event-only data. Debug module supports both tag and force
breakpoints.
•Support for up to 32 interrupt/reset sources
•Power-saving modes: wait plus three stops
•System protection features:
— Optional computer operating properly (COP) reset
— Low-voltage detection with reset or interrupt
— Illegal opcode detection with reset
— Illegal address detection with reset (some devices don’t have illegal addresses)
1.2.2Features of MC9S08GB/GT Series of MCUs
•On-chip in-circuit programmable FLASH memory with block protection and security options (see
Table 1-1 for device specific information)
•On-chip random-access memory (RAM) (see Table 1-1 for device specific information)
•Two serial communications interface modules (SCI)
•Serial peripheral interface module (SPI)
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor17
Chapter 1 Introduction
•Multiple clock source options:
— Internally generated clock with ±0.2% trimming resolution and ±0.5% deviation across
voltage.
— Crystal
— Resonator, or
— External clock
•Inter-integrated circuit bus module to operate up to 100 kbps (IIC)
•One 3-channel and one 5-channel 16-bit timer/pulse width modulator (TPM) modules with
selectable input capture, output compare, and edge-aligned PWM capability on each channel. Each
timer module may be configured for buffered, centered PWM (CPWM) on all channels (TPMx).
•8-pin keyboard interrupt module (KBI)
•16 high-current pins (limited by package dissipation)
•Software selectable pullups on ports when used as input. Selection is on an individual port bit basis.
During output mode, pullups are disengaged.
•Internal pullup on
RESET and IRQ pin to reduce customer system cost
•Up to 56 general-purpose input/output (I/O) pins, depending on package selection
6. PTC[6:5] are not available on the 42-pin SDIP package.
7. Pins PTA[7:4] contain both pullup and pulldown devices. Pulldown available when KBI enabled (KBIPn = 1).
8. Only two timer channels per TPM are bonded out. All channels are available for use as software compare.
Figure 1-2. MC9S08GTxx Block Diagram
MC9S08GB/GT Data Sheet, Rev. 2.3
20Freescale Semiconductor
Table 1-2 lists the functional versions of the on-chip modules.
Table 1-2. Block Versions
ModuleVersion
Analog-to-Digital Converter (ATD)3
Internal Clock Generator (ICG)2
Inter-Integrated Circuit (IIC)1
Keyboard Interrupt (KBI)1
Serial Communications Interface (SCI)1
Serial Peripheral Interface (SPI)3
Timer Pulse-Width Modulator (TPM)1
Central Processing Unit (CPU)2
1.4System Clock Distribution
System Clock Distribution
ICGERCLK
FFE
SYSTEM
CONTROL
LOGIC
RTI
TPM1TPM2IIC1SCI1SCI2SPI1
÷2
ICG
ICGOUT
ICGLCLK*
CPU
* ICGLCLK is the alternate BDC clock source for the MC9S08GB/GT.
FIXED FREQ CLOCK (XCLK)
÷2
BUSCLK
BDC
ATD1
ATD has min and max
frequency requirements.
See Chapter 1, “Introduction”
and Appendix A, “Electrical
Characteristics.
RAMFLASH
FLASH has frequency
requirements for program
and erase operation.
See Appendix A, “Electrical
Characteristics.
Figure 1-3. System Clock Distribution Diagram
Some of the modules inside the MCU have clock source choices. Figure 1-3 shows a simplified clock
connection diagram. The ICG supplies the clock sources:
•ICGOUT is an output of the ICG module. It is one of the following:
— The external crystal oscillator
— An external clock source
— The output of the digitally-controlled oscillator (DCO) in the frequency-locked loop
sub-module
Control bits inside the ICG determine which source is connected.
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor21
Chapter 1 Introduction
•FFE is a control signal generated inside the ICG. If the frequency of ICGOUT > 4 × the frequency
of ICGERCLK, this signal is a logic 1 and the fixed-frequency clock will be the ICGERCLK.
Otherwise the fixed-frequency clock will be BUSCLK.
•ICGLCLK — Development tools can select this internal self-clocked source (~ 8 MHz) to speed
up BDC communications in systems where the bus clock is slow.
•ICGERCLK — External reference clock can be selected as the real-time interrupt clock source.
MC9S08GB/GT Data Sheet, Rev. 2.3
22Freescale Semiconductor
Chapter 2 Pins and Connections
2.1Introduction
This section describes signals that connect to package pins. It includes a pinout diagram, a table of signal
properties, and detailed discussion of signals.
2.2Device Pin Assignment
DDAD
SSAD
57
V
V
56
PTF1
PTF0
PTA7/KBI1P7
PTA5/KBI1P5
PTA6/KBI1P6
PTA4/KBI1P4
505152535455
PTA3/KBI1P3
49
48
47
46
45
44
43
42
41
40
PTA2/KBI1P2
PTA1/KBI1P1
PTA0/KBI1P0
PTF7
PTF6
PTF5
V
REFL
V
REFH
PTB7/AD1P7
RESET
PTG7
PTC0/TxD2
PTC1/RxD2
PTC2/SDA1
PTC3/SCL1
PTC4
PTC5
PTC6
PTG6
PTG5
PTG4
64
63 62 61
1
2
3
4
5
6
7
8
9
PTG2/EXTAL
PTG3
60
PTG0/BKGD/MS
PTG1/XTAL
58
59
PTC7
PTF2
PTF3
PTF4
PTE0/TxD1
PTE1/RxD1
IRQ
16
10
11
12
13
14
15
17
PTE2/SS1
19
18
PTE4/MOSI1
PTE3/MISO1
20 21 22
PTE6
PTE5/SPSCK1
23
PTE7
27
24
25
26
SS
DD
V
V
PTD0/TPM1CH0
28 29 30 31
PTD1/TPM1CH1
PTD2/TPM1CH2
PTD3/TPM2CH0
PTD5/TPM2CH2
PTD4/TPM2CH1
39
PTB6/AD1P6
38
PTB5/AD1P5
37
PTB4/AD1P4
PTB3/AD1P3
36
35
PTB2/AD1P2
34
PTB1/AD1P1
PTB0/AD1P0
33
32
PTD6/TPM2CH3
PTD7/TPM2CH4
Figure 2-1. MC9S08GBxx in 64-Pin LQFP Package
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor23
Chapter 2 Pins and Connections
RESET
PTC0/TxD2
PTC1/RxD2
PTC2/SDA1
PTC3/SCL1
PTC4
PTC5
PTC6
PTE0/TxD1
PTE1/RxD1
PTC7
IRQ
DDAD
SSAD
PTG2/EXTAL
PTG1/XTAL
PTG3
47
48
1
PTG0/BKGD/MS
46
45
V
V
44
43
PTA6/KBI1P6
PTA7/KBI1P7
42
41
2
3
4
5
6
7
8
9
10
11
12
14
15
16
17
18
19
13
20
PTA4/KBI1P4
PTA5/KBI1P5
40
21
PTA3/KBI1P3
39
38
22
23
PTA2/KBI1P2
37
PTA1/KBI1P1
36
PTA0/KBI1P0
35
V
34
REFL
V
33
REFH
PTB7/AD1P7
32
PTB6/AD1P6
31
PTB5/AD1P5
30
PTB4/AD1P4
29
PTB3/AD1P3
28
PTB2/AD1P2
27
PTB1/AD1P1
26
PTB0/AD1P0
25
24
SS2
V
DD
V
SS1
V
PTE2/SS1
PTE3/MISO1
PTE5/SPSCK1
PTE4/MOSI1
PTD1/TPM1CH1
PTD0/TPM1CH0
PTD2/TPM1CH2
PTD3/TPM2CH0
PTD4/TPM2CH1
Figure 2-2. MC9S08GTxx in 48-Pin QFN Package
MC9S08GB/GT Data Sheet, Rev. 2.3
24Freescale Semiconductor
RESET
PTC0/TxD2
PTC1/RxD2
PTC2/SDA1
PTC3/SCL1
PTC4
PTC5
PTC6
PTE0/TxD1
PTE1/RxD1
IRQ
1
11
PTG2/EXTAL
44
2
3
4
5
6
7
8
9
10
12
PTG1/XTAL
PTG0/BKGD/MS
43
42
13
14
SSAD
V
41
15
DDAD
V
PTA7/KBI1P7
40
16
17
SS
DD
V
V
PTA6/KBI1P6
39
38
18
PTA4/KBI1P4
PTA5/KBI1P5
37
19
PTA3/KBI1P3
36
35
20
21
PTA2/KBI1P2
34
PTA1/KBI1P1
33
PTA0/KBI1P0
32
V
31
30
29
28
27
26
25
24
REFL
V
REFH
PTB7/AD1P7
PTB6/AD1P6
PTB5/AD1P5
PTB4/AD1P4
PTB3/AD1P3
PTB2/AD1P2
PTB1/AD1P1
23
22
Device Pin Assignment
PTE2/SS1
PTE3/MISO1
PTE4/MOSI1
PTE5/SPSCK1
PTD1/TPM1CH1
PTD0/TPM1CH0
PTD3/TPM2CH0
PTB0/AD1P0
PTD4/TPM2CH1
Figure 2-3. MC9S08GTxx in 44-Pin QFP Package
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor25
Chapter 2 Pins and Connections
V
DDAD
V
SSAD
PTG0/BKGD/MS
PTG1/XTAL
PTG2/EXTAL
RESET
PTC0/TxD2
PTC1/RXD2
PTC2/SDA1
PTC3/SCL1
PTC4
PTE0/TxD1
PTE1/RxD1
IRQ
PTE2/
SS1
PTE3/MISO1
PTE4/MOSI1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
1528
1627
1726
42
41
40
39
38
37
36
35
34
33
32
31
30
29
PTA7/KBI1P7
PTA6/KBI1P6
PTA5/KBI1P5
PTA4/KBI1P4
PTA3/KBI1P3
PTA2/KBI1P2
PTA1/KBI1P1
PTA0/KBI1P0
V
REFL
V
REFH
PTB7/AD1P7
PTB6/AD1P6
PTB5/AD1P5
PTB4/AD1P4
PTB3/AD1P3
PTB2/AD1P2
PTB1/AD1P1
PTE5/SPSCK1
V
SS
V
DD
PTD0/TPM1CH0
1825
1924
2023
2122
PTB0/AD1P0
PTD4/TPM2CH1
PTD3/TPM2CH0
PTD1/TPM1CH1
Figure 2-4. MC9S08GTxx in 42-Pin SDIP Package
2.3Recommended System Connections
Figure 2-5 shows pin connections that are common to almost all MC9S08GB60 application systems.
MC9S08GTxx connections will be similar except for the number of I/O pins available. A more detailed
discussion of system connections follows.
MC9S08GB/GT Data Sheet, Rev. 2.3
26Freescale Semiconductor
SYSTEM
POWER
NOTE 1
C1
BACKGROUND HEADER
V
DD
NOTES:
1. Not required if
using the internal
oscillator option.
2. These are the
same pins as
PTG1 and PTG2.
3. BKGD/MS is the
same pin as PTG0.
4. The 48-pin QFN
has 2 V
(V
SS1
both of which must
be connected to
GND.
+
3 V
10 µF
OPTIONAL
MANUAL
RESET
pins
SS
and V
V
DD
+
C
BLK
R
F
X1
ASYNCHRONOUS
PTG0/BKDG/MS
),
SS2
C
BY
0.1 µF
C2
INTERRUPT
INPUT
PTG1/XTAL
PTG2/EXTAL
PTG3
PTG4
PTG5
PTG6
PTG7
PTF0
PTF1
PTF2
PTF3
PTF4
PTF5
PTF6
PTF7
C
BYAD
0.1 µF
R
S
V
REFH
V
DDAD
V
SSAD
V
REFL
V
DD
V
SS
NOTE 4
XTAL
NOTE 2
EXTAL
NOTE 2
PORT
G
PORT
F
MC9S08GBxx
BKGD/MS
NOTE 3
RESET
IRQ
PORT
A
PORT
B
PORT
C
PORT
D
PORT
E
Recommended System Connections
PTA0/KBI1P0
PTA1/KBI1P1
PTA2/KBI1P2
PTA3/KBI1P3
PTA4/KBI1P4
PTA5/KBI1P5
PTA6/KBI1P6
PTA7/KBI1P7
PTB0/AD1P0
PTB1/AD1P1
PTB2/AD1P2
PTB3/AD1P3
PTB4/AD1P4
PTB5/AD1P5
PTB6/AD1P6
PTB7/AD1P7
PTC0/TxD2
PTC1/RxD2
PTC2/SDA1
PTC3/SCL1
I/O AND
PERIPHERAL
INTERFACE TO
APPLICATION
SYSTEM
PTC4
PTC5
PTC6
PTC7
PTD0/TPM1CH0
PTD1/TPM1CH1
PTD2/TPM1CH2
PTD3/TPM2CH0
PTD4/TPM2CH1
PTD5/TPM2CH2
PTD6/TPM2CH3
PTD7/TPM2CH4
PTE0/TxD1
PTE1/RxD1
SS1
PTE2/
PTE3/MISO1
PTE4/MOSI1
PTE5/SPSCK1
PTE6
PTE7
Figure 2-5. Basic System Connections
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor27
Chapter 2 Pins and Connections
2.3.1Power
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. In this case, there
should be a bulk electrolytic capacitor, such as a 10-µF tantalum capacitor, to provide bulk charge storage
for the overall system and a 0.1-µF ceramic bypass capacitor located as close to the MCU power pins as
practical to suppress high-frequency noise.
V
DDAD
and V
are the analog power supply pins for the MCU. This voltage source supplies power to
SSAD
the ATD. A 0.1-µF ceramic bypass capacitor should be located as close to the MCU power pins as practical
to suppress high-frequency noise.
2.3.2Oscillator
Out of reset, the MCU uses an internally generated clock (self-clocked mode — f
Self_reset
approximately equivalent to an 8-MHz crystal rate. This frequency source is used during reset startup and
can be enabled as the clock source for stop recovery to avoid the need for a long crystal startup delay. This
MCU also contains a trimmable internal clock generator (ICG) module that can be used to run the MCU.
For more information on the ICG, see Chapter 7, “Internal Clock Generator (ICG) Module.”
The oscillator in this MCU is a Pierce oscillator that can accommodate a crystal or ceramic resonator in
either of two frequency ranges selected by the RANGE bit in the ICGC1 register. Rather than a crystal or
ceramic resonator, an external oscillator can be connected to the EXTAL input pin, and the XTAL output
pin can be used as general I/O.
Refer to Figure 2-5 for the following discussion. R
(when used) and RF should be low-inductance
S
resistors such as carbon composition resistors. Wire-wound resistors, and some metal film resistors, have
too much inductance. C1 and C2 normally should be high-quality ceramic capacitors that are specifically
designed for high-frequency applications.
is used to provide a bias path to keep the EXTAL input in its linear range during crystal startup and its
R
F
value is not generally critical. Typical systems use 1 MΩ to 10 MΩ. Higher values are sensitive to humidity
and lower values reduce gain and (in extreme cases) could prevent startup.
) that is
C1 and C2 are typically in the 5-pF to 25-pF range and are chosen to match the requirements of a specific
crystal or resonator. Be sure to take into account printed circuit board (PCB) capacitance and MCU pin
capacitance when sizing C1 and C2. The crystal manufacturer typically specifies a load capacitance which
is the series combination of C1 and C2 which are usually the same size. As a first-order approximation,
use 10 pF as an estimate of combined pin and PCB capacitance for each oscillator pin (EXTAL and
XTAL).
2.3.3Reset
RESET is a dedicated pin with a pullup device built in. 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
MC9S08GB/GT Data Sheet, Rev. 2.3
28Freescale Semiconductor
Recommended System Connections
debug connector so a development system can directly reset the MCU system. If desired, a manual external
reset can be added by supplying a simple switch to ground (pull reset pin low to force a reset).
Whenever any reset is initiated (whether from an external signal or from an internal system), the reset pin
is driven low for approximately 34 cycles of f
cycles of f
Self_reset
later. If reset was caused by an internal source such as low-voltage reset or watchdog
Self_reset
, released, and sampled again approximately 38
timeout, the circuitry expects the reset pin sample to return a logic 1. If the pin is still low at this sample
point, the reset is assumed to be from an external source. The reset circuitry decodes the cause of reset and
records it by setting a corresponding bit in the system control reset status register (SRS).
Never connect any significant capacitance to the reset pin because that would interfere with the circuit and
sequence that detects the source of reset. If an external capacitance prevents the reset pin from rising to a
valid logic 1 before the reset sample point, all resets will appear to be external resets.
2.3.4Background / Mode Select (PTG0/BKGD/MS)
The background/mode select (BKGD/MS) shares its function with an I/O port pin. While in reset, the pin
functions as a mode select pin. Immediately after reset rises the pin functions as the background pin and
can be used for background debug communication. While functioning as a background/mode select pin,
the pin includes an internal pullup device, input hysteresis, a standard output driver, and no output slew
rate control. When used as an I/O port (PTG0) the pin is limited to output only.
If nothing is connected to this pin, the MCU will enter normal operating mode at the rising edge of reset.
If a debug system is connected to the 6-pin standard background debug header, it can hold BKGD/MS low
during the rising edge of reset which forces the MCU to active background mode.
The BKGD pin is used primarily for background debug controller (BDC) communications using a custom
protocol that uses 16 clock cycles of the target MCU’s BDC clock per bit time. The target MCU’s BDC
clock could be as fast as the bus clock rate, so there should never be any significant capacitance connected
to the BKGD/MS pin that could interfere with background serial communications.
Although the BKGD pin is a pseudo open-drain pin, the background debug communication protocol
provides brief, actively driven, high speedup pulses to ensure fast rise times. Small capacitances from
cables and the absolute value of the internal pullup device play almost no role in determining rise and fall
times on the BKGD pin.
2.3.5General-Purpose I/O and Peripheral Ports
The remaining 55 pins are shared among general-purpose I/O and on-chip peripheral functions such as
timers and serial I/O systems. (Sixteen of these pins are not bonded out on the 48-pin package, twenty of
these pins are not bonded out on the 44-pin package, and twenty-two are not bonded out on the 42-pin
package.) Immediately after reset, all 55 of these pins are configured as high-impedance general-purpose
inputs with internal pullup devices disabled.
MC9S08GB/GT Data Sheet, Rev. 2.3
Freescale Semiconductor29
Chapter 2 Pins and Connections
NOTE
To avoid extra current drain from floating input pins, the reset initialization
routine in the application program should either enable on-chip pullup
devices or change the direction of unused pins to outputs so the pins do not
float.
For information about controlling these pins as general-purpose I/O pins, see Chapter 6, “Parallel
Input/Output.” For information about how and when on-chip peripheral systems use these pins, refer to the
appropriate section from Table 2-1.
Table 2-1. Pin Sharing References
Port Pins
PTA7–PTA0KBI1P7–KBI1P0Chapter 2, “Pins and Connections”
See this section for information about modules that share these pins.
When an on-chip peripheral system is controlling a pin, data direction control bits still determine what is
read from port data registers even though the peripheral module controls the pin direction by controlling
the enable for the pin’s output buffer. See Chapter 6, “Parallel Input/Output” for details.
Pullup enable bits for each input pin control whether on-chip pullup devices are enabled whenever the pin
is acting as an input even if it is being controlled by an on-chip peripheral module. When the PTA7–PTA4
pins are controlled by the KBI module and are configured for rising-edge/high-level sensitivity, the pullup
enable control bits enable pulldown devices rather than pullup devices. Similarly, when IRQ is configured
MC9S08GB/GT Data Sheet, Rev. 2.3
30Freescale Semiconductor
Loading...
+ 260 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.