ST72345
ST72345
■ Memories
– up to 16 Kbytes Program memory: Single volt-
age extended Flash (XFlash) with read-out
and write protection, In-Circuit and In-Applica-
tion Programming (ICP and IAP). 10K write/
erase cycles guaranteed, data retention: 20 LQFP48 LQFP44
years at 55°C. 7x7 10 x 10
– up to 1 Kbyte RAM
– 256 bytes data EEPROM with read-out pro-
tection. 300K write/erase cycles guaranteed,
data retention: 20 years at 55°C.
■ Clock, Reset and Supply Management LQFP32
– Power On / Power Off safe reset with 3 pro- 7x7
grammable threshold levels (LVD)
– Auxiliary Voltage Detector (AVD) – 16-bit timer B with: 2 input captures, 2 output
compares, PWM and Pulse generator modes
– Clock sources: crystal/ceramic resonator os- ■ 3 Communication Interfaces
cillators, high-accuracy internal RC oscillator
or external clock – I2C Multi Master / Slave
– PLL for 4x or 8x frequency multiplication – I2C Slave 3 Addresses No Stretch with DMA
– 5 Power Saving Modes: Slow, Wait, Halt, access and Byte Pair Coherency on I²C Read
Auto-Wakeup from Halt and Active Halt – SCI asynchronous serial interface (LIN com-
– Clock output capability (fCPU) patible)
■ Interrupt Management – SPI synchronous serial interface
– Nested interrupt controller ■ 1 Analog peripheral
– 10 interrupt vectors plus TRAP and RESET – 10-bit ADC with 12 input channels (8 on 32-
pin devices)
– 9 external interrupt lines on 4 vectors
■ Instruction Set
■ Up to 34 I/O Ports
– 8-bit data manipulation
– up to 34 multifunctional bidirectional I/O lines
– 63 basic instructions with illegal opcode de-
– up to 12 high sink outputs (10 on 32-pin devic- tection
es)
– 17 main addressing modes
■ 4 Timers
– 8 x 8 unsigned multiply instruction
– Configurable window watchdog timer ■ Development tools
– Realtime base
– Full hardware/software development package
– 16-bit timer A with: 1 input capture, 1 output
compares, external clock input, PWM and – On-Chip Debug Module
Pulse generator modes
Device Summary
Features ST72F340 ST72F344 ST72F345
Program memory - bytes 8K 16K 8K 16K 16K
RAM (stack) - bytes 512 (256) 1K (256) 512 (256) 1K (256) 1K (256)
EEPROM data - bytes 256 256 256 256 256
Common peripherals Window Watchdog, 2 16-bit Timers, SCI, SPI, I2CMMS
Other peripherals - 10-bit ADC I2C3SNS, 10-bit ADC
Int high-accuracy 1MHz RC Not present Present Present
CPU Frequency 8MHz @ 3.3V to 5.5V, 4MHz @ 2.7V to 5.5V
Temperature Range -40°C to +85 °C
Package LQFP32 7x7, LQFP44 10x10 LQFP48 7x7
Rev. 2
2/191
1
Table of Contents
9.6 AUTO WAKE UP FROM HALT MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
10 I/O PORTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10.2 FUNCTIONAL DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
10.3 I/O PORT IMPLEMENTATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
10.4 LOW POWER MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
10.5 INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
11 ON-CHIP PERIPHERALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
11.1 WINDOW WATCHDOG (WWDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
11.2 MAIN CLOCK CONTROLLER WITH REAL TIME CLOCK AND BEEPER (MCC/RTC) . 65
11.3 16-BIT TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
11.4 SERIAL PERIPHERAL INTERFACE (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
11.5 SCI SERIAL COMMUNICATION INTERFACE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
11.6 I2C BUS INTERFACE (I2C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
11.7 I2C TRIPLE SLAVE INTERFACE WITH DMA (I2C3S) . . . . . . . . . . . . . . . . . . . . . . . . . 128
11.8 10-BIT A/D CONVERTER (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
12 INSTRUCTION SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
12.1 ST7 ADDRESSING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
12.2 INSTRUCTION GROUPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
13 ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
13.1 PARAMETER CONDITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
13.2 ABSOLUTE MAXIMUM RATINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
13.3 OPERATING CONDITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
13.4 PLL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
13.5 INTERNAL RC OSCILLATOR CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . 156
13.6 SUPPLY CURRENT CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
13.7 CLOCK AND TIMING CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
13.8 MEMORY CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
13.9 EMC CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164
13.10 I/O PORT PIN CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
13.11 CONTROL PIN CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
13.12 COMMUNICATION INTERFACE CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . 174
13.13 10-BIT ADC CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175
14 PACKAGE CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
14.1 PACKAGE MECHANICAL DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
15 DEVICE CONFIGURATION AND ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . 181
15.1 OPTION BYTES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
15.2 DEVICE ORDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
15.3 DEVELOPMENT TOOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
16 KNOWN LIMITATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
. . . 187
16.1 EXTERNAL INTERRUPT MISSED . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
16.2 CLEARING ACTIVE INTERRUPTS OUTSIDE INTERRUPT ROUTINE . . . . . . . . . . . . 188
3/191
Table of Contents
16.3 16-BIT TIMER PWM MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.4 SCI WRONG BREAK DURATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.5 IN-APPLICATION PROGRAMMING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.6 PROGRAMMING OF EEPROM DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
16.7 FLASH WRITE/ERASE PROTECTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
17 REVISION HISTORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
Please pay special attention to the Section “KNOWN LIMITATIONS” on page 187
191
4/191
ST72340, ST72344, ST72345
1 INTRODUCTION
The ST7234x devices are members of the ST7 mi- The enhanced instruction set and addressing
crocontroller family. All devices are based on a modes of the ST7 offer both power and flexibility to
common industry-standard 8-bit core, featuring an software developers, enabling the design of highly
enhanced instruction set. efficient and compact application code. In addition
They feature single-voltage FLASH memory with to standard 8-bit data management, all ST7 micro-
byte-by-byte In-Circuit Programming (ICP) and In- controllers feature true bit manipulation, 8x8 un-
Application Programming (IAP) capabilities. signed multiplication and indirect addressing
modes.
Under software control, all devices can be placed
in WAIT, SLOW, Auto-Wakeup from Halt, Active- The devices feature an on-chip Debug Module
HALT or HALT mode, reducing power consump- (DM) to support in-circuit debugging (ICD). For a
tion when the application is in idle or stand-by description of the DM registers, refer to the ST7
state. ICC Protocol Reference Manual.
AVD WATCHDOG
OSC1
CLOCK CONTROL I2CMMS
OSC2
PA
ADDRESS AND DATA BUS
(5-bits)
INTERNAL RC PORT A
MCC/RTC/BEEP
PORT B
PB
PORT F (5-bits)
PWM ART
PF
(6-bits)
TIMER A
PORT C
BEEP
TIMER B PC
(8-bits)
I2C3SNS
SPI
PD
(6-bits) PORT D
PORT E
10-BIT ADC PE
(2-bits)
VAREF
SCI
VSSA
5/191
ST72340, ST72344, ST72345
2 PIN DESCRIPTION
Figure 2. LQFP32 Package Pinout
PD1 / AIN1
PD0 / AIN0
PE0 / TDO
PE1 / RDI
PB4 (HS)
VDD_2
PB3
PB0
32 31 30 29 28 27 26 25
VDDA 24 OSC1
)
1
ei3 ei2 ei0
VSSA 2 23 OSC2
AIN8 / PF0 3 22 VSS_2
ei1
(HS) PF1 4 21 RESET
OCMP1_A / AIN10 / PF4 5 20 ICCSEL
ICAP1_A / (HS) PF6 6 19 PA7 (HS) / SCL
EXTCLK_A / (HS) PF7 7 18 PA6 (HS) / SDA
AIN12 / OCMP2_B / PC0 8 ei0 17 PA4 (HS)
9 10 11 12 13 14 15 16
AIN14 / MOSI / PC5
ICCCLK / SCK / PC6
AIN15 / SS / PC7
(HS) PA3
AIN13 / OCMP1_B / PC1
ICAP2_B / (HS) PC2
ICAP1_B / (HS) PC3
ICCDATA / MISO / PC4
PA5 (HS)
PA4 (HS)
ICCSEL
RESET
VDD_2
VSS_2
OSC1
OSC2
44 43 42 41 40 39 38 37 36 35 34
RDI / PE1 1 ei0 33 VSS_1
PB0 2 32 VDD_1
PB1 3 ei0 31 PA3 (HS)
ei2
PB2 4 30 PC7 / SS / AIN15
PB3 5 29 PC6 / SCK / ICCCLK
(HS) PB4 6 ei3 28 PC5 / MOSI / AIN14
AIN0 / PD0 7 27 PC4 / MISO / ICCDATA
AIN1 / PD1 8 26 PC3 (HS) / ICAP1_B
AIN2 / PD2 9 25 PC2 (HS) / ICAP2_B
AIN3 / PD3 10 24 PC1 / OCMP1_B / AIN13
ei1
AIN4 / PD4 11 23 PC0 / OCMP2_B / AIN12
12 13 14 15 16 17 18 19 20 21 22
EXTCLK_A / (HS) PF7
BEEP / (HS) PF1
(HS) PF2
VDD_0
VSS_0
AIN5 / PD5
6/191
ST72340, ST72344, ST72345
PD6/SDA3SNS
PD7/SCL3SNS
PA6 (HS)/SDA
PA7 (HS)/SCL
PA5 (HS)
PA4 (HS)
ICCSEL
RESET
OSC1
OSC2
VDD_2
VSS_2
48 47 46 45 44 43 42 41 40 39 38 37
PE0/TD0 1 36 VSS_1
RDI / PE1 2 ei0 35 VDD_1
PB0 3 ei0 34 PA3 (HS)
PB1 4 33 PC7 / SS / AIN15
ei2 PC6 / SCK / ICCCLK
PB2 5 32
PB3 6 31 PC5 / MOSI / AIN14
(HS) PB4 7 ei3 30 PC4 / MISO / ICCDATA
AIN0 / PD0 8 29 PC3 (HS) / ICAP1_B
AIN1 / PD1 9 28 PC2 (HS) / ICAP2_B
AIN2 / PD2 10 27 PC1 / OCMP1_B / AIN13
AIN3 / PD3 11 26 NC
AIN4 / PD4 12 ei1 25 NC
13 14 15 16 17 18 19 20 21 22 23 24
OCMP1_A / AIN10 / PF4
BEEP / (HS) PF1
(HS) PF2
VDD_0
VSS_0
AIN5 / PD5
7/191
ST72340, ST72344, ST72345
The RESET configuration of each pin is shown in bold. This configuration is valid as long as the device is
in reset state.
On the chip, each I/O port may have up to 8 pads. Pads that are not bonded to external pins are set in in-
put pull-up configuration after reset through the option byte Package selection. The configuration of these
pads must be kept at reset state to avoid added current consumption.
Table 1. Device Pin Description
Pin n° Level Port
Main
Type
function
LQFP32
LQFP44
LQFP48
Input Output
Output
(after
float
wpu
ana
reset)
OD
PP
int
8/191
ST72340, ST72344, ST72345
Type
function
LQFP32
LQFP44
LQFP48
Input Output
Output
Pin Name Alternate Function
Input
(after
float
wpu
ana
reset)
OD
PP
int
PC3 (HS)/
11 26 29 I/O CT HS X X X X Port C3 Timer B Input Capture 1
ICAP1_B
PC4/MISO/ SPI Master In / ICC Data In-
12 27 30 I/O CT X X X X Port C4
ICCDATA3) Slave Out Data put
PC5/MOSI/ SPI Master Out / ADC Analog
13 28 31 I/O CT X X X X X Port C5
AIN14 Slave In Data Input 14
PC6/SCK/ ICC Clock
14 29 32 I/O CT X X X X Port C6 SPI Serial Clock
ICCCLK3) Output
SPI Slave Select ADC Analog
15 30 33 PC7/SS/AIN15 I/O CT X X X X X Port C7
(active low) Input 15
16 31 34 PA3 (HS) I/O CT HS X ei0 X X Port A3
- 32 35 VDD_1 S Digital Main Supply Voltage
- 33 36 VSS_1 S Digital Ground Voltage
PD7/
- - 37 I/O CT HS X T Port D7 I2C3SNS Serial Clock
SCL3SNS
PD6/
- - 38 I/O CT HS X T Port D6 I2C3SNS Serial Data
SDA3SNS
17 34 39 PA4 (HS) I/O CT HS X X X X Port A4
35 40 PA5 (HS) I/O CT HS X X X X Port A5
18 36 41 PA6 (HS)/SDA I/O CT HS X T Port A6 I2C Serial Data
19 37 42 PA7 (HS)/SCL I/O CT HS X T Port A7 I2C Serial Clock
20 38 43 ICCSEL I ICC Mode selection
21 39 44 RESET I/O CT Top priority non maskable interrupt.
22 40 45 VSS_2 S Digital Ground Voltage
23 41 46 OSC2 O Resonator oscillator inverter output
External clock input or Resonator oscillator in-
24 42 47 OSC1 I
verter input
25 43 48 VDD_2 S Digital Main Supply Voltage
26 44 1 PE0/TDO I/O CT X X X X Port E0 SCI Transmit Data Out
27 1 2 PE1/RDI I/O CT X ei0 X X Port E1 SCI Receive Data In
28 2 3 PB0 I/O CT X ei2 X X Port B0
- 3 4 PB1 I/O CT X ei2 X X Port B1
- 4 5 PB2 I/O CT X ei2 X X Port B2
29 5 6 PB3 I/O CT X ei2 X X Port B3
30 6 7 PB4 (HS) I/O CT HS X ei3 X X Port B4
31 7 8 PD0/AIN0 I/O CT X X X X X Port D0 ADC Analog Input 0
32 8 9 PD1/AIN1 I/O CT X X X X X Port D1 ADC Analog Input 1
- 9 10 PD2/AIN2 I/O CT X X X X X Port D2 ADC Analog Input 2
- 10 11 PD3/AIN3 I/O CT X X X X X Port D3 ADC Analog Input 3
- 11 12 PD4/AIN4 I/O CT X X X X X Port D4 ADC Analog Input 4
12 13 PD5/AIN5 I/O CT X X X X X Port D5 ADC Analog Input 5
9/191
ST72340, ST72344, ST72345
Notes:
1. In the interrupt input column, “eiX” defines the associated external interrupt vector. If the weak pull-up
column (wpu) is merged with the interrupt column (int), then the I/O configuration is pull-up interrupt input,
else the configuration is floating interrupt input.
2. In the open drain output column, “T” defines a true open drain I/O (P-Buffer and protection diode to VDD
are not implemented).
3. On the BGA package, ICCDATA and ICCCLK are bonded on pins E3 and A4 respectively. They are not
implemented as alternate functions on PC4 and PC6.
10/191
ST72340, ST72344, ST72345
0000h 0080h
HW Registers Short Addressing
See Table
007Fh RAM (zero page)
0080h 00FFh
RAM 0100h
(512 or 1K Bytes)
047Fh 256 Bytes Stack
0480h 01FFh
Reserved 0200h
0BFFh 16-bit Addressing
0C00h RAM
Data EEPROM 047Fh
(256 Bytes)
0CFFh
0D00h C000h C000h
Reserved
BFFFh SECTOR 2
C000h 16 KBytes
Program Memory E000h
E000h
(8 or 16 KBytes) SECTOR 1
FFDFh F000h (4k)
FFE0h 8 KBytes or FB00h (2k)
Interrupt & Reset Vectors or FC00h (1k)
or FE00h (0.5k)
See Table 8 SECTOR 0
FFFFh
FFFFh FFFFh
11/191
ST72340, ST72344, ST72345
Register
Address Block Register Name Reset Status Remarks
Label
0012h to
Reserved area (5 bytes)
0016h
001Ah to
DM3) Reserved area (6 bytes)
001Fh
12/191
ST72340, ST72344, ST72345
Register
Address Block Register Name Reset Status Remarks
Label
13/191
ST72340, ST72344, ST72345
Register
Address Block Register Name Reset Status Remarks
Label
0073h to
Reserved area (13 bytes)
007Fh
14/191
ST72340, ST72344, ST72345
4 FLASH PROGRAM MEMORY the device from the application board and
while the application is running.
4.3.1 In-Circuit Programming (ICP)
4.1 Introduction
ICP uses a protocol called ICC (In-Circuit Commu-
The ST7 single voltage extended Flash (XFlash) is nication) which allows an ST7 plugged on a print-
a non-volatile memory that can be electrically ed circuit board (PCB) to communicate with an ex-
erased and programmed either on a byte-by-byte ternal programming device connected via cable.
basis or up to 32 bytes in parallel. ICP is performed in three steps:
The XFlash devices can be programmed off-board Switch the ST7 to ICC mode (In-Circuit Communi-
(plugged in a programming tool) or on-board using cations). This is done by driving a specific signal
In-Circuit Programming or In-Application Program- sequence on the ICCCLK/DATA pins while the
ming. RESET pin is pulled low. When the ST7 enters
The array matrix organisation allows each sector ICC mode, it fetches a specific RESET vector
to be erased and reprogrammed without affecting which points to the ST7 System Memory contain-
other sectors. ing the ICC protocol routine. This routine enables
the ST7 to receive bytes from the ICC interface.
4.2 Main Features – Download ICP Driver code in RAM from the
ICCDATA pin
■ ICP (In-Circuit Programming) – Execute ICP Driver code in RAM to program
■ IAP (In-Application Programming) the FLASH memory
■ ICT (In-Circuit Testing) for downloading and Depending on the ICP Driver code downloaded in
executing user application test patterns in RAM RAM, FLASH memory programming can be fully
■ Sector 0 size configurable by option byte customized (number of bytes to program, program
■ Read-out and write protection locations, or selection of the serial communication
interface for downloading).
4.3 PROGRAMMING MODES 4.3.2 In Application Programming (IAP)
This mode uses an IAP Driver program previously
The ST7 can be programmed in three different programmed in Sector 0 by the user (in ICP
ways: mode).
– Insertion in a programming tool. In this mode,
FLASH sectors 0 and 1, option byte row and This mode is fully controlled by user software. This
data EEPROM (if present) can be pro- allows it to be adapted to the user application, (us-
grammed or erased. er-defined strategy for entering programming
– In-Circuit Programming. In this mode, FLASH mode, choice of communications protocol used to
sectors 0 and 1, option byte row and data fetch the data to be stored etc.)
EEPROM (if present) can be programmed or IAP mode can be used to program any memory ar-
erased without removing the device from the eas except Sector 0, which is write/erase protect-
application board.
ed to allow recovery in case errors occur during
– In-Application Programming. In this mode,
sector 1 and data EEPROM (if present) can the programming operation.
be programmed or erased without removing
15/191
ST72340, ST72344, ST72345
4.4 ICC interface 2. During the ICP session, the programming tool
must control the RESET pin. This can lead to con-
ICP needs a minimum of 4 and up to 7 pins to be flicts between the programming tool and the appli-
connected to the programming tool. These pins cation reset circuit if it drives more than 5mA at
are: high level (push pull output or pull-up resistor<1K).
– RESET: device reset A schottky diode can be used to isolate the appli-
– VSS: device power supply ground cation RESET circuit in this case. When using a
– ICCCLK: ICC output serial clock pin classical RC network with R>1K or a reset man-
– ICCDATA: ICC input serial data pin agement IC with open drain output and pull-up re-
– ICCSEL: ICC selection sistor>1K, no additional components are needed.
In all cases the user must ensure that no external
– OSC1: main clock input for external source
(not required on devices without OSC1/OSC2 reset is generated by the application during the
pins) ICC session.
– VDD: application board power supply (option- 3. The use of Pin 7 of the ICC connector depends
al, see Note 3) on the Programming Tool architecture. This pin
Notes: must be connected when using most ST Program-
1. If the ICCCLK or ICCDATA pins are only used ming Tools (it is used to monitor the application
as outputs in the application, no signal isolation is power supply). Please refer to the Programming
necessary. As soon as the Programming Tool is Tool manual.
plugged to the board, even if an ICC session is not 4. Pin 9 has to be connected to the OSC1 pin of
in progress, the ICCCLK and ICCDATA pins are the ST7 when the clock is not available in the ap-
not available for the application. If they are used as plication or if the selected clock option is not pro-
inputs by the application, isolation such as a serial grammed in the option byte. ST7 devices with mul-
resistor has to be implemented in case another de- ti-oscillator capability need to have OSC2 ground-
vice forces the signal. Refer to the Programming ed in this case.
Tool documentation for recommended resistor val-
ues.
ICC CONNECTOR
ICC Cable
ICC CONNECTOR
(See Note 3) HE10 CONNECTOR TYPE
10 8 6 4 2
APPLICATION
RESET SOURCE
See Note 2
10kΩ
ICCSEL
RESET
ICCCLK
ICCDATA
OSC1
OSC2
ST7
16/191
ST72340, ST72344, ST72345
4.5 Memory Protection vent any change being made to the memory con-
tent.
There are two different types of memory protec-
tion: Read Out Protection and Write/Erase Protec- Warning: Once set, Write/erase protection can
tion which can be applied individually. never be removed. A write-protected flash device
is no longer reprogrammable.
4.5.1 Read out Protection
Write/erase protection is enabled through the
Readout protection, when selected provides a pro- FMP_W bit in the option byte.
tection against program memory content extrac-
tion and against write access to Flash memory.
Even if no protection can be considered as totally 4.6 Register Description
unbreakable, the feature provides a very high level FLASH CONTROL/STATUS REGISTER (FCSR)
of protection for a general purpose microcontroller. Read/Write
Both program and data E2 memory are protected. Reset Value: 000 0000 (00h)
In flash devices, this protection is removed by re- 1st RASS Key: 0101 0110 (56h)
programming the option. In this case, both pro- 2nd RASS Key: 1010 1110 (AEh)
gram and data E2 memory are automatically
erased, and the device can be reprogrammed. 7 0
Read-out protection selection depends on the de-
vice type: 0 0 0 0 0 OPT LAT PGM
17/191
ST72340, ST72344, ST72345
5 DATA EEPROM
HIGH VOLTAGE
PUMP
EEPROM
ADDRESS 4 ROW
MEMORY MATRIX
DECODER DECODER
(1 ROW = 32 x 8 BITS)
128 128
4 DATA 32 x 8 BITS
MULTIPLEXER DATA LATCHES
18/191
ST72340, ST72344, ST72345
5.3 MEMORY ACCESS the value is latched inside the 32 data latches ac-
cording to its address.
The Data EEPROM memory read/write access
modes are controlled by the E2LAT bit of the EEP- When E2PGM bit is set by the software, all the
ROM Control/Status register (EECSR). The flow- previous bytes written in the data latches (up to
chart in Figure 8 describes these different memory 32) are programmed in the EEPROM cells. The ef-
access modes. fective high address (row) is determined by the
last EEPROM write sequence. To avoid wrong
Read Operation (E2LAT = 0) programming, the user must take care that all the
The EEPROM can be read as a normal ROM loca- bytes written between two programming sequenc-
tion when the E2LAT bit of the EECSR register is es have the same high address: only the five Least
cleared. Significant Bits of the address can change.
On this device, Data EEPROM can also be used to The programming cycle is fully completed when
execute machine code. Take care not to write to the E2PGM bit is cleared.
the Data EEPROM while executing from it. This Note: Care should be taken during the program-
would result in an unexpected code being execut- ming cycle. Writing to the same memory location
ed. will over-program the memory (logical AND be-
tween the two write access data result) because
Write Operation (E2LAT = 1) the data latches are only cleared at the end of the
To access the write mode, the E2LAT bit has to be programming cycle and by the falling edge of the
set by software (the E2PGM bit remains cleared). E2LAT bit.
When a write access to the EEPROM area occurs, It is not possible to read the latched data.
This note is illustrated by the Figure 10.
Figure 8. Data EEPROM Programming Flowchart
WRITE UP TO 32 BYTES
READ BYTES
IN EEPROM AREA
IN EEPROM AREA
(with the same 11 MSB of the address)
0 E2PGM 1
CLEARED BY HARDWARE
19/191
ST72340, ST72344, ST72345
ROW 0 00h...1Fh
DEFINITION 1 20h...3Fh
...
N Nx20h...Nx20h+1Fh
PHASE 1 PHASE 2
Writing data latches Waiting E2PGM and E2LAT to fall
E2LAT bit
Set by USER application Cleared by hardware
E2PGM bit
Note: If a programming cycle is interrupted (by RESET action), the integrity of the data in memory will not
be guaranteed.
20/191
ST72340, ST72344, ST72345
E2LAT
E2PGM
21/191
ST72340, ST72344, ST72345
7 0
0 0 0 0 0 0 E2LAT E2PGM
22/191
ST72340, ST72344, ST72345
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
23/191
ST72340, ST72344, ST72345
15 PCH 8 7 PCL 0
PROGRAM COUNTER
RESET VALUE = RESET VECTOR @ FFFEh-FFFFh
7 0
1 1 I1 H I0 N Z C CONDITION CODE REGISTER
RESET VALUE = 1 1 1 X 1 X X X
15 8 7 0
STACK POINTER
RESET VALUE = STACK HIGHER ADDRESS
X = Undefined Value
24/191
ST72340, ST72344, ST72345
25/191
ST72340, ST72344, ST72345
@ 0100h
SP
SP SP
Y
CC CC CC
A A A
X X X
PCH PCH PCH
SP SP
PCL PCL PCL
PCH PCH PCH PCH PCH
SP
@ 01FFh PCL PCL PCL PCL PCL
26/191
ST72340, ST72344, ST72345
Tunable
RC Oscillator External Clock (0.5-8MHz)
RC Clock (1MHz.)
1MHz
8MHz fOSC2
/2 PLL 1MHz --> 8MHz
/2
DIVIDER PLL 1MHz --> 4MHz 4MHz DIVIDER* PLL Clock 8/4MHz
27/191
ST72340, ST72344, ST72345
7.1 PHASE LOCKED LOOP When the PLL is started, after reset or wakeup
from Halt mode or AWUFH mode, it outputs the
The PLL can be used to multiply a 1MHz frequen- clock after a delay of tSTARTUP.
cy from the RC oscillator or the external clock by 4
or 8 to obtain fOSC of 4 or 8 MHz. The PLL is ena- When the PLL output signal reaches the operating
bled and the multiplication factor of 4 or 8 is select- frequency, the LOCKED bit in the SICSCR register
ed by 3 option bits. Refer to Table 4 for the PLL is set. Full PLL accuracy (ACCPLL) is reached after
configuration depending on the required frequency a stabilization time of tSTAB (see Figure 14 )
and the application voltage. Refer to Section 15.1 Refer to Section 7.5.4 on page 35 for a description
for the option byte description. of the LOCKED bit in the SICSR register.
Table 4. PLL Configurations Caution: The PLL is not recommended for appli-
cations where timing accuracy is required.
Target Ratio VDD PLL Ratio DIV2
x41) 2.7V - 3.65V x4 OFF
x4 x8 ON
3.3V - 5.5V
x8 x8 OFF
1) For a target ratio of x4 between 3.3V - 3.65V,
this is the recommended configuration.
Figure 14. PLL Output Frequency Timing
Diagram
LOCKED bit set
4/8 x
input
freq.
tSTAB
Output freq.
tLOCK
tSTARTUP
28/191
ST72340, ST72344, ST72345
External Clock
OSC1 OSC2
Caution: The OSC1 and/or OSC2 pins must not
be left unconnected. For the purposes of Failure
Mode and Effect Analysis, it should be noted that if
the OSC1 and/or OSC2 pins are left unconnected,
EXTERNAL
the ST7 main oscillator may start and, in this con- SOURCE
figuration, could generate an fOSC clock frequency
in excess of the allowed maximum (>16MHz.),
putting the ST7 in an unsafe/undefined state. The
Crystal/Ceramic Resonators
29/191
ST72340, ST72344, ST72345
MULTI-OSCILLATOR (Cont’d)
Internal RC Oscillator 7.3 REGISTER DESCRIPTION
The device contains a high-precision internal RC
RC CONTROL REGISTER (RCCRH)
oscillator. It must be calibrated to obtain the fre-
Read / Write
quency required in the application. This is done by
Reset Value: 1111 1111 (FFh)
software writing a calibration value in the RCCRH
and RCCRL Registers.
7 0
Whenever the microcontroller is reset, the RCCR
returns to its default value (FF 03h), i.e. each time
the device is reset, the calibration value must be CR9 CR8 CR7 CR6 CR5 CR4 CR3 CR2
loaded in the RCCRH and RCCRL registers. Pre-
defined calibration values are stored in XFLASH
for 3 and 5V VDD supply voltages at 25°C, as Bits 7:0 = CR[9:2] RC Oscillator Frequency Ad-
shown in the following table. justment Bits
RCCR Conditions Address
VDD=5V RC CONTROL REGISTER (RCCRL)
RCCR0 TA=25°C BEE0, BEE1 Read / Write
fRC=1MHz Reset Value: 0000 0011 (03h)
VDD=3V
RCCR1 TA=25°C BEE4, BEE5 7 0
fRC=1MHz
0 0 0 0 0 0 CR1 CR0
Note:
– To improve clock stability, it is recommended to
place a decoupling capacitor between the VDD Bits 7:2 = Reserved, must be kept cleared.
and VSS pins.
Bits 1:0 = CR[1:0] RC Oscillator Frequency Ad-
– These two 10-bit values are systematically pro- justment Bits
grammed by ST, including on FASTROM devic- This 10-bit value must be written immediately after
es. Consequently, customers intending to use reset to adjust the RC oscillator frequency in order
FASTROM service must not use these address- to obtain the specified accuracy. The application
es. can store the correct value for each voltage range
– RCCR0 and RCCR1 calibration values will be in EEPROM and write it to this register at start-up.
erased if the read-out protection bit is reset after 0000h = maximum available frequency
it has been set. See “Memory Protection” on 03FFh = lowest available frequency
page 17. Note: To tune the oscillator, write a series of differ-
Caution: If the voltage or temperature conditions ent values in the register until the correct frequen-
change in the application, the frequency may need cy is reached. The fastest method is to use a di-
to be recalibrated. chotomy starting with 200h.
Refer to application note AN1324 for information
on how to calibrate the RC frequency using an ex-
ternal reference signal.
30/191
ST72340, ST72344, ST72345
VDD
RON
Filter INTERNAL
RESET
RESET
WATCHDOG RESET
PULSE
ILLEGAL OPCODE RESET 1)
GENERATOR
LVD RESET
Note 1: See “Illegal Opcode Reset” on page 149. for more details on illegal opcode reset conditions.
31/191
ST72340, ST72344, ST72345
VIT+(LVD)
VIT-(LVD)
tw(RSTL)out tw(RSTL)out
DELAY
EXTERNAL
RESET
SOURCE
RESET PIN
WATCHDOG
RESET
WATCHDOG UNDERFLOW
32/191
ST72340, ST72344, ST72345
VDD
Vhys
VIT+(LVD)
VIT-((LVD)
RESET
33/191
ST72340, ST72344, ST72345
VDD
Early Warning Interrupt
(Power has dropped, MCU not
not yet in reset)
Vhys
VIT+(AVD)
VIT-(AVD)
VIT-(LVD)
AVD INTERRUPT
REQUEST
IF AVDIE bit = 1
INTERRUPT PROCESS
LVD RESET
34/191
ST72340, ST72344, ST72345
35/191
ST72340, ST72344, ST72345
8 INTERRUPTS
PENDING Y Y
RESET TRAP
INTERRUPT
Y
“IRET”
36/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
Servicing Pending Interrupts registers (except for RESET), the corresponding
As several interrupts can be pending at the same vector is loaded in the PC register and the I1 and
time, the interrupt to be taken into account is deter- I0 bits of the CC are set to disable interrupts (level
mined by the following two-step process: 3). These sources allow the processor to exit
HALT mode.
– the highest software priority interrupt is serviced,
■ TRAP (Non Maskable Software Interrupt)
– if several interrupts have the same software pri-
This software interrupt is serviced when the TRAP
ority then the interrupt with the highest hardware
instruction is executed. It will be serviced accord-
priority is serviced first.
ing to the flowchart in Figure 20.
Figure 21 describes this decision process. ■ RESET
Figure 21. Priority Decision Process The RESET source has the highest priority in the
ST7. This means that the first current routine has
PENDING
the highest software priority (level 3) and the high-
INTERRUPTS
est hardware priority.
See the RESET chapter for more details.
Maskable Sources
Same Different
SOFTWARE Maskable interrupt vector sources can be serviced
PRIORITY if the corresponding interrupt is enabled and if its
own interrupt software priority (in ISPRx registers)
is higher than the one currently being serviced (I1
HIGHEST SOFTWARE and I0 in CC register). If any of these two condi-
PRIORITY SERVICED tions is false, the interrupt is latched and thus re-
mains pending.
HIGHEST HARDWARE ■ External Interrupts
PRIORITY SERVICED
External interrupts allow the processor to exit from
HALT low power mode. External interrupt sensitiv-
When an interrupt request is not serviced immedi- ity is software selectable through the External In-
ately, it is latched and then processed when its terrupt Control register (EICR).
software priority combined with the hardware pri- External interrupt triggered on edge will be latched
ority becomes the highest one. and the interrupt request automatically cleared
upon entering the interrupt service routine.
Notes: If several input pins of a group connected to the
1. The hardware priority is exclusive while the soft- same interrupt line are selected simultaneously,
ware one is not. This allows the previous process these will be logically ORed.
to succeed with only one interrupt. ■ Peripheral Interrupts
2. TLI, RESET and TRAP can be considered as
having the highest software priority in the decision Usually the peripheral interrupts cause the MCU to
process. exit from HALT mode except those mentioned in
the “Interrupt Mapping” table. A peripheral inter-
Different Interrupt Vector Sources rupt occurs when a specific flag is set in the pe-
ripheral status registers and if the corresponding
Two interrupt source types are managed by the
enable bit is set in the peripheral control register.
ST7 interrupt controller: the non-maskable type
The general sequence for clearing an interrupt is
(RESET, TRAP) and the maskable type (external
based on an access to the status register followed
or from internal peripherals).
by a read or write to an associated register.
Non-Maskable Sources Note: The clearing sequence resets the internal
latch. A pending interrupt (i.e. waiting for being
These sources are processed regardless of the serviced) will therefore be lost if the clear se-
state of the I1 and I0 bits of the CC register (see quence is executed.
Figure 20). After stacking the PC, X, A and CC
37/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
8.3 INTERRUPTS AND LOW POWER MODES 8.4 CONCURRENT & NESTED MANAGEMENT
All interrupts allow the processor to exit the WAIT The following Figure 22 and Figure 23 show two
low power mode. On the contrary, only external different interrupt management modes. The first is
and other specified interrupts allow the processor called concurrent mode and does not allow an in-
to exit from the HALT modes (see column “Exit terrupt to be interrupted, unlike the nested mode in
from HALT” in “Interrupt Mapping” table). When Figure 23. The interrupt hardware priority is given
several pending interrupts are present while exit- in this order from the lowest to the highest: MAIN,
ing HALT mode, the first one serviced can only be IT4, IT3, IT2, IT1, IT0, TLI. The software priority is
an interrupt with exit from HALT mode capability given for each interrupt.
and it is selected through the same decision proc- Warning: A stack overflow may occur without no-
ess shown in Figure 21. tifying the software of the failure.
Note: If an interrupt, that is not able to Exit from
HALT mode, is pending with the highest priority
when exiting HALT mode, this interrupt is serviced
after the first one serviced.
Figure 22. Concurrent Interrupt Management
TRAP
SOFTWARE
I1 I0
IT2
IT1
IT4
IT3
IT0
PRIORITY
LEVEL
HARDWARE PRIORITY
SOFTWARE
I1 I0
IT0
IT2
IT1
IT4
IT3
PRIORITY
LEVEL
USED STACK = 20 BYTES
HARDWARE PRIORITY
TRAP 3 1 1
IT0 3 1 1
IT1 IT1 2 0 0
IT2 IT2 1 0 1
IT3 3 1 1
RIM
IT4 IT4 3 1 1
MAIN MAIN 3/0
11 / 10 10
38/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
39/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
Table 7. Dedicated Interrupt Instruction Set
Instruction New Description Function/Example I1 H I0 N Z C
HALT Entering Halt mode 1 0
IRET Interrupt routine return Pop CC, A, X, PC I1 H I0 N Z C
JRM Jump if I1:0=11 (level 3) I1:0=11 ?
JRNM Jump if I1:0<>11 I1:0<>11 ?
POP CC Pop CC from the Stack Mem => CC I1 H I0 N Z C
RIM Enable interrupt (level 0 set) Load 10 in I1:0 of CC 1 0
SIM Disable interrupt (level 3 set) Load 11 in I1:0 of CC 1 1
TRAP Software trap Software NMI 1 1
WFI Wait for interrupt 1 0
Note: During the execution of an interrupt routine, the HALT, POPCC, RIM, SIM and WFI instructions change the current
software priority up to the next IRET instruction or one of the previously mentioned instructions.
Notes:
1. Valid for HALT and ACTIVE-HALT modes except for the MCC/RTC interrupt source which exits from
ACTIVE-HALT mode only and AWU interrupt which exits from AWUFH mode only.
2. Exit from HALT possible when SPI is in slave mode.
40/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
IS20 IS21
PAOR.3
PADDR.3 PA3
SENSITIVITY ei0 INTERRUPT SOURCE
PA3
CONTROL PE1
IPA BIT
IS20 IS21
PFOR.2
PFDDR.2
SENSITIVITY PF2
PF2 PF1 ei1 INTERRUPT SOURCE
CONTROL
PF0
IS10 IS11
PBOR.3
PBDDR.3
SENSITIVITY PB3
PB3 ei2 INTERRUPT SOURCE
CONTROL PB2
PB1
PB0
IPB BIT
IS10 IS11
PBOR.4
PBDDR.4 ei3 INTERRUPT SOURCE
SENSITIVITY PB4
PB4 CONTROL
41/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
42/191
ST72340, ST72344, ST72345
INTERRUPTS (Cont’d)
Table 9. Nested Interrupts Register Map and Reset Values
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
ei1 ei0 MCC + SI AWU
0024h ISPR0 I1_3 I0_3 I1_2 I0_2 I1_1 I0_1 I1_0 I0_0
Reset Value 1 1 1 1 1 1 1 1
I2C3SNS I2C3SNS ei3 ei2
0025h ISPR1 I1_7 I0_7 I1_6 I0_6 I1_5 I0_5 I1_4 I0_4
Reset Value 1 1 1 1 1 1 1 1
SCI TIMER B TIMER A SPI
0026h ISPR2 I1_11 I0_11 I1_10 I0_10 I1_9 I0_9 I1_8 I0_8
Reset Value 1 1 1 1 1 1 1 1
I2C AVD
0027h ISPR3 I1_13 I0_13 I1_12 I0_12
Reset Value 1 1 1 1 1 1 1 1
EICR IS11 IS10 IPB IS21 IS20 IPA
0028h
Reset Value 0 0 0 0 0 0 0 0
43/191
ST72340, ST72344, ST72345
High
MCCSR
CP1:0 00 01
RUN SMS
SLOW WAIT
ACTIVE HALT
HALT
Low
POWER CONSUMPTION
44/191
ST72340, ST72344, ST72345
OSCILLATOR ON
PERIPHERALS ON
CPU ON
I[1:0] BITS XX 1)
Note:
1. Before servicing an interrupt, the CC register is
pushed on the stack. The I[1:0] bits of the CC reg-
ister are set to the current software priority level of
the interrupt routine and recovered when the CC
register is popped.
45/191
ST72340, ST72344, ST72345
46/191
ST72340, ST72344, ST72345
47/191
ST72340, ST72344, ST72345
N
RESET
N Y
INTERRUPT 3)
OSCILLATOR ON
Y PERIPHERALS OFF
CPU ON
I[1:0] BITS XX 4)
OSCILLATOR ON
PERIPHERALS ON
CPU ON
I[1:0] BITS XX 4)
48/191
ST72340, ST72344, ST72345
9.6 AUTO WAKE UP FROM HALT MODE it. After this start-up delay, the CPU resumes oper-
ation by servicing the AWUFH interrupt. The AWU
Auto Wake Up From Halt (AWUFH) mode is simi- flag and its associated interrupt are cleared by
lar to Halt mode with the addition of an internal RC software reading the AWUCSR register.
oscillator for wake-up. Compared to ACTIVE-
HALT mode, AWUFH has lower power consump- To compensate for any frequency dispersion of
tion because the main clock is not kept running, the AWU RC oscillator, it can be calibrated by
but there is no accurate realtime clock available. measuring the clock frequency fAWU_RC and then
calculating the right prescaler value. Measurement
It is entered by executing the HALT instruction mode is enabled by setting the AWUM bit in the
when the AWUEN bit in the AWUCSR register has AWUCSR register in Run mode. This connects in-
been set and the OIE bit in the MCCSR register is ternally fAWU_RC to the ICAP2 input of the 16-bit
cleared (see Section 11.2 on page 65 for more de- timer A, allowing the fAWU_RC to be measured us-
tails). ing the main oscillator clock as a reference time-
base.
Figure 32. AWUFH Mode Block Diagram
Similarities with Halt mode
AWU RC The following AWUFH mode behaviour is the
oscillator same as normal Halt mode:
to Timer input capture – The MCU can exit AWUFH mode by means of
fAWU_RC any interrupt with exit from Halt capability or a re-
set (see Section 9.4 "HALT MODE" on page 46).
– When entering AWUFH mode, the I[1:0] bits in
AWUFH the CC register are forced to 10b to enable inter-
AWUFH interrupt rupts. Therefore, if an interrupt is pending, the
/64 prescaler MCU wakes up immediately.
divider
/1 .. 255 – In AWUFH mode, the main oscillator is turned off
causing all internal processing to be stopped, in-
cluding the operation of the on-chip peripherals.
None of the peripherals are clocked except those
As soon as HALT mode is entered, and if the
which get their clock supply from another clock
AWUEN bit has been set in the AWUCSR register,
generator (such as an external or auxiliary oscil-
the AWU RC oscillator provides a clock signal
lator like the AWU oscillator).
(fAWU_RC). Its frequency is divided by a fixed divid-
er and a programmable prescaler controlled by the – The compatibility of Watchdog operation with
AWUPR register. The output of this prescaler pro- AWUFH mode is configured by the WDGHALT
vides the delay time. When the delay has elapsed option bit in the option byte. Depending on this
the AWUF flag is set by hardware and an interrupt setting, the HALT instruction when executed
wakes-up the MCU from Halt mode. At the same while the Watchdog system is enabled, can gen-
time the main oscillator is immediately turned on erate a Watchdog RESET.
and a 256 or 4096 cycle delay is used to stabilize
Figure 33. AWUF Halt Timing Diagram
tAWU
fCPU
fAWU_RC
Clear
by software
AWUFH interrupt
49/191
ST72340, ST72344, ST72345
N
RESET
N Y
INTERRUPT 3)
AWU RC OSC OFF
Y MAIN OSC ON
PERIPHERALS OFF
CPU ON
I[1:0] BITS XX 4)
50/191
ST72340, ST72344, ST72345
51/191
ST72340, ST72344, ST72345
10 I/O PORTS
52/191
ST72340, ST72344, ST72345
ALTERNATE
REGISTER 1
OUTPUT VDD P-BUFFER
ACCESS
(see table below)
0
ALTERNATE PULL-UP
ENABLE (see table below)
DR VDD
DDR
PULL-UP
PAD
CONDITION
OR
DATA BUS
If implemented
OR SEL
N-BUFFER
DIODES
(see table below)
DDR SEL
ANALOG
INPUT
CMOS
SCHMITT
DR SEL
1 TRIGGER
0
ALTERNATE
INPUT
EXTERNAL
INTERRUPT
SOURCE (eix)
Legend: NI - not implemented Note: The diode to VDD is not implemented in the
Off - implemented not activated true open drain pads. A local protection between
On - implemented and activated the pad and VSS is implemented to protect the de-
vice against positive stress.
53/191
ST72340, ST72344, ST72345
ALTERNATE INPUT
EXTERNAL INTERRUPT
SOURCE (eix)
INTERRUPT
CONDITION
ANALOG INPUT
I/O PORTS
RPU
DR R/W
REGISTER DATA BUS
PAD
ALTERNATE ALTERNATE
ENABLE OUTPUT
I/O PORTS
RPU
DR R/W
REGISTER DATA BUS
PAD
ALTERNATE ALTERNATE
ENABLE OUTPUT
Notes:
1. When the I/O port is in input configuration and the associated alternate function is enabled as an output,
reading the DR register will read the alternate function output status.
2. When the I/O port is in output configuration and the associated alternate function is enabled as an input,
the alternate function reads the pin status given by the DR register content.
54/191
ST72340, ST72344, ST72345
55/191
ST72340, ST72344, ST72345
MODE DDR OR
floating input 0 0
pull-up interrupt input 0 1
open drain output 1 0
push-pull output 1 1
56/191
ST72340, ST72344, ST72345
57/191
ST72340, ST72344, ST72345
11 ON-CHIP PERIPHERALS
- W6 W5 W4 W3 W2 W1 W0
comparator
= 1 when
T6:0 > W6:0 CMP
Write WDGCR
WDGA T6 T5 T4 T3 T2 T1 T0
fOSC2
DIV 64
WDG PRESCALER
DIV 4
12-BIT MCC
RTC COUNTER
MSB LSB TB[1:0] bits
(MCCSR
11 6 5 0
Register)
58/191
ST72340, ST72344, ST72345
59/191
ST72340, ST72344, ST72345
3F
38
30
28
CNT Value (hex.)
20
18
10
08
00
1.5 18 34 50 65 82 98 114 128
Watchdog timeout (ms) @ 8 MHz fOSC2
60/191
ST72340, ST72344, ST72345
IF CNT ≤ MSB
------------- THEN t max = t max0 + 16384 × CNT × t osc2
4
Note: In the above formulae, division results must be rounded down to the next integer value.
Example:
With 2ms timeout selected in MCCSR register
Min. Watchdog Max. Watchdog
Value of T[5:0] Bits in
Timeout (ms) Timeout (ms)
WDGCR Register (Hex.)
tmin tmax
00 1.496 2.048
3F 128 128.552
61/191
ST72340, ST72344, ST72345
WDGWR
3Fh
time
Refresh not allowed Refresh Window (step = 16384/fOSC2)
T6 bit
Reset
11.1.7 Hardware Watchdog Option 11.1.8 Using Halt Mode with the WDG
If Hardware Watchdog is selected by option byte, (WDGHALT option)
the watchdog is always active and the WDGA bit in The following recommendation applies if Halt
the WDGCR is not used. Refer to the Option Byte mode is used when the watchdog is enabled.
description. – Before executing the HALT instruction, refresh
the WDG counter, to avoid an unexpected WDG
reset immediately after waking up the microcon-
troller.
62/191
ST72340, ST72344, ST72345
63/191
ST72340, ST72344, ST72345
WINDOW WATCHDOG(Cont’d)
Table 15. Watchdog Timer Register Map and Reset Values
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
WDGCR WDGA T6 T5 T4 T3 T2 T1 T0
2A
Reset Value 0 1 1 1 1 1 1 1
WDGWR - W6 W5 W4 W3 W2 W1 W0
30
Reset Value 0 1 1 1 1 1 1 1
64/191
ST72340, ST72344, ST72345
11.2 MAIN CLOCK CONTROLLER WITH REAL TIME CLOCK AND BEEPER (MCC/RTC)
The Main Clock Controller consists of three differ- external devices. It is controlled by the MCO bit in
ent functions: the MCCSR register.
■ a programmable CPU clock prescaler CAUTION: When selected, the clock out pin sus-
■ a clock-out signal to supply external devices
pends the clock during ACTIVE-HALT mode.
■ a real time clock timer with interrupt capability
11.2.3 Real Time Clock Timer (RTC)
Each function can be used independently and si- The counter of the real time clock timer allows an
multaneously. interrupt to be generated based on an accurate
real time clock. Four different time bases depend-
11.2.1 Programmable CPU Clock Prescaler ing directly on fOSC2 are available. The whole
The programmable CPU clock prescaler supplies functionality is controlled by four bits of the MCC-
the clock for the ST7 CPU and its internal periph- SR register: TB[1:0], OIE and OIF.
erals. It manages SLOW power saving mode (See When the RTC interrupt is enabled (OIE bit set),
Section 9.2 "SLOW MODE" on page 44 for more the ST7 enters ACTIVE-HALT mode when the
details). HALT instruction is executed. See Section 9.5
The prescaler selects the fCPU main clock frequen- "ACTIVE-HALT MODE" on page 47 for more de-
cy and is controlled by three bits in the MCCSR tails.
register: CP[1:0] and SMS. 11.2.4 Beeper
11.2.2 Clock-out Capability The beep function is controlled by the MCCBCR
The clock-out capability is an alternate function of register. It can output three selectable frequencies
an I/O port pin that outputs a fOSC2 clock to drive on the BEEP pin (I/O port alternate function).
BC1 BC0
MCCBCR
BEEP
BEEP SIGNAL
SELECTION
MCO
65/191
ST72340, ST72344, ST72345
66/191
ST72340, ST72344, ST72345
0 0 Off
0 1 ~2-KHz
Output
1 0 ~1-KHz Beep signal
~50% duty cycle
1 1 ~500-Hz
67/191
ST72340, ST72344, ST72345
68/191
ST72340, ST72344, ST72345
INTERNAL BUS
fCPU
16-BIT TIMER PERIPHERAL INTERFACE
8 high 8 low
8-bit 8 8 8 8 8 8 8 8
buffer
high
high
high
high
low
low
low
low
EXEDG
16
OVERFLOW
OUTPUT COMPARE EDGE DETECT ICAP1
DETECT
CIRCUIT CIRCUIT1 pin
CIRCUIT
LATCH1 OCMP1
pin
ICF1 OCF1 TOF ICF2 OCF2 TIMD 0 0
(Control/Status Register) LATCH2 OCMP2
CSR pin
ICIE OCIE TOIE FOLV2 FOLV1 OLVL2 IEDG1 OLVL1 OC1E OC2E OPM PWM CC1 CC0 IEDG2 EXEDG
(See note)
TIMER INTERRUPT Note: If IC, OC and TO interrupt requests have separate vectors
then the last OR is not present (See Device Interrupt Vector Table)
69/191
ST72340, ST72344, ST72345
70/191
ST72340, ST72344, ST72345
CPU CLOCK
INTERNAL RESET
TIMER CLOCK
CPU CLOCK
INTERNAL RESET
TIMER CLOCK
CPU CLOCK
INTERNAL RESET
TIMER CLOCK
Note: The Device is in reset state when the internal reset signal is high, when it is low the Device is run-
ning.
71/191
ST72340, ST72344, ST72345
72/191
ST72340, ST72344, ST72345
TIMER CLOCK
ICAPi PIN
ICAPi FLAG
73/191
ST72340, ST72344, ST72345
74/191
ST72340, ST72344, ST72345
75/191
ST72340, ST72344, ST72345
TIMER CLOCK
TIMER CLOCK
76/191
ST72340, ST72344, ST72345
77/191
ST72340, ST72344, ST72345
ICAP1
COUNTER 34E2 FFFC FFFD FFFE 2ED0 2ED1 2ED2 34E2 FFFC
78/191
ST72340, ST72344, ST72345
79/191
ST72340, ST72344, ST72345
11.3.5 Interrupts
Enable Exit Exit
Event
Interrupt Event Control from from
Flag
Bit Wait Halt
Input Capture 1 event/Counter reset in PWM mode ICF1 Yes No
ICIE
Input Capture 2 event ICF2 Yes No
Output Compare 1 event (not available in PWM mode) OCF1 Yes No
OCIE
Output Compare 2 event (not available in PWM mode) OCF2 Yes No
Timer Overflow event TOF TOIE Yes No
Note: The 16-bit Timer interrupt events are connected to the same interrupt vector (see Interrupts chap-
ter). These events generate an interrupt if the corresponding Enable Control Bit is set and the interrupt
mask in the CC register is reset (RIM instruction).
80/191
ST72340, ST72344, ST72345
81/191
ST72340, ST72344, ST72345
82/191
ST72340, ST72344, ST72345
83/191
ST72340, ST72344, ST72345
84/191
ST72340, ST72344, ST72345
MSB LSB
85/191
ST72340, ST72344, ST72345
86/191
ST72340, ST72344, ST72345
87/191
ST72340, ST72344, ST72345
Data/Address Bus
SPIDR Read
Interrupt
request
Read Buffer
MOSI
7 SPICSR 0
MISO 8-Bit Shift Register
SPIF WCOL OVR MODF 0 SOD SSM SSI
Write
SOD
bit 1
SS
SPI 0
SCK STATE
CONTROL
7 SPICR 0
SERIAL CLOCK
GENERATOR
SS
88/191
ST72340, ST72344, ST72345
MASTER SLAVE
MSBit LSBit MSBit LSBit
MISO MISO
8-BIT SHIFT REGISTER 8-BIT SHIFT REGISTER
MOSI MOSI
SPI
SCK SCK
CLOCK
GENERATOR
SS SS
+5V
Not used if SS is managed
by software
89/191
ST72340, ST72344, ST72345
Master SS
Slave SS
(if CPHA = 0)
Slave SS
(if CPHA = 1)
SSM bit
SSI bit 1
SS internal
SS external pin 0
90/191
ST72340, ST72344, ST72345
91/191
ST72340, ST72344, ST72345
SCK
(CPOL = 1)
SCK
(CPOL = 0)
SS
(to slave)
CAPTURE STROBE
CPHA = 0
SCK
(CPOL = 1)
SCK
(CPOL = 0)
SS
(to slave)
CAPTURE STROBE
Note: This figure should not be used as a replacement for parametric information.
Refer to the Electrical Characteristics chapter.
92/191
ST72340, ST72344, ST72345
Figure 58. Clearing the WCOL Bit (Write Collision Flag) Software Sequence
Clearing sequence after SPIF = 1 (end of a data byte transfer)
Read SPICSR
1st Step
RESULT
2nd Step SPIF = 0
Read SPIDR WCOL = 0
Read SPICSR
1st Step
RESULT Note: Writing to the SPIDR regis-
ter instead of reading it does not
2nd Step Read SPIDR WCOL = 0 reset the WCOL bit
93/191
ST72340, ST72344, ST72345
SS SS SS SS
SCK SCK SCK SCK
Slave Slave Slave Slave
Device Device Device Device
MOSI MISO
SCK
Ports
Master
Device
5V SS
94/191
ST72340, ST72344, ST72345
95/191
ST72340, ST72344, ST72345
96/191
ST72340, ST72344, ST72345
Bit 7 = SPIF Serial Peripheral Data Transfer Flag Bit 1 = SSM SS Management
(Read only) This bit is set and cleared by software. When set, it
This bit is set by hardware when a transfer has disables the alternate function of the SPI SS pin
been completed. An interrupt is generated if and uses the SSI bit value instead. See Section
SPIE = 1 in the SPICR register. It is cleared by 0.1.3.2 Slave Select Management.
a software sequence (an access to the SPICSR 0: Hardware management (SS managed by exter-
register followed by a write or a read to the nal pin)
SPIDR register). 1: Software management (internal SS signal con-
0: Data transfer is in progress or the flag has been trolled by SSI bit. External SS pin free for gener-
cleared. al-purpose I/O)
1: Data transfer between the device and an exter-
nal device has been completed.
Note: While the SPIF bit is set, all writes to the Bit 0 = SSI SS Internal Mode
SPIDR register are inhibited until the SPICSR reg- This bit is set and cleared by software. It acts as a
ister is read. ‘chip select’ by controlling the level of the SS slave
select signal when the SSM bit is set.
0: Slave selected
Bit 6 = WCOL Write Collision status (Read only) 1: Slave deselected
This bit is set by hardware when a write to the
SPIDR register is done during a transmit se- SPI DATA I/O REGISTER (SPIDR)
quence. It is cleared by a software sequence (see Read/Write
Figure 6). Reset Value: Undefined
0: No write collision occurred
1: A write collision has been detected 7 0
97/191
ST72340, ST72344, ST72345
98/191
ST72340, ST72344, ST72345
99/191
ST72340, ST72344, ST72345
TDO
RDI
WAKE
TRANSMIT UP RECEIVER RECEIVER
CONTROL UNIT CONTROL CLOCK
SCICR2 SCISR
TIE TCIE RIE ILIE TE RE RWU SBK TDRE TC RDRF IDLE OR NF FE PE
SCI
INTERRUPT
CONTROL
TRANSMITTER
CLOCK
TRANSMITTER RATE
CONTROL
fCPU
/16 /PR
SCIBRR
SCP1 SCP0 SCT2 SCT1 SCT0 SCR2 SCR1SCR0
RECEIVER RATE
CONTROL
100/191
ST72340, ST72344, ST72345
Start
Idle Frame Bit
Start
Idle Frame Bit
101/191
ST72340, ST72344, ST72345
102/191
ST72340, ST72344, ST72345
103/191
ST72340, ST72344, ST72345
When the framing error is detected: – No interrupt is generated. However this bit rises
– the FE bit is set by hardware at the same time as the RDRF bit which itself
generates an interrupt.
– Data is transferred from the Shift register to the
SCIDR register. The FE bit is reset by a SCISR register read oper-
ation followed by a SCIDR register read operation.
Figure 62. SCI Baud Rate and Extended Prescaler Block Diagram
TRANSMITTER
CLOCK
EXTENDED PRESCALER TRANSMITTER RATE CONTROL
SCIETPR
EXTENDED TRANSMITTER PRESCALER REGISTER
SCIERPR
EXTENDED RECEIVER PRESCALER REGISTER
RECEIVER
CLOCK
EXTENDED PRESCALER RECEIVER RATE CONTROL
EXTENDED PRESCALER
fCPU
TRANSMITTER RATE
CONTROL
/16 /PR
SCIBRR
SCP1 SCP0 SCT2 SCT1 SCT0 SCR2 SCR1SCR0
RECEIVER RATE
CONTROL
104/191
ST72340, ST72344, ST72345
105/191
ST72340, ST72344, ST72345
106/191
ST72340, ST72344, ST72345
RDI LINE
sampled values
Sample
clock 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
6/16
7/16 7/16
One bit time
107/191
ST72340, ST72344, ST72345
108/191
ST72340, ST72344, ST72345
109/191
ST72340, ST72344, ST72345
110/191
ST72340, ST72344, ST72345
111/191
ST72340, ST72344, ST72345
112/191
ST72340, ST72344, ST72345
Bits 7:0 = ERPR[7:0] 8-bit Extended Receive Bits 7:0 = ETPR[7:0] 8-bit Extended Transmit
Prescaler Register. Prescaler Register.
The extended Baud Rate Generator is activated The extended Baud Rate Generator is activated
when a value other than 00h is stored in this regis- when a value other than 00h is stored in this regis-
ter. The clock frequency from the 16 divider (see ter. The clock frequency from the 16 divider (see
Figure 3) is divided by the binary factor set in the Figure 3) is divided by the binary factor set in the
SCIERPR register (in the range 1 to 255). SCIETPR register (in the range 1 to 255).
The extended baud rate generator is not active af- The extended baud rate generator is not active af-
ter a reset. ter a reset.
113/191
ST72340, ST72344, ST72345
114/191
ST72340, ST72344, ST72345
SDA
MSB ACK
SCL
1 2 8 9
START STOP
CONDITION CONDITION
VR02119B
115/191
ST72340, ST72344, ST72345
COMPARATOR
INTERRUPT
116/191
ST72340, ST72344, ST72345
117/191
ST72340, ST72344, ST72345
to correctly handle a second interrupt during the Then the master waits for a read of the SR1 regis-
9th pulse of a transmitted byte. ter followed by a write in the DR register, holding
Note: In both cases, SCL line is not held low; how- the SCL line low (see Figure 66 Transfer se-
ever, the SDA line can remain low if the last bits quencing EV9).
transmitted are all 0. It is then necessary to re- Then the second address byte is sent by the inter-
lease both lines by software. The SCL line is not face.
held low while AF=1 but by other flags (SB or BTF)
that are set at the same time. After completion of this transfer (and acknowledge
from the slave if the ACK bit is set):
How to release the SDA / SCL lines – The EVF bit is set by hardware with interrupt
Set and subsequently clear the STOP bit while generation if the ITE bit is set.
BTF is set. The SDA/SCL lines are released after Then the master waits for a read of the SR1 regis-
the transfer of the current byte. ter followed by a write in the CR register (for exam-
SMBus Compatibility ple set PE bit), holding the SCL line low (see Fig-
ST7 I2C is compatible with SMBus V1.1 protocol. It ure 66 Transfer sequencing EV6).
supports all SMBus adressing modes, SMBus bus
protocols and CRC-8 packet error checking. Refer Next the master must enter Receiver or Transmit-
to AN1713: SMBus Slave Driver For ST7 I2C Pe- ter mode.
ripheral.
Note: In 10-bit addressing mode, to switch the
master to Receiver mode, software must generate
11.6.4.2 Master Mode a repeated Start condition and resend the header
To switch from default Slave mode to Master sequence with the least significant bit set
mode a Start condition generation is needed. (11110xx1).
118/191
ST72340, ST72344, ST72345
119/191
ST72340, ST72344, ST72345
120/191
ST72340, ST72344, ST72345
11.6.6 Interrupts
Figure 67. Event Flags and Interrupt Generation
ADD10 ITE
BTF
ADSL
SB INTERRUPT
AF
STOPF
ARLO EVF
BERR
*
* EVF can also be set by EV6 or an error from the SR2 register.
121/191
ST72340, ST72344, ST72345
122/191
ST72340, ST72344, ST72345
EVF ADD10 TRA BUSY BTF ADSL M/SL SB Bit 4 = BUSY Bus busy.
This bit is set by hardware on detection of a Start
Bit 7 = EVF Event flag. condition and cleared by hardware on detection of
This bit is set by hardware as soon as an event oc- a Stop condition. It indicates a communication in
curs. It is cleared by software reading SR2 register progress on the bus. The BUSY flag of the I2CSR1
in case of error event or as described in Figure 66. register is cleared if a Bus Error occurs.
It is also cleared by hardware when the interface is 0: No communication on the bus
disabled (PE=0). 1: Communication ongoing on the bus
0: No event
1: One of the following events has occurred: Bit 3 = BTF Byte transfer finished.
– BTF=1 (Byte received or transmitted) This bit is set by hardware as soon as a byte is cor-
– ADSL=1 (Address matched in Slave mode rectly received or transmitted with interrupt gener-
while ACK=1) ation if ITE=1. It is cleared by software reading
SR1 register followed by a read or write of DR reg-
– SB=1 (Start condition generated in Master ister. It is also cleared by hardware when the inter-
mode) face is disabled (PE=0).
– AF=1 (No acknowledge received after byte – Following a byte transmission, this bit is set after
transmission) reception of the acknowledge clock pulse. In
– STOPF=1 (Stop condition detected in Slave case an address byte is sent, this bit is set only
mode) after the EV6 event (See Figure 66). BTF is
– ARLO=1 (Arbitration lost in Master mode) cleared by reading SR1 register followed by writ-
ing the next byte in DR register.
– BERR=1 (Bus error, misplaced Start or Stop
condition detected) – Following a byte reception, this bit is set after
transmission of the acknowledge clock pulse if
– ADD10=1 (Master has sent header byte) ACK=1. BTF is cleared by reading SR1 register
– Address byte successfully transmitted in Mas- followed by reading the byte from DR register.
ter mode. The SCL line is held low while BTF=1.
0: Byte transfer not done
Bit 6 = ADD10 10-bit addressing in Master mode. 1: Byte transfer succeeded
This bit is set by hardware when the master has
sent the first byte in 10-bit address mode. It is
cleared by software reading SR2 register followed Bit 2 = ADSL Address matched (Slave mode).
by a write in the DR register of the second address This bit is set by hardware as soon as the received
byte. It is also cleared by hardware when the pe- slave address matched with the OAR register con-
ripheral is disabled (PE=0). tent or a general call is recognized. An interrupt is
generated if ITE=1. It is cleared by software read-
0: No ADD10 event occurred. ing SR1 register or by hardware when the inter-
1: Master has sent first address byte (header) face is disabled (PE=0).
The SCL line is held low while ADSL=1.
Bit 5 = TRA Transmitter/Receiver. 0: Address mismatched or not received
When BTF is set, TRA=1 if a data byte has been 1: Received address matched
transmitted. It is cleared automatically when BTF
is cleared. It is also cleared by hardware after de-
123/191
ST72340, ST72344, ST72345
124/191
ST72340, ST72344, ST72345
125/191
ST72340, ST72344, ST72345
ADD7 ADD6 ADD5 ADD4 ADD3 ADD2 ADD1 ADD0 FR1 FR0 0 0 0 ADD9 ADD8 0
Bit 0 = Reserved.
126/191
ST72340, ST72344, ST72345
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
127/191
ST72340, ST72344, ST72345
DATA/ADDRESS BUS
256 BYTES
RAM
8-BIT
SDA or SDAI
SHIFT REGISTER SLAVE 2 BUFFER
256 BYTES
SCL or SCLI
SLAVE 3 BUFFER
128 BYTES
DMA
Slave 1 or 2 Interrupt
CPU
Slave 3 Interrupt
128/191
ST72340, ST72344, ST72345
SDA
MSB ACK
SCL
1 2 8 9
START STOP
CONDITION CONDITION
VR02119B
129/191
ST72340, ST72344, ST72345
130/191
ST72340, ST72344, ST72345
I2C3S INTERFACE (Cont’d) 2. Enable Word mode by setting the B/W and
This process continues until a Stop or Restart BusyW bits in the I2C3SCR2 register. BusyW
condition occurs. bit is set to 1 when modifying any bits in Control
2. I2C3S attempts to read a word while the CPU is Register 2. Writing a 1 to this bit does not actu-
updating the RAM buffer. To prevent data cor- ally modify BusyW but prevents accidental
ruption, the CPU must switch operation to Word clearing of the bit.
mode prior to updating a word in the RAM 3. Write Byte 1 in an even address in RAM. The
buffer. Word mode is enabled by software using byte is not actually written in RAM but in a
the B/W bit in the I2C3SCR2 register. In Word shadow register. This address must be within
mode, when the CPU writes the MSB of a word the I2C RAM buffer of slave addresses 1, 2 or
to address 2n, it is stored in a shadow register 3.
rather than being actually written in RAM. When 4. Write Byte 2 in the next higher address in RAM.
the CPU writes the second byte (the LSB) at This byte is actually written in RAM. During the
address 2n+1, it is directly written in RAM. The next cycle, the shadow register content is writ-
next cycle after the write to address 2n+1, the ten in the lower address. The DMA request is
MSB is automatically written from the shadow disabled during this cycle.
register to RAM address 2n. DMA is disabled 5. Byte mode resumes automatically after writing
for a 1 cycle while the CPU is writing a word. byte 2 and DMA is re-enabled.
Word mode is disabled by hardware after the 6. Enable interrupts
word update is performed. It must be enabled
Note: Word mode does not guarantee byte-pair
before each word update by CPU.
coherency of words WRITTEN by the I2C master
Use the following procedure when the ST7 writes in RAM and read by the ST7. Byte pair coherency
a word in RAM: in this case must be handled by software.
1. Disable interrupts
Figure 70. 16-bit Word Write Operation Flowchart
HOST ST7 I2C3SNS ST7 CPU
SENDS ADDRESS DECODES I2C3SNS ADDRESS
AND WRITE BIT DECODES R/W BIT NORMAL EXECUTION
SETS WRITE FLAG
N
WORD MODE?
1 Cycle
Y
Repeat Max
DELAYS WHILE CPU
COMPLETES WORD WRITE
SENDS 1 BYTE OF DATA WRITES ONE BYTE TO RAM RESUMES EXECUTION 1 Cycle
Max
131/191
ST72340, ST72344, ST72345
N
WORD MODE?
3 Cycles
Repeat
READS 1 WORD FROM RAM RESUMES EXECUTION Max
RECEIVES BYTE 1
BYTE 1 => SHIFT REG
BYTE 2 => SHADOW REG
RELEASES DMA
Y
STOP?
11.7.4.5 Application Note the shift register. Then it is compared with the
Taking full advantage of its higher interrupt priority three addresses of the interface to decode which
Slave 3 can be used to allow the addressing mas- slave of the interface is being addressed.
ter to send data bytes as commands to the ST7. Address not matched: the interface ignores it
These commands can be decoded by the ST7 and waits for another Start condition.
software to perform various operations such as Address matched: the interface generates in se-
programming the Data E2PROM via IAP (In-Appli- quence the following:
cation Programming).
– An Acknowledge pulse
Slave 3 writes the command byte and other data in
the RAM and generates an interrupt. The ST7 then – Depending on the LSB of the slave address sent
decodes the command and processes the data as by the master, slaves enter transmitter or receiv-
decoded from the command byte. The ST7 also er mode.
writes a status byte in the RAM which the address- – Send an interrupt to the CPU after completion of
ing master can poll. the read/write operation after detecting the Stop/
11.7.5 Address Handling Restart condition on the SDA line.
As soon as a start condition is detected, the
address is received from the SDA line and sent to
132/191
ST72340, ST72344, ST72345
Notes: During this operation the I2C slave reads the data
– The Status Register has to be read to clear the pointed by the current address register. Refer to
event flag associated with the interrupt Figure 75.
– An interrupt will be generated only if the interrupt
enable bit is set in the Control Register Random Read: Random read requires a dummy
– Slaves 1 and 2 have a common interrupt and the byte write sequence to load in the byte address.
Slave 3 has a separate interrupt. The addressing device then generates restart
condition and resends the device address similar
– At the end of write operation, I2C3S is temporar- to current address read with the read/write bit high.
ily disabled by hardware by setting BusyW bit in Refer to Figure 76. Some types of I2C masters
CR2. The byte count register, status register and perform a dummy write with a stop condition and
current address register should be saved before then a current address read.
resetting BusyW bit.
In either case, the slave generates a DMA request,
. sends an acknowledge and serially clocks out the
11.7.5.1 Slave Reception (Write operations) data.
Byte Write: The Slave address is followed by an When the memory address limit is reached the
8-bit byte address. Upon receipt of this address an current address will roll over and the random read
acknowledge is generated, address is moved into will continue till the addressing master sends a
the current address register and the 8 bit data is stop condition.
clocked in. Once the data is shifted in, a DMA
request is generated and the data is written in the
RAM. The addressing device will terminate the Sequential Read: Sequential reads are initiated
write sequence with a stop condition. Refer to by either a current address read or a random
Figure 73 address read. After the addressing master
receives the data byte it responds with an
acknowledge. As long as the slave receives an
Page Write: A page write is initiated in similar way acknowledge it will continue to increment the
to a byte write, but the addressing device does not current address register and clock out sequential
send a stop condition after the first data byte. The data bytes.
page length is programmed using bits 7:6 (PL[1:0]) When the memory address limit is reached the
in the Control Register1. current address will roll over and the sequential
The current address register value is incremented read will continue till the addressing master sends
by one every time a byte is written. When this a stop condition. Refer to Figure 78
address reaches the page boundary, the next byte
will be written at the beginning of the same page.
Refer to Figure 74. 11.7.5.3 Combined Format:
If a master wants to continue communication
either with another slave or by changing the
11.7.5.2 Slave Transmission (Read Operations) direction of transfer then the master would
Current Address Read: The current address generate a restart and provide a different slave
register maintains the last address accessed address or the same slave address with the R/W
during the last read or write operation incremented bit reversed. Refer to Figure 79.
by one.
133/191
ST72340, ST72344, ST72345
134/191
ST72340, ST72344, ST72345
Figure 76. Random Read (Dummy write + restart + current address read)
Start SA W Ack BA Ack Start SA R Ack Data Nack Stop
Figure 77. Random Read (Dummy write + stop + start + current address read)
135/191
ST72340, ST72344, ST72345
NACK
INTERRUPT 1
BERR
INTERRUPT 2
ITER
NACK (Slave address 3)
RF3
ITRE3
Data Status Flag
136/191
ST72340, ST72344, ST72345
Note: Read/Write interrupts are generated only after stop or restart conditions. Figure 80 shows the con-
ditions for the generation of the two interrupts.
Enable Exit Exit
Interrupt Event Control from from
Flag
Bit Wait Halt
Interrupt on write to Slave 1 WF1 ITWE1 Yes No
Interrupt on write to Slave 2 WF2 ITWE1 Yes No
Interrupt on write to Slave 3 WF3 ITWE2 Yes No
Interrupt on Read from Slave 1, Slave 2 or Slave 3. RF1- RF3 ITREx Yes No
BERR,
Errors ITER Yes No
NACK
137/191
ST72340, ST72344, ST72345
I2C3S INTERFACE (Cont’d) Note: When word mode is enabled, all interrupts
Bit 3= WP1 Write Protect enable for Slave 1 should be masked while the word is being written
This bit is set and cleared by software. It is also in RAM.
cleared by hardware when the interface is disa-
bled (PE=0). I2C3S STATUS REGISTER (I2C3SSR)
0: Write access to Slave 1 RAM buffer enabled Read Only
1: Write access to Slave 1 RAM buffer disabled Reset Value: 0000 0000 (00h)
7 0
Notes: (Applicable for both WP2/ WP1)
– Only write operations are disabled/enabled. NACK BERR WF3 WF2 WF1 RF3 RF2 RF1
Read operations are not affected.
– If a write operation is attempted, the slave ad-
Bit 7= NACK Non Acknowledge not followed by
dress is acknowledged, the current address reg-
ister is overwritten, data is also acknowledged Stop
but it is not written to the RAM. This bit is set by hardware when a non acknowl-
edge returned by the master is not followed by a
– Both the current address and byte count regis-
ters are incremented as in normal operation. Stop or Restart condition. It is cleared by software
reading the SR register or by hardware when the
– No interrupt generated if slave is write protected interface is disabled (PE=0).
– BusyW will not be set if slave is write protected 0: No NACK error occurred
1: Non Acknowledge not followed by Stop
Bit 2= PE Peripheral enable Bit 6 = BERR Bus error
This bit is set and cleared by software. This bit is set by hardware when the interface de-
0: Peripheral disabled tects a misplaced Start or Stop condition. It is
1: Slave capability enabled cleared by software reading SR register or by
hardware when the interface is disabled (PE=0).
Note: To enable the I2C interface, write the CR
register TWICE with PE=1 as the first write only The SCL line is not held low while BERR=1.
activates the interface (only PE is set) 0: No misplaced Start or Stop condition
1: Misplaced Start or Stop condition
Bit 1 = BusyW Busy on Write to RAM Buffer
This bit is set by hardware when a STOP/ RE-
START is detected after a write operation. The Bit 5 = WF3 Write operation to Slave 3
I2C3S peripheral is temporarily disabled till this bit This bit is set by hardware on reception of the di-
is reset. This bit is cleared by software. If this bit is rection bit in the I2C address byte for Slave 3. This
not cleared before the next slave address recep- bit is cleared when the status register is read when
there is no communication ongoing or when the
tion, further communication will be non-acknowl-
edged. This bit is set to 1 when modifying any bits peripheral is disabled (PE = 0)
in Control Register 2. Writing a 1 to this bit does 0: No write operation to Slave 3
not actually modify BusyW but prevents acciden- 1: Write operation performed to Slave 3
tally clearing of the bit.
0: No BusyW event occurred Bit 4 = WF2 Write operation to Slave 2
1: A STOP/ RESTART is detected after a write op- This bit is set by hardware on reception of the di-
eration rection bit in the I2C address byte for Slave 2. This
bit is cleared when the status register is read when
Bit 0 = B/W Byte / Word Mode there is no communication ongoing or when the
This control bit must be set by software before a peripheral is disabled (PE = 0)
word is updated in the RAM buffer and cleared by 0: No write operation to Slave 2
hardware after completion of the word update. In 1: Write operation performed to Slave 2
Word mode the CPU cannot be interrupted when it
is modifying the LSB byte and MSB byte of the
word. This mode is to ensure the coherency of Bit 3 = WF1 Write operation to Slave 1
data stored as words. This bit is set by hardware on reception of the di-
0: Byte mode rection bit in the I2C address byte for Slave 1. This
1: Word mode bit is cleared by software when the status register
is read when there is no communication ongoing
138/191
ST72340, ST72344, ST72345
or by hardware when the peripheral is disabled is not limited by the full page length. It is also
(PE = 0). cleared by hardware when interface is disabled
0: No write operation to Slave 1 (PE =0).
1: Write operation performed to Slave 1
I2C3S INTERFACE (Cont’d)
I2C SLAVE 1 ADDRESS REGISTER
Bit 2 = RF3 Read operation from Slave 3 (I2C3SSAR1)
This bit is set by hardware on reception of the di- Read / Write
rection bit in the I2C address byte for Slave 3. It is Reset Value : 0000 0000 (00h)
cleared by software reading the SR register when
there is no communication ongoing. It is also 7 0
cleared by hardware when the interface is disa-
bled (PE=0). ADDR ADDR ADDR ADDR ADDR ADDR ADDR
EN1
0: No read operation from Slave 3 7 6 5 4 3 2 1
1: Read operation performed from Slave 3
Bits 7:1 = ADDR[7:1] Address of Slave 1
This register contains the first 7 bits of Slave 1 ad-
Bit 1= RF2 Read operation from Slave 2 dress (excluding the LSB) and is user program-
This bit is set by hardware on reception of the di- mable. It is also cleared by hardware when inter-
rection bit in the I2C address byte for Slave 2. It is face is disabled (PE =0).
cleared by software reading the SR register when
there is no communication ongoing. It is also Bit 0= EN1 Enable bit for Slave Address 1
cleared by hardware when the interface is disa- This bit is used to enable/disable Slave Address 1.
bled (PE=0). It is also cleared by hardware when interface is
0: No read operation from Slave 2 disabled (PE =0).
1: Read operation performed from Slave 2 0: Slave Address 1 disabled
1: Slave Address 1 enabled
Bit 0= RF1 Read operation from Slave 1
This bit is set by hardware on reception of the di- I2C SLAVE 2 ADDRESS REGISTER
rection bit in the I2C address byte for Slave 1. It is (I2C3SSAR2)
cleared by software reading SR register when Read / Write
there is no communication ongoing. It is also Reset Value: 0000 0000 (00h)
cleared by hardware when the interface is disa- 7 0
bled (PE=0).
0: No read operation from Slave 1 ADDR ADDR ADDR ADDR ADDR ADDR ADDR
1: Read operation performed from Slave 1 EN2
7 6 5 4 3 2 1
I2C BYTE COUNT REGISTER (I2C3SBCR) Bits 7:1 = ADDR[7:1] Address of Slave 2.
Read only This register contains the first 7 bits of Slave 2 ad-
Reset Value: 0000 0000 (00h) dress (excluding the LSB) and is user programma-
ble. It is also cleared by hardware when interface
7 0 is disabled (PE =0).
NB7 NB6 NB5 NB4 NB3 NB2 NB1 NB0 Bit 0= EN2 Enable bit for Slave Address 2
This bit is used to enable/disable Slave Address 2.
Bits 7:0 = NB [7:0] Byte Count Register It is also cleared by hardware when interface is
This register keeps a count of the number of bytes disabled (PE =0).
received or transmitted through any of the three 0: Slave Address 2 disabled
addresses. This byte count is reset after reception 1: Slave Address 2 enabled
by a slave address of a new transfer and is incre-
mented after each byte is transferred. This register
139/191
ST72340, ST72344, ST72345
ADDR ADDR ADDR ADDR ADDR ADDR ADDR CA7 CA6 CA5 CA4 CA3 CA2 CA1 CA0
EN3
7 6 5 4 3 2 1
140/191
ST72340, ST72344, ST72345
Address Register
7 6 5 4 3 2 1 0
(Hex.) Name
0064h I2C3SSAR1 ADDR7 ADDR6 ADDR5 ADDR4 ADDR3 ADDR2 ADDR1 EN1
0066h I2C3SSAR2 ADDR7 ADDR6 ADDR5 ADDR4 ADDR3 ADDR2 ADDR1 EN2
0068h I2C3SSAR3 ADDR7 ADDR6 ADDR5 ADDR4 ADDR3 ADDR2 ADDR1 EN3
141/191
ST72340, ST72344, ST72345
AIN0
AIN1
ANALOG TO DIGITAL
ANALOG
MUX CONVERTER
AINx
ADCDRH D9 D8 D7 D6 D5 D4 D3 D2
ADCDRL 0 0 0 0 0 0 D1 D0
142/191
ST72340, ST72344, ST72345
143/191
ST72340, ST72344, ST72345
7 0
D9 D8 D7 D6 D5 D4 D3 D2
7 0
0 0 0 0 0 0 D1 D0
144/191
ST72340, ST72344, ST72345
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
145/191
ST72340, ST72344, ST72345
12 INSTRUCTION SET
12.1 ST7 ADDRESSING MODES The ST7 Instruction set is designed to minimize
the number of bytes required per instruction: To do
The ST7 Core features 17 different addressing so, most of the addressing modes may be subdi-
modes which can be classified in seven main vided in two submodes called long and short:
groups:
– Long addressing mode is more powerful be-
Addressing Mode Example cause it can use the full 64 Kbyte address space,
Inherent nop however it uses more bytes and more CPU cy-
cles.
Immediate ld A,#$55
– Short addressing mode is less powerful because
Direct ld A,$55 it can generally only access page zero (0000h -
Indexed ld A,($55,X) 00FFh range), but the instruction size is more
Indirect ld A,([$55],X) compact, and faster. All memory to memory in-
structions use short addressing modes only
Relative jrne loop (CLR, CPL, NEG, BSET, BRES, BTJT, BTJF,
Bit operation bset byte,#5 INC, DEC, RLC, RRC, SLL, SRL, SRA, SWAP)
The ST7 Assembler optimizes the use of long and
short addressing modes.
Table 27. ST7 Addressing Mode Overview
Pointer Pointer
Destination/ Length
Mode Syntax Address Size
Source (Bytes)
(Hex.) (Hex.)
Inherent nop +0
Immediate ld A,#$55 +1
Short Direct ld A,$10 00..FF +1
Long Direct ld A,$1000 0000..FFFF +2
+ 0 (with X register)
No Offset Direct Indexed ld A,(X) 00..FF
+ 1 (with Y register)
Short Direct Indexed ld A,($10,X) 00..1FE +1
Long Direct Indexed ld A,($1000,X) 0000..FFFF +2
Short Indirect ld A,[$10] 00..FF 00..FF byte +2
Long Indirect ld A,[$10.w] 0000..FFFF 00..FF word +2
Short Indirect Indexed ld A,([$10],X) 00..1FE 00..FF byte +2
Long Indirect Indexed ld A,([$10.w],X) 0000..FFFF 00..FF word +2
1)
Relative Direct jrne loop PC-128/PC+127 +1
Relative Indirect jrne [$10] PC-128/PC+1271) 00..FF byte +2
Bit Direct bset $10,#7 00..FF +1
Bit Indirect bset [$10],#7 00..FF 00..FF byte +2
Bit Direct Relative btjt $10,#7,skip 00..FF +2
Bit Indirect Relative btjt [$10],#7,skip 00..FF 00..FF byte +3
Note:
1. At the time the instruction is executed, the Program Counter (PC) points to the instruction following JRxx.
146/191
ST72340, ST72344, ST72345
147/191
ST72340, ST72344, ST72345
148/191
ST72340, ST72344, ST72345
149/191
ST72340, ST72344, ST72345
150/191
ST72340, ST72344, ST72345
NOP No Operation
OR OR operation A=A+M A M N Z
pop CC CC M H I N Z C
151/191
ST72340, ST72344, ST72345
13 ELECTRICAL CHARACTERISTICS
ST7 PIN
CL
152/191
ST72340, ST72344, ST72345
Notes:
1. Directly connecting the RESET and I/O pins to VDD or VSS could damage the device if an unintentional internal reset
is generated or an unexpected change of the I/O configuration occurs (for example, due to a corrupted program counter).
To guarantee safe operation, this connection has to be done through a pull-up or pull-down resistor (typical: 4.7kΩ for
RESET, 10kΩ for I/Os). Unused I/O pins must be tied in the same way to VDD or VSS according to their reset configuration.
2. IINJ(PIN) must never be exceeded. This is implicitly insured if VIN maximum is respected. If VIN maximum cannot be
respected, the injection current must be limited externally to the IINJ(PIN) value. A positive injection is induced by VIN>VDD
while a negative injection is induced by VIN<VSS. For true open-drain pads, there is no positive injection current, and the
corresponding VIN maximum must always be respected
3. All power (VDD) and ground (VSS) lines must always be connected to the external supply.
4. Negative injection disturbs the analog performance of the device. In particular, it induces leakage currents throughout
the device including the analog inputs. To avoid undesirable effects on the analog functions, care must be taken:
- Analog input pins must have a negative injection less than 0.8 mA (assuming that the impedance of the analog voltage
is lower than the specified limits)
- Pure digital pins must have a negative injection less than 1.6mA. In addition, it is recommended to inject the current as
far as possible from the analog input pins.
5. No negative current injection allowed on PB0 pin.
6. When several inputs are submitted to a current injection, the maximum ΣIINJ(PIN) is the absolute sum of the positive
and negative injected currents (instantaneous values). These results are based on characterisation with ΣIINJ(PIN) maxi-
mum current injection on four I/O port pins of the device.
153/191
ST72340, ST72344, ST72345
Note:
When the power supply is between 2.7 and 2.95V (VIT+(LVD) max), the device is either in the guaranteed
functional area or in reset state, thus allowing deterministic application behaviour. However the LVD may
generate a reset below 2.95V and the user should therefore not use the device below this level when the
LVD is enabled.
Figure 84. fCPU Maximum Operating Frequency Versus VDD Supply Voltage
fCPU [MHz]
8
FUNCTIONALITY
NOT GUARANTEED
IN THIS AREA
4 FUNCTIONALITY
GUARANTEED
CAUTION: RESET MAY 2 IN THIS AREA
BE ACTIVATED BY LVD
IN THIS AREA
0 SUPPLY VOLTAGE [V]
2.7 3.3 3.6 4.0 4.5 5.0 5.5
154/191
ST72340, ST72344, ST72345
155/191
ST72340, ST72344, ST72345
Note:
1. To obtain a x4 multiplication ratio in the range 3.3 to 5.5V, the DIV2EN option bit must enabled.
2. Guaranteed by design.
Notes:
1. If the RC oscillator clock is selected, to improve clock stability and frequency accuracy, it is recommended to place a
decoupling capacitor, typically 100nF, between the VDD and VSS pins as close as possible to the ST7 device.
2. See “Internal RC Oscillator” on page 30
3. Expected results. Data based on characterization, not tested in production
156/191
ST72340, ST72344, ST72345
1.2
1.1
1.0
0.9
0.8
0.7
0.6
0.5
0 50 100 150 200 250
RCCR (decimal)
157/191
ST72340, ST72344, ST72345
1.5
3
1
2
0.5
1
0 0
2 2.5 3 3.5 4 4.5 5 5.5 6 6.5 2 2.5 3 3.5 4 4.5 5 5.5 6 6.5
Vdd (V)
Vdd (V)
Note: Graph displays data beyond the normal operating range of 3V - 5.5V
Note: Graph displays data beyond the normal operating range of 3V - 5.5V
Figure 87. Typical IDD in RUN at fCPU = 8MHz Figure 90. Typical IDD in WAIT at fCPU= 8MHz
4
9
3.5 0.5
8 1
3
2
7 IDD wfi (mA) vs Fcpu (MHz)
4
IDD run (mA) at fCPU=8MHz
2.5
6 6
140°C 8
2
5
90°C
1.5
4
25°C
1
3
-5°C
0.5
2
-45°C
1 0
2 2.5 3 3.5 4 4.5 5 5.5 6 6.5
Vdd (V)
0 Note: Graph displays data beyond the normal operating range of 3V - 5.5V
Note:
2 Graph
2.5displays
3 data 3.5
beyond the
4 normal
4.5 operating
5 range
5.5 of 3V
6 - 5.5V6.5
Vdd (V)
Note: Graph displays data beyond the normal operating range of 3V - 5.5V
Figure 91. Typical IDD in SLOW-WAIT vs. fCPU
Figure 88. Typical IDD in SLOW vs. fCPU 0.60
250KHz
0.90 0.50 125KHz
0.80 250KHz
0.40 62KHz
D
IDD (mA)
0.70 125KHz
0.60 0.30
IDD (mA)
TB
0.50 62KHz
0.20
D
0.40
0.30 0.10
TB
0.20
0.10 0.00
0.00 2.7 3.3 4 5 6
2.7 3.3 4 5 6 VDD (V)
VDD (V) Note: Graph displays data beyond the normal operating range of 3V - 5.5V
Note: Graph displays data beyond the normal operating range of 3V - 5.5V
5.00
RUN
4.00 WAIT
Idd (mA)
SLOW
3.00
SLOW-WAIT
D
2.00
1.00
TB
0.00
-45 25 90 110
Temperature (°C)
158/191
ST72340, ST72344, ST72345
Notes:
1. Data based on a differential IDD measurement between reset configuration (timer stopped) and a timer running in PWM
mode at fcpu=8MHz.
2. Data based on a differential IDD measurement between reset configuration and a permanent SPI master communica-
tion (data sent equal to 55h).
3. Data based on a differential IDD measurement between reset configuration and continuous A/D conversions.
4. Data based on a differential IDD measurement between reset configuration (I2C disabled) and a permanent I2C master
communication at 100kHz (data sent equal to 55h). This measurement include the pad toggling consumption (27kOhm
external pull-up on clock and data lines).
5. Data based on a differential IDD measurement between SCI low power state (SCID=1) and a permanent SCI data trans-
mit sequence.
159/191
ST72340, ST72344, ST72345
VOSC1L
OSC2
Not connected internally
fOSC
EXTERNAL
IL
CLOCK SOURCE
OSC1
ST72XXX
Notes:
1. Guaranteed by Design. Not tested in production.
2. Data based on typical application software.
3. Time measured between interrupt event and interrupt vector fetch. ∆tc(INST) is the number of tCPU cycles needed to finish
the current instruction execution.
4. Data based on design simulation and/or technology characteristics, not tested in production.
13.7.3 Auto Wakeup from Halt Oscillator (AWU)
Symbol Parameter Conditions Min Typ Max Unit
fAWU AWU Oscillator Frequency 50 125 250 kHz
tRCSRT AWU Oscillator startup time 50 µs
160/191
ST72340, ST72344, ST72345
Notes:
1. The oscillator selection can be optimized in terms of supply current using an high quality resonator with small RS value.
Refer to crystal/ceramic resonator manufacturer for more details.
2. Data based on characterisation results, not tested in production. The relatively low value of the RF resistor, offers a
good protection against issues resulting from use in a humid environment, due to the induced leakage and the bias con-
dition change. However, it is recommended to take this point into account if the µC is used in tough humidity conditions.
3. For CL1 and CL2 it is recommended to use high-quality ceramic capacitors in the 5-pF to 25-pF range (typ.) designed
for high-frequency applications and selected to match the requirements of the crystal or resonator. CL1 and CL2, are usu-
ally the same size. The crystal manufacturer typically specifies a load capacitance which is the series combination of CL1
and CL2. PCB and MCU pin capacitance must be included when sizing CL1 and CL2 (10 pF can be used as a rough esti-
mate of the combined pin and board capacitance).
RESONATOR VDD/2 i2
Ref
RF
CL2
OSC2
ST72XXX
161/191
ST72340, ST72344, ST72345
fOSC
Supplier Typical Ceramic Resonators2)
(MHz)
2 CSTCC2M00G56Z-R0
SMD CSTCR4M00G53Z-R0
4
Lead CSTLS4M00G53Z-R0
Murata
SMD CSTCE8M00G52Z-R0
8
Lead CSTLS4M0052Z-R0
SMD CSTCE16M0V51Z-R0
16
Lead CSTLS16M0X51Z-R0
Notes:
1. Resonator characteristics given by the ceramic resonator manufacturer.
2. SMD = [-R0: Plastic tape package (∅ =180mm), -B0: Bulk]
LEAD = [-A0: Flat pack package (Radial taping Ho= 18mm), -B0: Bulk]
For more information on these resonators, please consult www.murata.com
162/191
ST72340, ST72344, ST72345
Notes:
1. Minimum VDD supply voltage without losing data stored in RAM (in HALT mode or under RESET) or in hardware reg-
isters (only in HALT mode). Guaranteed by construction, not tested in production.
2. Up to 32 bytes can be programmed at a time.
3. The data retention time increases when the TA decreases.
4. Data based on reliability test results and monitored in production.
5. Data based on characterization results, not tested in production.
6. Guaranteed by Design. Not tested in production.
7. Design target value pending full product characterization.
163/191
ST72340, ST72344, ST72345
164/191
ST72340, ST72344, ST72345
Note:
1. Data based on characterization results, not tested in production.
13.9.3.2 Static and Dynamic Latch-Up ■ DLU: Electro-Static Discharges (one positive
■ LU: 3 complementary static tests are required then one negative test) are applied to each pin
on 6 parts to assess the latch-up performance. of 3 samples when the micro is running to
A supply overvoltage (applied to each power assess the latch-up performance in dynamic
supply pin) and a current injection (applied to mode. Power supplies are set to the typical
each input, output and configurable I/O pin) are values, the oscillator is connected as near as
performed on each sample. This test conforms possible to the pins of the micro and the
to the EIA/JESD 78 IC latch-up standard. For component is put in reset mode. This test
more details, refer to the application note conforms to the IEC1000-4-2 and SAEJ1752/3
AN1181. standards. For more details, refer to the
application note AN1181.
Electrical Sensitivities
Symbol Parameter Conditions Class
TA=+25°C A
LU Static latch-up class
TA=+85°C A
DLU Dynamic latch-up class VDD=5.5V, fOSC=4MHz, TA=+25°C A
165/191
ST72340, ST72344, ST72345
Notes:
1. Data based on validation/design results.
2. Configuration not recommended, all unused pins must be kept at a fixed voltage: using the output mode of the I/O for
example or an external pull-up or pull-down resistor (see Figure 95). Static peak current value taken at a fixed VIN value,
based on design simulation and technology characteristics, not tested in production. This value depends on VDD and tem-
perature values.
3. The RPU pull-up equivalent resistor is based on a resistive transistor.
4. To generate an external interrupt, a minimum pulse width has to be applied on an I/O port pin configured as an external
interrupt source.
166/191
ST72340, ST72344, ST72345
VDD=5V
Output low level voltage for a high sink I/O pin IIO=+20mA 1.3
when 4 pins are sunk at same time
(see Figure 101) IIO=+8mA 0.75
Output high level voltage for an I/O pin IIO=-5mA VDD-1.5
VOH 2) when 4 pins are sourced at same time
(see Figure ) IIO=-2mA VDD-0.8
Output low level voltage for a standard I/O pin
when 8 pins are sunk at same time IIO=+2mA 0.7
VOL 1)3) (see Figure 97)
Output low level voltage for a high sink I/O pin V
IIO=+8mA 0.5
when 4 pins are sunk at same time
VDD=3.3V
Notes:
1. The IIO current sunk must always respect the absolute maximum rating specified in Section 13.2.2 and the sum of IIO
(I/O ports and control pins) must not exceed IVSS.
2. The IIO current sourced must always respect the absolute maximum rating specified in Section 13.2.2 and the sum of
IIO (I/O ports and control pins) must not exceed IVDD.
3. Not tested in production, based on characterization results.
167/191
ST72340, ST72344, ST72345
800 1000
800 1200
VOL (mV) at VDD=3 V(HS)
-45°C
600 1000
-45°C 25°C
25°C 800 90°C
400 90°C 130°C
130°C 600
200
400
0 200
0 2 4 6
ILOAD (mA) 0
0 2 4 6 8 10 12 14 16 18 20
Figure 98. Typical VOL at VDD=5V (std I/Os) ILOAD (mA)
-45°C
800 25°C 700
90°C
600 -45°C
VOL (mV) at VDD=5 V(HS)
600 130°C
25°C
500
90°C
400
400 130°C
200 300
200
0
0 2 4 6 100
ILOAD (mA)
0
0 2 4 6 8 10 12 14 16 18 20
ILOAD (mA)
168/191
ST72340, ST72344, ST72345
1000 200
-45°C
VOL (mV) at Ilo=2mA (Std)
-45°C
25°C
400
80
200
40
0
2.4 2.6 2.8 3 5 0
Ilo (mA) 2.5 3 3.5 4 5
Ilo (mA)
Figure 103. Typical VOL vs. VDD (std I/Os, 6mA)
Figure 106. Typical VOL vs. VDD (HS I/Os,
Iio=12mA)
500
000
-45°C
VDD -Voh (mV) at Ilo=6mA
400
25°C
800 90°C
300 130°C
600
200 -45°C
25°C 400
100 90°C
130°C
200
0
2.5 3 Ilo3.5
(mA) 4 5
0
2.4 2.6 2.8 3 5
Figure 104. Typical VOL vs. VDD (HS I/Os, Ilo (mA)
Iio=8mA)
Figure 107. Typical VDD-vOH at vDD=2.4V (std
1000 I/Os)
-45°C
25°C 1400
VOL(mV) at Ilo=8mA (HS)
800
90°C
VDD-VOH (mV) at VDD=2.4 V
1200
130°C
600
1000
400 800
-45°C
600 25°C
200 90°C
400
130°C
0 200
2.4 2.6 2.8 3 5
Ilo (mA) 0
0 -2 -4 -6 -8 -10 -12 -14 -16 -18 -20
ILOAD (mA)
169/191
ST72340, ST72344, ST72345
1800
VDD-VOH (mV) at VDD=3 V
1500 -45°C
25°C
1200 90°C
130°C
900
600
300
0
0 -2 -4 -6 -8 -10 -12 -14 -16 -18 -20
ILOAD (mA)
170/191
ST72340, ST72344, ST72345
1200 1000
1100 900
-45°C
1000 800
-45°C 25°C
900 700
25°C 90°C
800
90°C 600 130°C
700
600 130°C 500
500 400
400 300
300 200
200
100
100
0
0
0 -2 -4 -6 -8 -10 -12 -14 -16 -18 -20
0 -2 -4 -6 -8 -10 -12 -14 -16 -18 -20 ILOAD (mA)
ILOAD (mA)
200 500
-45°C
25°C
VDD -Voh (mV) at Ilo=2mA
80 -45°C
200
25°C
90°C
40 100
130°C
0 0
2.5 3 3.5 4 5 2.5 3
Ilo (mA) Ilo3.5
(mA) 4 5
171/191
ST72340, ST72344, ST72345
Notes:
1. Data based on characterization results, not tested in production.
2. The IIO current sunk must always respect the absolute maximum rating specified in Section 13.2.2 and the sum of IIO
(I/O ports and control pins) must not exceed IVSS.
3. The RON pull-up equivalent resistor is based on a resistive transistor. Specified for voltages on RESET pin between
VILmax and VDD
4. To guarantee the reset of the device, a minimum pulse has to be applied to the RESET pin. All short pulses applied on
RESET pin with a duration below th(RSTL)in can be ignored.
172/191
ST72340, ST72344, ST72345
VDD ST72XXX
RON
USER INTERNAL
EXTERNAL RESET
RESET Filter
CIRCUIT
0.01µF WATCHDOG
PULSE
GENERATOR
ILLEGAL OPCODE 5)
Required
Note 1:
– The reset network protects the device against parasitic resets.
– The output of the external reset circuit must have an open-drain output to drive the ST7 reset pad. Otherwise the
device can be damaged when the ST7 generates an internal reset (LVD or watchdog).
– Whatever the reset source is (internal or external), the user must ensure that the level on the RESET pin can go
below the VIL max. level specified in Section 13.11.1 on page 172. Otherwise the reset will not be taken into account
internally.
– Because the reset circuit is designed to allow the internal RESET to be output in the RESET pin, the user must en-
sure that the current sunk on the RESET pin is less than the absolute maximum value specified for IINJ(RESET) in
Section 13.2.2 on page 153.
Note 2: When the LVD is enabled, it is recommended not to connect a pull-up resistor or capacitor. A 10nF pull-down
capacitor is required to filter noise on the reset line.
Note 3: In case a capacitive power supply is used, it is recommended to connect a 1MΩ pull-down resistor to the RESET
pin to discharge any residual voltage induced by the capacitive effect of the power supply (this will add 5µA to the power
consumption of the MCU).
Note 4: Tips when using the LVD:
– 1. Check that all recommendations related to the reset circuit have been applied (see notes above)
– 2. Check that the power supply is properly decoupled (100nF + 10µF close to the MCU). Refer to AN1709 and
AN2017. If this cannot be done, it is recommended to put a 100nF + 1MΩ pull-down on the RESET pin.
– 3. The capacitors connected on the RESET pin and also the power supply are key to avoid any start-up marginality.
In most cases, steps 1 and 2 above are sufficient for a robust solution. Otherwise: replace 10nF pull-down on the
RESET pin with a 5µF to 20µF capacitor.”
Note 5: Please refer to “Illegal Opcode Reset” on page 149 for more details on illegal opcode reset conditions.
173/191
ST72340, ST72344, ST72345
Legend:
RP = External pull-up resistance
fSCL = I2C speed
NA = Not achievable
Note:
– For speeds around 200 kHz, achieved speed can have ±5% tolerance
– For other speed ranges, achieved speed can have ±2% tolerance
The above variations depend on the accuracy of the external components used.
174/191
ST72340, ST72344, ST72345
Note:
1. Data based on characterization results over the whole temperature range.
2. ADC accuracy vs negative injection current: Injecting negative current on any of the analog input pins may reduce the
accuracy of the conversion being performed on another analog input.
The effect of negative injection current on robust pins is specified in Section 13.11 on page 172
Any positive injection current within the limits specified for IINJ(PIN) and ΣIINJ(PIN) in Section 13.10 does not affect the ADC
accuracy.
3. Data based on characterization results, monitored in production to guarantee 99.73% within ± max value from -40°C
to +125°C (± 3σ distribution limits).
175/191
ST72340, ST72344, ST72345
ADC Characteristics
Subject to general operating condition for VDD, fOSC, and TA unless otherwise specified.
Symbol Parameter Conditions Min Typ 1) Max Unit
fADC ADC clock frequency 0.4 4 MHz
VAIN Conversion voltage range 2) VSSA VDDA V
3)
RAIN External input resistor 10 kΩ
CADC Internal sample and hold capacitor 6 pF
4)
tSTAB Stabilization time after ADC enable 0
µs
Conversion time (Sample+Hold) 3.5
fCPU=8MHz, fADC=4MHz
tADC - Sample capacitor loading time 4
1/fADC
- Hold conversion time 10
Analog Part 1
IADC mA
Digital Part 0.2
Notes:
1. Unless otherwise specified, typical data are based on TA=25°C and VDD-VSS=5V. They are given only as design guide-
lines and are not tested.
2. When VDDA and VSSA pins are not available on the pinout, the ADC refers to VDD and VSS.
3. Any added external serial resistor will downgrade the ADC accuracy (especially for resistance greater than 10kΩ). Data
based on characterization results, not tested in production.
4. The stabilization time of the AD converter is masked by the first tLOAD. The first conversion after the enable is then
always valid.
CAIN VT
0.6V IL CADC
±1µA 6pF
Notes:
1. CPARASITIC represents the capacitance of the PCB (dependent on soldering and PCB layout quality) plus the pad ca-
pacitance (3pF). A high CPARASITIC value will downgrade conversion accuracy. To remedy this, fADC should be reduced.
2. This graph shows that depending on the input signal variation (fAIN), CAIN can be increased for stabilization time and
decreased to allow the use of a larger serial resistor (RAIN).
176/191
ST72340, ST72344, ST72345
14 PACKAGE CHARACTERISTICS
In order to meet environmental requirements, ST JESD97. The maximum ratings related to solder-
offers these devices in ECOPACK® packages. ing conditions are also marked on the inner box la-
These packages have a Lead-free second level in- bel.
terconnect. The category of second Level Inter- ECOPACK is an ST trademark. ECOPACK speci-
connect is marked on the package and on the in- fications are available at: www.st.com.
ner box label, in compliance with JEDEC Standard
mm inches1)
Dim.
D A Min Typ Max Min Typ Max
D1 A2 A 1.60 0.063
A1 0.05 0.15 0.002 0.006
A1 A2 1.35 1.40 1.45 0.053 0.055 0.057
b 0.30 0.37 0.45 0.012 0.015 0.018
e C 0.09 0.20 0.004 0.008
D 9.00 0.354
E1 E
b D1 7.00 0.276
E 9.00 0.354
E1 7.00 0.276
c e 0.80 0.031
L1
θ 0° 3.5° 7° 0° 3.5° 7°
L
h L 0.45 0.60 0.75 0.018 0.024 0.030
L1 1.00 0.039
Number of Pins
N 32
Note 1. Values in inches are converted from
mm and rounded to 3 decimal digits.
177/191
ST72340, ST72344, ST72345
A2
A
SEATING
A3 mm inches1)
PLANE A1 Dim.
Min Typ Max Min Typ Max
D
A 0.80 0.90 1.00 0.031 0.035 0.039
A1 0.02 0.05 0.001 0.002
A2 0.65 1.00 0.026 0.039
A3 0.20 0.008
b 0.18 0.25 0.30 0.007 0.010 0.012
D 5.85 6.00 6.15 0.230 0.236 0.242
D2
D2 2.75 2.9 3.05 0.108 0.114 0.120
E 5.85 6 6.15 0.230 0.236 0.242
E2 E E2 2.75 2.9 3.05 0.108 0.114 0.120
e 0.50 0.020
PIN #1 ID TYPE C
RADIUS L 0.30 0.40 0.50 0.012 0.016 0.020
2 Number of Pins
1 N 40
L Note 1. Values in inches are converted from mm
and rounded to 3 decimal digits.
b e
mm inches1)
Dim.
D A Min Typ Max Min Typ Max
D1 A2 A 1.60 0.063
A1 0.05 0.15 0.002 0.006
A1
A2 1.35 1.40 1.45 0.053 0.055 0.057
b 0.30 0.37 0.45 0.012 0.015 0.018
b
C 0.09 0.20 0.004 0.000 0.008
D 12.00 0.472
e D1 10.00 0.394
E1 E
E 12.00 0.472
E1 10.00 0.394
e 0.80 0.031
θ 0° 3.5° 7° 0° 3.5° 7°
L 0.45 0.60 0.75 0.018 0.024 0.030
L1 c
L1 1.00 0.039
L
h Number of Pins
N 44
Note 1. Values in inches are converted from
mm and rounded to 3 decimal digits.
178/191
ST72340, ST72344, ST72345
mm inches1)
Dim.
Min Typ Max Min Typ Max
D A A 1.60 0.063
D1 A2 A1 0.05 0.15 0.002 0.006
A2 1.35 1.40 1.45 0.053 0.055 0.057
A1
b 0.17 0.22 0.27 0.007 0.009 0.011
b C 0.09 0.20 0.004 0.008
D 9.00 0.354
D1 7.00 0.276
E1 E e
E 9.00 0.354
E1 7.00 0.276
e 0.50 0.020
c θ 0° 3.5° 7° 0° 3.5° 7°
L1
L 0.45 0.60 0.75 0.018 0.024 0.030
L
θ L1 1.00 0.039
Number of Pins
N 48
Note 1. Values in inches are converted from
mm and rounded to 3 decimal digits.
179/191
ST72340, ST72344, ST72345
Notes:
1. The maximum chip-junction temperature is based on technology characteristics.
2. The maximum power dissipation is obtained from the formula PD = (TJ -TA) / RthJA.
The power dissipation of an application can be defined by the user with the formula: PD=PINT+PPORT where PINT is the
chip internal power (IDD x VDD) and PPORT is the port power dissipation depending on the ports used in the application.
3. Values given for a 4-layer board. PDmax computed for TA = 125°C.
180/191
ST72340, ST72344, ST72345
181/191
ST72340, ST72344, ST72345
Note:
OPT3 = OSC RC Oscillator selection 1. For a target ratio of x4 between 3.3V - 3.65V,
0: RC oscillator on this is the recommended configuration.
1: RC oscillator off
182/191
ST72340, ST72344, ST72345
Default
1 1 1 1 1 1 1 1 x x x 1 1 1 1 1
Value
183/191
ST72340, ST72344, ST72345
184/191
ST72340, ST72344, ST72345
Customer ..........................................................................
Address ..........................................................................
..........................................................................
Contact ..........................................................................
Phone No ..........................................................................
Reference FASTROM Code*: . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
*FASTROM code name is assigned by STMicroelectronics.
FASTROM code must be sent in .S19 format. .Hex extension cannot be processed.
Device Type/Memory Size/Package (check only one option):
--------------------------------- --------------------------------------------------- ---------------------------------------------------
| |
FASTROM DEVICE: 8K 16K
| |
--------------------------------- --------------------------------------------------- ---------------------------------------------------
LQFP32 | [ ] ST72P344K4T | [ ] ST72P344K2T
LQFP44 | [ ] ST72P344S4T | [ ] ST72P344S2T
LQFP48 | [ ] ST72P345C4T |
Conditioning for LQFP (check only one option): [ ] Tape & Reel [ ] Tube
Version/ Temperature range (please refer to datasheet for specific sales conditions):
[ ] 0°C to +70°C [ ] -10°C to +85°C [ ] -40°C to +85°C
Special Marking: [ ] No [ ] Yes
Authorized characters are letters, digits, '.', '-', '/' and spaces only.
Maximum character count: LQFP32, LQFP48: 7 char. max "_ _ _ _ _ _ _ "
LQFP44: 10 char. max "_ _ _ _ _ _ _ _ _ _"
Clock Source Selection: [ ] External resonator or quartz
[ ] Internal RC Oscillator
[ ] External Clock:
[ ] LP: Low power (1 to 2 MHz)
[ ] MP: Medium power (2 to 4 MHz)
[ ] MS: Medium speed (4 to 8 MHz)
[ ] HS: High speed (8 to 16 MHz)
185/191
ST72340, ST72344, ST72345
Notes:
1. USB connection to PC
2. RLink with ST7 tool set
3. Add suffix /EU, /UK or /US for the power supply for your region
4. Parallel port connection to PC
5. Only available for LQFP32 and LQFP44 packages
6. Only available for LQFP48 package
186/191
ST72340, ST72344, ST72345
16 KNOWN LIMITATIONS
187/191
ST72340, ST72344, ST72345
188/191
ST72340, ST72344, ST72345
189/191
ST72340, ST72344, ST72345
17 REVISION HISTORY
Date Revision Main changes
29-April-2006 1 First release on internet
Removed references to BGA56 and QFN40 packages
TQFP package naming changed to LQFP (Low-profile Quad Flat)
Changed number of I/O ports on first page
PDVD (Power Down Voltage Detector) replaced by AVD (Auxiliary Voltage Detector)
Modified note 3 to Table 2 on page 12
Added PF4 to Figure 3 on page 6 and Figure 4 on page 7
“MEMORY ACCESS” on page 19
Modified Figure 8, Figure 9 on page 20 and Figure 10 on page 21
Changed RCCR table in Section 7.2 on page 29 (fRC=1MHz)
References to PDVDF, PDVDIE corrected to AVDF, AVDIE: Section 7.5.2 on page 34
Current characteristics Section 13.2.2 on page 153 updated
General operating conditions table updated, Section 13.3.1 on page 154
Data updated in Section 13.3.2 on page 154, note replaced
Table modified in Section 13.3.3 on page 155
Notes adjusted for table in Section 13.4 on page 156
Modified Section 13.5 on page 156 (for VDD=5V)
Table in Section 13.6.1 on page 157 modified
23-Oct-2006 2 Updated Section 13.6.2 on page 159
Added Section 13.7.2 and Figure 93 on page 160
Table in Section 13.8.2 on page 163 modified
Absolute maximum ratings and electrical sensitivity table updated, Section 13.9.3 on
page 165
Added note 1 to VIL and VIH in Section 13.10.1 on page 166
Table in Section 13.10.2 on page 167 modified (for VDD= 3.3V and VDD=2.7V)
Modified graphs in Section 13.10.2 on page 167
tg(RSTL)in updated in Section 13.11 on page 172
Updated Table 29 on page 174
Updated Table 30 on page 180
Modified default values for option byte 2 and 3 on page 183
Added option list on page 185
Added “DEVELOPMENT TOOLS” on page 186
Added known limitations: “In-Application Programming” on page 189, “Programming
of EEPROM data” on page 189, and “Flash Write/Erase Protection” on page 189
Modified Section 16.6 on page 189
Changed status of the document (datasheet instead of preliminary data)
190/191
ST72340, ST72344, ST72345
Notes:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries (“ST”) reserve the
right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any
time, without notice.
All ST products are sold pursuant to ST’s terms and conditions of sale.
Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no
liability whatsoever relating to the choice, selection or use of the ST products and services described herein.
No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this
document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products
or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such
third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST’S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED
WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS
OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.
UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT
RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE
SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN
PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT
SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER’S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void
any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any
liability of ST.
Information in this document supersedes and replaces all information previously supplied.
The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
191/191