ST72344xx
ST72345xx
8-bit MCU with up to 16K Flash memory, 10-bit ADC
two 16-bit timers, two I2C, SPI, SCI
Features
■
Memories
– up to 16 Kbytes Program memory: single
voltage extended Flash (XFlash) with read-
out and write protection, in-circuit and in-
application programming (ICP and IAP).
10K write/erase cycles guaranteed, data
retention: 20 years at 55 °C.
– up to 1 Kbyte RAM
– 256 bytes data EEPROM with readout
protection. 300K write/erase cycles
guaranteed, data retention: 20 years at
55 °C.
Clock, reset and supply management
– Power on / power off safe reset with 3
programmable threshold levels (LVD)
– Auxiliary voltage detector (AVD)
– Clock sources: crystal/ceramic resonator
oscillators, high-accuracy internal RC
oscillator or external clock
– PLL for 4x or 8x frequency multiplication
– 5 power-saving modes: Slow, Wait, Halt,
Auto-wakeup from Halt and Active-halt
– Clock output capability (f
CPU
)
Interrupt management
– Nested interrupt controller
– 10 interrupt vectors plus TRAP and RESET
– 9 external interrupt lines on 4 vectors
Up to 34 I/O ports
– up to 34 multifunctional bidirectional I/O
lines
– up to 12 high sink outputs (10 on 32-pin
devices)
4 timers
– Configurable window watchdog timer
– Real-time base
– 16-bit timer A with: 1 input capture, 1 output
compares, external clock input, PWM and
pulse generator modes
LQFP48
7 x 7 mm
LQFP32
7 × 7 mm
LQFP44
10 × 10 mm
– 16-bit timer B with: 2 input captures, 2
output compares, PWM and pulse
generator modes
■
■
3 communication interfaces
– I
2
C multimaster / slave
– I
2
C slave 3 addresses no stretch with DMA
access and byte pair coherency on I²C
Read
– SCI asynchronous serial interface (LIN
compatible)
– SPI synchronous serial interface
1 analog peripheral
– 10-bit ADC with 12 input channels (8 on 32-
pin devices)
Instruction set
– 8-bit data manipulation
– 63 basic instructions with illegal opcode
detection
– 17 main addressing modes
– 8 x 8 unsigned multiply instruction
Development tools
– Full hardware/software development
package
– On-chip debug module
Device summary
Part numbers
ST72344K2, ST72344K4,
ST72344S2, ST72344S4
ST72345C4
■
■
■
■
■
Table 1.
References
ST72344xx
ST72345xx
■
September 2008
Rev 3
1/246
www.st.com
1
Contents
ST72344xx, ST72345xx
Contents
1
2
3
4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Register and memory map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Flash program memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.1
4.2
4.3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Programming modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
4.3.1
4.3.2
In-circuit programming (ICP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
In-application programming (IAP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.4
4.5
ICC interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Memory protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.5.1
4.5.2
Readout protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Flash write/erase protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.6
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.6.1
Flash control/status register (FCSR) . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
5
Data EEPROM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
5.1
5.2
5.3
5.4
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Memory access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Power saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.4.1
5.4.2
5.4.3
Wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Active-halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
5.5
5.6
5.7
Access error handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Data EEPROM readout protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
5.7.1
EEPROM control/status register (EECSR) . . . . . . . . . . . . . . . . . . . . . . 35
6
Central processing unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2/246
ST72344xx, ST72345xx
Contents
6.1
6.2
6.3
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
CPU registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
6.3.1
6.3.2
Condition code register (CC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Stack pointer (SP) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
7
Supply, reset and clock management . . . . . . . . . . . . . . . . . . . . . . . . . . 41
7.1
7.2
7.3
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Phase locked loop . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Multioscillator (MO) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
7.3.1
7.3.2
7.3.3
External clock source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Crystal/ceramic oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Internal RC oscillator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.4
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
7.4.1
7.4.2
RC control register (RCCRH) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
RC control register (RCCRL) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
7.5
Reset sequence manager (RSM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
7.5.1
7.5.2
7.5.3
7.5.4
7.5.5
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
Asynchronous external RESET pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
External power-on reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
Internal low-voltage detector (LVD) reset . . . . . . . . . . . . . . . . . . . . . . . . 48
Internal watchdog reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.6
System integrity management (SI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
7.6.1
7.6.2
7.6.3
7.6.4
7.6.5
Low-voltage detector (LVD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Auxiliary-voltage detector (AVD) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
8
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
8.1
8.2
8.3
8.4
8.5
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Masking and processing flow . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Interrupts and low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Concurrent & nested management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Interrupt register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
8.5.1
CPU CC register interrupt bits . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3/246
Contents
8.5.2
ST72344xx, ST72345xx
Interrupt software priority registers (ISPRX) . . . . . . . . . . . . . . . . . . . . . 58
8.6
8.7
External interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8.6.1
I/O port interrupt sensitivity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
External interrupt control register (EICR) . . . . . . . . . . . . . . . . . . . . . . . . . 61
9
Power-saving modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
9.1
9.2
9.3
9.4
9.5
9.6
9.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Slow mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Wait mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
Halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Active-halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
Auto-wakeup from Halt mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
9.7.1
9.7.2
AWUFH control/status register (AWUCSR) . . . . . . . . . . . . . . . . . . . . . . 72
AWUFH prescaler register (AWUPR) . . . . . . . . . . . . . . . . . . . . . . . . . . 73
10
I/O ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
10.1
10.2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
10.2.1
10.2.2
10.2.3
Input modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Output modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Alternate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
10.3
10.4
10.5
I/O port implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
10.5.1
I/O port implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
11
On-chip peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
11.1
Window watchdog (WWDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
11.1.1
11.1.2
11.1.3
11.1.4
11.1.5
11.1.6
11.1.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Using Halt mode with the WDG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
How to program the watchdog timeout . . . . . . . . . . . . . . . . . . . . . . . . . 84
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Hardware watchdog option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
4/246
ST72344xx, ST72345xx
11.1.8
11.1.9
Contents
Using Halt mode with the WDG (WDGHALT option) . . . . . . . . . . . . . . . 87
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.1.10 Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.2
Main clock controller with real-time clock and beeper (MCC/RTC) . . . . . 88
11.2.1
11.2.2
11.2.3
11.2.4
11.2.5
11.2.6
11.2.7
Programmable CPU clock prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Clock-out capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Real-time clock timer (RTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
11.3
16-bit timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
11.3.1
11.3.2
11.3.3
11.3.4
11.3.5
11.3.6
11.3.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Summary of timer modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
11.4
Serial peripheral interface (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11.4.1
11.4.2
11.4.3
11.4.4
11.4.5
11.4.6
11.4.7
11.4.8
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Clock phase and clock polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Error flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
11.5
SCI serial communication interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
11.5.1
11.5.2
11.5.3
11.5.4
11.5.5
11.5.6
11.5.7
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Main features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
General description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
Low-power modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
Register description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
5/246