ST72F521 STMicroelectronics
ST72F521 STMicroelectronics
■ Memories
– 32K to 60K dual voltage High Density Flash
(HDFlash) or ROM with read-out protection
capability. In-Application Programming and
In-Circuit Programming for HDFlash devices
– 1K to 2K RAM
– HDFlash endurance: 100 cycles, data reten-
tion: 20 years at 55°C
■ Clock, Reset And Supply Management TQFP64
– Enhanced low voltage supervisor (LVD) for 14 x 14
TQFP64
main supply and auxiliary voltage detector TQFP80 10 x 10
(AVD) with interrupt capability 14 x 14
– Clock sources: crystal/ceramic resonator os-
cillators, internal RC oscillator and bypass for
external clock
– PLL for 2x frequency multiplication
– Four power saving modes: Halt, Active-Halt, ■ 4 Communications Interfaces
Wait and Slow
■ Interrupt Management – SPI synchronous serial interface
– SCI asynchronous serial interface
– Nested interrupt controller
– I2C multimaster interface
– 14 interrupt vectors plus TRAP and RESET (SMbus V1.1 compliant)
– Top Level Interrupt (TLI) pin – CAN interface (2.0B Passive)
– 15 external interrupt lines (on 4 vectors) ■ Analog periperal (low current coupling)
■ Up to 64 I/O Ports – 10-bit ADC with 16 input robust input ports
– 48 multifunctional bidirectional I/O lines
– 34 alternate function lines
■ Instruction Set
– 16 high sink outputs
■ 5 Timers – 8-bit Data Manipulation
– 63 Basic Instructions
– Main Clock Controller with: Real time base,
Beep and Clock-out capabilities – 17 main Addressing Modes
– Configurable watchdog timer – 8 x 8 Unsigned Multiply Instruction
– Two 16-bit timers with: 2 input captures, 2 out- ■ Development Tools
put compares, external clock input on one tim- – Full hardware/software development package
er, PWM and pulse generator modes
– In-Circuit Testing capability
– 8-bit PWM Auto-Reload timer with: 2 input
captures, 4 PWM outputs, output compare
and time base interrupt, external clock with
event detector
Device Summary
Features ST72F521(M/R/AR)9 ST72F521(R/AR)6 ST72521B(M/R/AR)9 ST72521B(R/AR)6
Program memory - bytes Flash 60K Flash 32K ROM 60K ROM 32K
RAM (stack) - bytes 2048 (256) 1024 (256) 2048 (256) 1024 (256)
Operating Voltage 3.8V to 5.5V
Temp. Range up to -40°C to +125 °C
TQFP80 14x14 (M), TQFP80 14x14 (M),
TQFP64 14x14 (R), TQFP64 TQFP64 14x14 (R), TQFP64
Package TQFP64 14x14 (R), TQFP64 14x14 (R),
10x10 (AR) 10x10 (AR)
TQFP64 10x10 (AR) TQFP64 10x10 (AR)
Rev. 5
2/215
1
Table of Contents
8.4 ACTIVE-HALT AND HALT MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
8.4.1 ACTIVE-HALT MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
8.4.2 HALT MODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
9 I/O PORTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.2 FUNCTIONAL DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.2.1 Input Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.2.2 Output Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.2.3 Alternate Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47
9.3 I/O PORT IMPLEMENTATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9.4 LOW POWER MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9.5 INTERRUPTS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
9.5.1 I/O Port Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
10 ON-CHIP PERIPHERALS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.1 WATCHDOG TIMER (WDG) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.1.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.1.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
10.1.4 How to Program the Watchdog Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
10.1.5 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
10.1.6 Hardware Watchdog Option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
10.1.7 Using Halt Mode with the WDG (WDGHALT option) . . . . . . . . . . . . . . . . . . . . . . . 56
10.1.8 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
10.1.9 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
10.2 MAIN CLOCK CONTROLLER WITH REAL TIME CLOCK AND BEEPER (MCC/RTC) . . 58
10.2.1 Programmable CPU Clock Prescaler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.2.2 Clock-out Capability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.2.3 Real Time Clock Timer (RTC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.2.4 Beeper . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
10.2.5 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.2.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.2.7 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
10.3 PWM AUTO-RELOAD TIMER (ART) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
10.3.2 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
10.3.3 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
10.4 16-BIT TIMER . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
10.4.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
10.4.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
10.4.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
10.4.4 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.4.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.4.6 Summary of Timer modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
10.4.7 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
10.5 SERIAL PERIPHERAL INTERFACE (SPI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
10.5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
10.5.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
3/215
1
Table of Contents
10.5.3 General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
10.5.4 Clock Phase and Clock Polarity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
10.5.5 Error Flags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
10.5.6 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
10.5.7 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
10.5.8 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
10.6 SERIAL COMMUNICATIONS INTERFACE (SCI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.6.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.6.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.6.3 General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100
10.6.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
10.6.5 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
10.6.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
10.6.7 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
10.7 I2C BUS INTERFACE (I2C) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.7.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.7.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.7.3 General Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
10.7.4 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
10.7.5 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
10.7.6 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122
10.7.7 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
10.8 CONTROLLER AREA NETWORK (CAN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
10.8.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
10.8.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
10.8.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
10.8.4 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
10.8.5 List of CAN Cell Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146
10.9 10-BIT A/D CONVERTER (ADC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
10.9.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
10.9.2 Main Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
10.9.3 Functional Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.9.4 Low Power Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.9.5 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156
10.9.6 Register Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
11 INSTRUCTION SET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
11.1 CPU ADDRESSING MODES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159
11.1.1 Inherent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
11.1.2 Immediate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
11.1.3 Direct . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
11.1.4 Indexed (No Offset, Short, Long) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
11.1.5 Indirect (Short, Long) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
11.1.6 Indirect Indexed (Short, Long) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
11.1.7 Relative mode (Direct, Indirect) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161
11.2 INSTRUCTION GROUPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
12 ELECTRICAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215. . . 165
12.1 PARAMETER CONDITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
4/215
Table of Contents
12.1.1 Minimum and Maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.1.2 Typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.1.3 Typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.1.4 Loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.1.5 Pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165
12.2 ABSOLUTE MAXIMUM RATINGS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
12.2.1 Voltage Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
12.2.2 Current Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
12.2.3 Thermal Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
12.3 OPERATING CONDITIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
12.3.1 General Operating Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
12.3.2 Operating Conditions with Low Voltage Detector (LVD) . . . . . . . . . . . . . . . . . . . 168
12.3.3 Auxiliary Voltage Detector (AVD) Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
12.3.4 External Voltage Detector (EVD) Thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . 168
12.4 SUPPLY CURRENT CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
12.4.1 CURRENT CONSUMPTION ..................................... 169
12.4.2 Supply and Clock Managers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
12.4.3 On-Chip Peripherals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
12.5 CLOCK AND TIMING CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
12.5.1 General Timings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
12.5.2 External Clock Source . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173
12.5.3 Crystal and Ceramic Resonator Oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174
12.5.4 RC Oscillators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
12.5.5 PLL Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
12.6 MEMORY CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
12.6.1 RAM and Hardware Registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
12.6.2 FLASH Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
12.7 EMC CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
12.7.1 Functional EMS (Electro Magnetic Susceptibility) . . . . . . . . . . . . . . . . . . . . . . . . 179
12.7.2 Electro Magnetic Interference (EMI) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
12.7.3 Absolute Maximum Ratings (Electrical Sensitivity) . . . . . . . . . . . . . . . . . . . . . . . 181
12.8 I/O PORT PIN CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
12.8.1 General Characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
12.8.2 Output Driving Current . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183
12.9 CONTROL PIN CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
12.9.1 Asynchronous RESET Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
12.9.2 ICCSEL/VPP Pin . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
12.10TIMER PERIPHERAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
12.10.1 8-Bit PWM-ART Auto-Reload Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
12.10.2 16-Bit Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
12.11COMMUNICATION INTERFACE CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . 189
12.11.1 SPI - Serial Peripheral Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
12.11.2 I2C - Inter IC Control Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
12.11.3 CAN - Controller Area Network Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
12.1210-BIT ADC CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
12.12.1 Analog Power Supply and Reference Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
12.12.2 General PCB Design Guidelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195
5/215
Table of Contents
12.12.3 ADC Accuracy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196
13 PACKAGE CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
13.1 PACKAGE MECHANICAL DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197
13.2 THERMAL CHARACTERISTICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
13.3 SOLDERING INFORMATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 200
14 ST72521 DEVICE CONFIGURATION AND ORDERING INFORMATION . . . . . . . . . . . . . . . 201
14.1 FLASH OPTION BYTES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
14.2 DEVICE ORDERING INFORMATION AND TRANSFER OF CUSTOMER CODE . . . . . 203
14.2.1 Version-Specific Sales Conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
14.3 DEVELOPMENT TOOLS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
14.3.1 Socket and Emulator Adapter Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 207
14.4 ST7 APPLICATION NOTES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 208
15 KNOWN LIMITATIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.1 ALL FLASH AND ROM DEVICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.1.1 External RC option . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.1.2 Safe Connection of OSC1/OSC2 Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.1.3 Reset pin protection with LVD Enabled . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.1.4 Unexpected Reset Fetch . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211
15.1.5 Clearing active interrupts outside interrupt routine . . . . . . . . . . . . . . . . . . . . . . . 211
15.1.6 SCI Wrong Break duration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.1.7 16-bit Timer PWM Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.1.8 CAN Cell Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.1.9 I2C Multimaster . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 212
15.2 ALL FLASH DEVICES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
15.2.1 Internal RC Oscillator with LVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
15.2.2 I/O behaviour during ICC mode entry sequence . . . . . . . . . . . . . . . . . . . . . . . . . 213
15.2.3 Read-out protection with LVD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213
16 REVISION HISTORY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
215
6/215
ST72F521, ST72521B
EVD AVD
WATCHDOG
OSC1
OSC
OSC2
I2C
ADDRESS AND DATA BUS
PA7:0
MCC/RTC/BEEP (8-bits)
PORT A
PORT F
PF7:0 PORT B
(8-bits) PB7:0
TIMER A (8-bits)
PWM ART
BEEP
PORT C
PORT E
TIMER B PC7:0
PE7:0 (8-bits)
(8-bits)
CAN
SPI
SCI
PORT G1 PG7:0
PORT D (8-bits)
PD7:0
(8-bits)
10-BIT ADC PORT H1 PH7:0
(8-bits)
VAREF
VSSA
7/215
ST72F521, ST72521B
2 PIN DESCRIPTION
Figure 2. 80-Pin TQFP 14x14 Package Pinout
VPP / ICCSEL
PE2 / CANTX
PE0 / TDO
PE1 / RDI
PA5 (HS)
PA4 (HS)
RESET
VDD_2
VSS_2
OSC1
OSC2
EVD
PH7
PH6
PH5
PH4
TLI
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
(HS) PE4 1 60 VSS_1
(HS) PE5 2 59 VDD_1
(HS) PE6 3 58 PA3 (HS)
(HS) PE7 4 ei0 57 PA2
PWM3 / PB0 5 56 PA1
PWM2 / PB1 6 55 PA0
ei2
PWM1 / PB2 7 54 PC7 / SS / AIN15
PWM0 / PB3 8 53 PC6 / SCK /ICCCLK
PG0 9 52 PH3
PG1 10 51 PH2
PG2 11 50 PH1
PG3 12 49 PH0
ARTCLK / (HS) PB4 13 48 PC5 / MOSI / AIN14
ARTIC1 / PB5 14 47 PC4 / MISO / ICCDATA
ARTIC2 / PB6 15 ei3 46 PC3 (HS) /ICAP1_B
PB7 16 45 PC2(HS) / ICAP2_B
AIN0 / PD0 17 44 PC1 / OCMP1_B / AIN13
AIN1 / PD1 18 43 PC0 / OCMP2_B /AIN12
AIN2 / PD2 19 42 VSS_0
ei1
AIN3 / PD3 20 41 VDD_0
21
22
23
24
25
26
27
28
29
30
32
34
35
36
37
38
39
40
31
33
VAREF
VDD3
VSS3
PG4
PG5
MCO /AIN8 / PF0
AIN5 / PD5
AIN6 / PD6
AIN7 / PD7
OCMP1_A/AIN10 /PF4
ICAP2_A/ AIN11 /PF5
8/215
ST72F521, ST72521B
VPP / ICCSEL
PE2 / CANTX
PE0 / TDO
PE1 / RDI
PA5 (HS)
PA4 (HS)
RESET
VDD_2
VSS_2
OSC1
OSC2
EVD
TLI
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
(HS) PE4 1 48 VSS_1
(HS) PE5 2 47 VDD_1
(HS) PE6 3 46 PA3 (HS)
(HS) PE7 4 45 PA2
ei0
PWM3 / PB0 5 44 PA1
PWM2 / PB1 6 43 PA0
PWM1 / PB2 ei2 42 PC7 / SS / AIN15
7
PWM0 / PB3 8 41 PC6 / SCK / ICCCLK
ARTCLK / (HS) PB4 9 40 PC5 / MOSI / AIN14
ARTIC1 / PB5 10 39 PC4 / MISO / ICCDATA
ARTIC2 / PB6 11 ei3 38 PC3 (HS) / ICAP1_B
PB7 12 37 PC2 (HS) / ICAP2_B
AIN0 / PD0 13 36 PC1 / OCMP1_B / AIN13
AIN1 / PD1 14 35 PC0 / OCMP2_B / AIN12
AIN2 / PD2 15 ei1 34 VSS_0
AIN3 / PD3 16 33 VDD_0
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
ICAP1_A / (HS) PF6
BEEP / (HS) PF1
(HS) PF2
9/215
ST72F521, ST72521B
function
TQFP80
TQFP64
Input Output
Output
(after
float
wpu
ana
reset)
OD
PP
int
10/215
ST72F521, ST72521B
Type
function
TQFP80
TQFP64
Input Output
Output
Pin Name Alternate function
Input
(after
float
wpu
ana
reset)
OD
PP
int
24 18 PD5/AIN5 I/O CT X X X X X Port D5 ADC Analog Input 5
25 19 PD6/AIN6 I/O CT X X X X X Port D6 ADC Analog Input 6
26 20 PD7/AIN7 I/O CT X X X X X Port D7 ADC Analog Input 7
27 21 VAREF I Analog Reference Voltage for ADC
28 22 VSSA S Analog Ground Voltage
29 23 VDD_3 S Digital Main Supply Voltage
30 24 VSS_3 S Digital Ground Voltage
31 - PG4 I/O TT X X X X Port G4
32 - PG5 I/O TT X X X X Port G5
Main clock ADC Analog
33 25 PF0/MCO/AIN8 I/O CT X ei1 X X X Port F0
out (fCPU) Input 8
34 26 PF1 (HS)/BEEP I/O CT HS X ei1 X X Port F1 Beep signal output
35 27 PF2 (HS) I/O CT HS X ei1 X X Port F2
Timer A Out-
ADC Analog
36 28 PF3/OCMP2_A/AIN9 I/O CT X X X X X Port F3 put Compare
Input 9
2
Timer A Out-
ADC Analog
37 29 PF4/OCMP1_A/AIN10 I/O CT X X X X X Port F4 put Compare
Input 10
1
Timer A Input ADC Analog
38 30 PF5/ICAP2_A/AIN11 I/O CT X X X X X Port F5
Capture 2 Input 11
39 31 PF6 (HS)/ICAP1_A I/O CT HS X X X X Port F6 Timer A Input Capture 1
Timer A External Clock
40 32 PF7 (HS)/EXTCLK_A I/O CT HS X X X X Port F7
Source
41 33 VDD_0 S Digital Main Supply Voltage
42 34 VSS_0 S Digital Ground Voltage
Timer B Out-
ADC Analog
43 35 PC0/OCMP2_B/AIN12 I/O CT X X X X X Port C0 put Compare
Input 12
2
Timer B Out-
ADC Analog
44 36 PC1/OCMP1_B/AIN13 I/O CT X X X X X Port C1 put Compare
Input 13
1
45 37 PC2 (HS)/ICAP2_B I/O CT HS X X X X Port C2 Timer B Input Capture 2
46 38 PC3 (HS)/ICAP1_B I/O CT HS X X X X Port C3 Timer B Input Capture 1
SPI Master In
ICC Data In-
47 39 PC4/MISO/ICCDATA I/O CT X X X X Port C4 / Slave Out
put
Data
SPI Master
ADC Analog
48 40 PC5/MOSI/AIN14 I/O CT X X X X X Port C5 Out / Slave In
Input 14
Data
49 - PH0 I/O TT X X X X Port H0
50 - PH1 I/O TT X X X X Port H1
51 - PH2 I/O TT X X X X Port H2
11/215
ST72F521, ST72521B
Type
function
TQFP80
TQFP64
Input Output
Output
Pin Name Alternate function
Input
(after
float
wpu
ana
reset)
OD
PP
int
52 - PH3 I/O TT X X X X Port H3
SPI Serial ICC Clock
Clock Output
53 41 PC6/SCK/ICCCLK I/O CT X X X X Port C6 Caution: Negative current
injection not allowed on this
pin5)
SPI Slave
ADC Analog
54 42 PC7/SS/AIN15 I/O CT X X X X X Port C7 Select (active
Input 15
low)
55 43 PA0 I/O CT X ei0 X X Port A0
56 44 PA1 I/O CT X ei0 X X Port A1
57 45 PA2 I/O CT X ei0 X X Port A2
58 46 PA3 (HS) I/O CT HS X ei0 X X Port A3
59 47 VDD_1 S Digital Main Supply Voltage
60 48 VSS_1 S Digital Ground Voltage
61 49 PA4 (HS) I/O CT HS X X X X Port A4
62 50 PA5 (HS) I/O CT HS X X X X Port A5
63 51 PA6 (HS)/SDAI I/O CT HS X T Port A6 I2C Data 1)
64 52 PA7 (HS)/SCLI I/O CT HS X T Port A7 I2C Clock 1)
Must be tied low. In flash programming
mode, this pin acts as the programming
65 53 VPP/ ICCSEL I voltage input VPP. See Section 12.9.2
for more details. High voltage must not
be applied to ROM devices
66 54 RESET I/O CT Top priority non maskable interrupt.
67 55 EVD External voltage detector
68 56 TLI I CT X X Top level interrupt input pin
69 - PH4 I/O TT X X X X Port H4
70 - PH5 I/O TT X X X X Port H5
71 - PH6 I/O TT X X X X Port H6
72 - PH7 I/O TT X X X X Port H7
73 57 VSS_2 S Digital Ground Voltage
74 58 OSC23) I/O Resonator oscillator inverter output
External clock input or Resonator oscil-
75 59 OSC13) I
lator inverter input
76 60 VDD_2 S Digital Main Supply Voltage
77 61 PE0/TDO I/O CT X X X X Port E0 SCI Transmit Data Out
78 62 PE1/RDI I/O CT X X X X Port E1 SCI Receive Data In
79 63 PE2/CANTX I/O CT X Port E2 CAN Transmit Data Output
80 64 PE3/CANRX I/O CT X X X X Port E3 CAN Receive Data Input
Notes:
1. In the interrupt input column, “eiX” defines the associated external interrupt vector. If the weak pull-up
12/215
ST72F521, ST72521B
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). See See “I/O PORTS” on page 47. and Section 12.8 I/O PORT PIN CHARACTER-
ISTICS for more details.
3. OSC1 and OSC2 pins connect a crystal/ceramic resonator, or an external source to the on-chip oscil-
lator; see Section 1 INTRODUCTION and Section 12.5 CLOCK AND TIMING CHARACTERISTICS for
more details.
4. On the chip, each I/O port may have up to 8 pads. Pads that are not bonded to external pins are in input
pull-up configuration after reset. The configuration of these pads must be kept at reset state to avoid add-
ed current consumption.
13/215
ST72F521, ST72521B
0000h 0080h
HW Registers
Short Addressing
(see Table 2)
007Fh RAM (zero page)
0080h 00FFh
0100h
RAM 256 Bytes Stack
(2048 or 1024 Bytes)
01FFh
0200h 1000h
087Fh 16-bit Addressing 60 KBytes
0880h
Reserved RAM
or 047Fh
0FFFh or 067Fh
1000h or 087Fh 8000h
Program Memory 32 KBytes
(60K or 32K)
FFDFh
FFE0h
Interrupt & Reset Vectors
(see Table 7) FFFFh
FFFFh
14/215
ST72F521, ST72521B
Register Reset
Address Block Register Name Remarks
Label Status
001Fh
Reserved Area (2 Bytes)
0020h
15/215
ST72F521, ST72521B
Register Reset
Address Block Register Name Remarks
Label Status
002Eh
to Reserved Area (3 Bytes)
0030h
16/215
ST72F521, ST72521B
Register Reset
Address Block Register Name Remarks
Label Status
0058h
Reserved Area (2 Bytes)
0059h
007Eh
Reserved Area (2 Bytes)
007Fh
Notes:
1. The contents of the I/O port DR registers are readable only in output configuration. In input configura-
tion, the values of the I/O pins are returned instead of the DR register contents.
2. The bits associated with unavailable pins must always keep their reset value.
17/215
ST72F521, ST72521B
4.1 Introduction sectors (see Table 3). Each of these sectors can
be erased independently to avoid unnecessary
The ST7 dual voltage High Density Flash erasing of the whole Flash memory when only a
(HDFlash) is a non-volatile memory that can be partial erasing is required.
electrically erased as a single block or by individu-
al sectors and programmed on a Byte-by-Byte ba- The first two sectors have a fixed size of 4 Kbytes
sis using an external VPP supply. (see Figure 5). They are mapped in the upper part
of the ST7 addressing space so the reset and in-
The HDFlash devices can be programmed and terrupt vectors are located in Sector 0 (F000h-
erased off-board (plugged in a programming tool) FFFFh).
or on-board using ICP (In-Circuit Programming) or
IAP (In-Application Programming). Table 3. Sectors available in Flash devices
The array matrix organisation allows each sector
to be erased and reprogrammed without affecting Flash Size (bytes) Available Sectors
other sectors. 4K Sector 0
8K Sectors 0,1
4.2 Main Features > 8K Sectors 0,1, 2
■ Three Flash programming modes:
– Insertion in a programming tool. In this mode, 4.3.1 Read-out Protection
all sectors including option bytes can be pro- Read-out protection, when selected, provides a
grammed or erased. protection against Program Memory content ex-
– ICP (In-Circuit Programming). In this mode, all traction and against write access to Flash memo-
sectors including option bytes can be pro-
grammed or erased without removing the de- ry. Even if no protection can be considered as to-
vice from the application board. tally unbreakable, the feature provides a very high
– IAP (In-Application Programming) In this level of protection for a general purpose microcon-
mode, all sectors except Sector 0, can be pro- troller.
grammed or erased without removing the de- In flash devices, this protection is removed by re-
vice from the application board and while the
application is running. programming the option. In this case, the entire
■ ICT (In-Circuit Testing) for downloading and program memory is first automatically erased and
executing user application test patterns in RAM the device can be reprogrammed.
■ Read-out protection Read-out protection selection depends on the de-
vice type:
■ Register Access Security System (RASS) to
prevent accidental programming or erasing – In Flash devices it is enabled and removed
through the FMP_R bit in the option byte.
4.3 Structure – In ROM devices it is enabled by mask option
specified in the Option List.
The Flash memory is organised in sectors and can
be used for both code and data storage. Note: In flash devices, the LVD is not supported if
read-out protection is enabled.
Depending on the overall Flash memory size in the
microcontroller device, there are up to three user
Figure 5. Memory Map and Sector Address
4K 8K 10K 16K 24K 32K 48K 60K FLASH
1000h MEMORY SIZE
3FFFh
7FFFh
9FFFh
SECTOR 2
BFFFh
D7FFh
2 Kbytes 8 Kbytes 16 Kbytes 24 Kbytes 40 Kbytes 52 Kbytes
DFFFh
EFFFh
4 Kbytes SECTOR 1
FFFFh
4 Kbytes SECTOR 0
18/215
ST72F521, ST72521B
ICC Cable
APPLICATION BOARD
10 8 6 4 2
APPLICATION
RESET SOURCE
See Note 2
10kΩ
APPLICATION
RESET
ICCCLK
ICCDATA
OSC1
ICCSEL/VPP
OSC2
VSS
VDD
I/O
ST7
Notes:
1. If the ICCCLK or ICCDATA pins are only used agement IC with open drain output and pull-up re-
as outputs in the application, no signal isolation is sistor>1K, no additional components are needed.
necessary. As soon as the Programming Tool is In all cases the user must ensure that no external
plugged to the board, even if an ICC session is not reset is generated by the application during the
in progress, the ICCCLK and ICCDATA pins are ICC session.
not available for the application. If they are used as 3. The use of Pin 7 of the ICC connector depends
inputs by the application, isolation such as a serial on the Programming Tool architecture. This pin
resistor has to implemented in case another de- must be connected when using most ST Program-
vice forces the signal. Refer to the Programming ming Tools (it is used to monitor the application
Tool documentation for recommended resistor val- power supply). Please refer to the Programming
ues. Tool manual.
2. During the ICC session, the programming tool 4. Pin 9 has to be connected to the OSC1 or OS-
must control the RESET pin. This can lead to con- CIN pin of the ST7 when the clock is not available
flicts between the programming tool and the appli- in the application or if the selected clock option is
cation reset circuit if it drives more than 5mA at not programmed in the option byte. ST7 devices
high level (push pull output or pull-up resistor<1K). with multi-oscillator capability need to have OSC2
A schottky diode can be used to isolate the appli- grounded in this case.
cation RESET circuit in this case. When using a
classical RC network with R>1K or a reset man-
19/215
ST72F521, ST72521B
4.5 ICP (In-Circuit Programming) possible to download code from the SPI, SCI, USB
or CAN interface and program it in the Flash. IAP
To perform ICP the microcontroller must be mode can be used to program any of the Flash
switched to ICC (In-Circuit Communication) mode sectors except Sector 0, which is write/erase pro-
by an external controller or programming tool. tected to allow recovery in case errors occur dur-
Depending on the ICP code downloaded in RAM, ing the programming operation.
Flash memory programming can be fully custom-
ized (number of bytes to program, program loca- 4.7 Related Documentation
tions, or selection serial communication interface
for downloading). For details on Flash programming and ICC proto-
When using an STMicroelectronics or third-party col, refer to the ST7 Flash Programming Refer-
programming tool that supports ICP and the spe- ence Manual and to the ST7 ICC Protocol Refer-
cific microcontroller device, the user needs only to ence Manual.
implement the ICP hardware interface on the ap- 4.7.1 Register Description
plication board (see Figure 6). For more details on FLASH CONTROL/STATUS REGISTER (FCSR)
the pin locations, refer to the device pinout de-
scription. Read/Write
Reset Value: 0000 0000 (00h)
4.6 IAP (In-Application Programming)
7 0
This mode uses a BootLoader program previously
stored in Sector 0 by the user (in ICP mode or by
0 0 0 0 0 0 0 0
plugging the device in a programming tool).
This mode is fully controlled by user software. This
allows it to be adapted to the user application, (us- This register is reserved for use by Programming
er-defined strategy for entering programming Tool software. It controls the Flash programming
mode, choice of communications protocol used to and erasing operations.
fetch the data to be stored, etc.). For example, it is
Figure 7. Flash Control/Status Register Address and Reset Value
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
FCSR
0029h
Reset Value 0 0 0 0 0 0 0 0
20/215
ST72F521, ST72521B
7 0
ACCUMULATOR
RESET VALUE = XXh
7 0
X INDEX REGISTER
RESET VALUE = XXh
7 0
Y INDEX REGISTER
RESET VALUE = XXh
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
21/215
ST72F521, ST72521B
22/215
ST72F521, ST72521B
@ 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
23/215
ST72F521, ST72521B
LOW VOLTAGE
VSS DETECTOR
VDD (LVD)
0 AUXILIARY VOLTAGE
DETECTOR
EVD 1
(AVD)
24/215
ST72F521, ST72521B
External Clock
the ST7 main oscillator may start and, in this con- OSC1 OSC2
figuration, could generate an fOSC clock frequency
in excess of the allowed maximum (>16MHz.),
putting the ST7 in an unsafe/undefined state. The
product behaviour must therefore be considered EXTERNAL
undefined when the OSC pins are left unconnect- SOURCE
ed.
Crystal/Ceramic Resonators
25/215
ST72F521, ST72521B
VDD
RON
Filter INTERNAL
RESET
RESET
PULSE
WATCHDOG RESET
GENERATOR
LVD RESET
26/215
ST72F521, ST72521B
VIT+(LVD)
VIT-(LVD)
tw(RSTL)out tw(RSTL)out
DELAY
EXTERNAL
RESET
SOURCE
RESET PIN
WATCHDOG
RESET
WATCHDOG UNDERFLOW
27/215
ST72F521, ST72521B
VDD
Vhys
VIT+
VIT-
RESET
28/215
ST72F521, ST72521B
VDD
Early Warning Interrupt
(Power has dropped, MCU not
not yet in reset)
Vhyst
VIT+(AVD)
VIT-(AVD)
VIT+(LVD)
AVD INTERRUPT
REQUEST
IF AVDIE bit = 1
INTERRUPT PROCESS INTERRUPT PROCESS
LVD RESET
29/215
ST72F521, ST72521B
VEVD
Vhyst
VIT+(EVD)
VIT-(EVD)
AVDF 0 1 0
AVD INTERRUPT
REQUEST
IF AVDIE = 1
INTERRUPT PROCESS INTERRUPT PROCESS
30/215
ST72F521, ST72521B
31/215
ST72F521, ST72521B
32/215
ST72F521, ST72521B
7 INTERRUPTS
7.1 INTRODUCTION each interrupt vector (see Table 5). The process-
ing flow is shown in Figure 18
The ST7 enhanced interrupt management pro-
vides the following features: When an interrupt request has to be serviced:
■ Hardware interrupts – Normal processing is suspended at the end of
■ Software interrupt (TRAP)
the current instruction execution.
■ Nested or concurrent interrupt management
– The PC, X, A and CC registers are saved onto
with flexible interrupt priority and level the stack.
management: – I1 and I0 bits of CC register are set according to
the corresponding values in the ISPRx registers
– Up to 4 software programmable nesting levels of the serviced interrupt vector.
– Up to 16 interrupt vectors fixed by hardware
– The PC is then loaded with the interrupt vector of
– 2 non maskable events: RESET, TRAP the interrupt to service and the first instruction of
– 1 maskable Top Level event: TLI the interrupt service routine is fetched (refer to
This interrupt management is based on: “Interrupt Mapping” table for vector addresses).
– Bit 5 and bit 3 of the CPU CC register (I1:0), The interrupt service routine should end with the
IRET instruction which causes the contents of the
– Interrupt software priority registers (ISPRx), saved registers to be recovered from the stack.
– Fixed interrupt vector addresses located at the
high addresses of the memory map (FFE0h to Note: As a consequence of the IRET instruction,
FFFFh) sorted by hardware priority order. the I1 and I0 bits will be restored from the stack
and the program in the previous level will resume.
This enhanced interrupt controller guarantees full
upward compatibility with the standard (not nest-
ed) ST7 interrupt controller. Table 5. Interrupt Software Priority Levels
Interrupt software priority Level I1 I0
7.2 MASKING AND PROCESSING FLOW Level 0 (main) Low 1 0
The interrupt masking is managed by the I1 and I0 Level 1 0 1
bits of the CC register and the ISPRx registers Level 2 0 0
which give the interrupt software priority level of Level 3 (= interrupt disable) High 1 1
PENDING Y Y
RESET TRAP
INTERRUPT
Y
“IRET”
33/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
Servicing Pending Interrupts ■ TRAP (Non Maskable Software Interrupt)
As several interrupts can be pending at the same This software interrupt is serviced when the TRAP
time, the interrupt to be taken into account is deter- instruction is executed. It will be serviced accord-
mined by the following two-step process: ing to the flowchart in Figure 18.
– the highest software priority interrupt is serviced, Caution: TRAP can be interrupted by a TLI.
– if several interrupts have the same software pri- ■ RESET
ority then the interrupt with the highest hardware The RESET source has the highest priority in the
priority is serviced first. ST7. This means that the first current routine has
Figure 19 describes this decision process. the highest software priority (level 3) and the high-
est hardware priority.
Figure 19. Priority Decision Process See the RESET chapter for more details.
PENDING Maskable Sources
INTERRUPTS
Maskable interrupt vector sources can be serviced
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
Same SOFTWARE Different
and I0 in CC register). If any of these two condi-
PRIORITY tions is false, the interrupt is latched and thus re-
mains pending.
■ TLI (Top Level Hardware Interrupt)
HIGHEST SOFTWARE
PRIORITY SERVICED This hardware interrupt occurs when a specific
edge is detected on the dedicated TLI pin. It will be
serviced according to the flowchart in Figure 18 as
HIGHEST HARDWARE
a trap.
PRIORITY SERVICED
Caution: A TRAP instruction must not be used in a
TLI service routine.
When an interrupt request is not serviced immedi- ■ External Interrupts
ately, it is latched and then processed when its External interrupts allow the processor to exit from
software priority combined with the hardware pri- HALT low power mode. External interrupt sensitiv-
ority becomes the highest one. ity is software selectable through the External In-
Note 1: The hardware priority is exclusive while terrupt Control register (EICR).
the software one is not. This allows the previous External interrupt triggered on edge will be latched
process to succeed with only one interrupt. and the interrupt request automatically cleared
Note 2: TLI, RESET and TRAP can be considered upon entering the interrupt service routine.
as having the highest software priority in the deci- If several input pins of a group connected to the
sion process. same interrupt line are selected simultaneously,
these will be logically ORed.
Different Interrupt Vector Sources
■ Peripheral Interrupts
Two interrupt source types are managed by the
ST7 interrupt controller: the non-maskable type Usually the peripheral interrupts cause the MCU to
(RESET, TRAP) and the maskable type (external exit from HALT mode except those mentioned in
or from internal peripherals). the “Interrupt Mapping” table. A peripheral inter-
rupt occurs when a specific flag is set in the pe-
Non-Maskable Sources ripheral status registers and if the corresponding
enable bit is set in the peripheral control register.
These sources are processed regardless of the
The general sequence for clearing an interrupt is
state of the I1 and I0 bits of the CC register (see
based on an access to the status register followed
Figure 18). After stacking the PC, X, A and CC
by a read or write to an associated register.
registers (except for RESET), the corresponding
Note: The clearing sequence resets the internal
vector is loaded in the PC register and the I1 and
latch. A pending interrupt (i.e. waiting for being
I0 bits of the CC are set to disable interrupts (level
serviced) will therefore be lost if the clear se-
3). These sources allow the processor to exit
quence is executed.
HALT mode.
34/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
7.3 INTERRUPTS AND LOW POWER MODES 7.4 CONCURRENT & NESTED MANAGEMENT
All interrupts allow the processor to exit the WAIT The following Figure 20 and Figure 21 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 21. 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 19. 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 20. 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
35/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
7 0
ISPR0 I1_3 I0_3 I1_2 I0_2 I1_1 I0_1 I1_0 I0_0
1 1 I1 H I0 N Z C
ISPR1 I1_7 I0_7 I1_6 I0_6 I1_5 I0_5 I1_4 I0_4
*Note: TLI, TRAP and RESET events can interrupt – Each I1_x and I0_x bit value in the ISPRx regis-
a level 3 program. ters has the same meaning as the I1 and I0 bits
in the CC register.
– Level 0 can not be written (I1_x=1, I0_x=0). In
this case, the previously stored value is kept. (ex-
ample: previous=CFh, write=64h, result=44h)
The TLI, RESET, and TRAP vectors have no soft-
ware priorities. When one is serviced, the I1 and I0
bits of the CC register are both set.
*Note: Bits in the ISPRx registers which corre-
spond to the TLI can be read and written but they
are not significant in the interrupt process man-
agement.
Caution: If the I1_x and I0_x bits are modified
while the interrupt x is executed the following be-
haviour has to be considered: If the interrupt x is
still pending (new interrupt or flag not cleared) and
the new software priority is higher than the previ-
ous one, the interrupt x is re-entered. Otherwise,
the software priority stays unchanged up to the
next interrupt request (after the IRET of the inter-
rupt x).
36/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
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.
37/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
Table 7. Interrupt Mapping
Exit
from
Source Register Priority Address
N° Description HALT/
Block Label Order Vector
ACTIVE
HALT3)
RESET Reset yes FFFEh-FFFFh
N/A
TRAP Software interrupt no FFFCh-FFFDh
0 TLI External top level interrupt EICR yes FFFAh-FFFBh
1 MCC/RTC Main clock controller time base interrupt MCCSR Higher yes FFF8h-FFF9h
2 ei0 External interrupt port A3..0 Priority yes FFF6h-FFF7h
3 ei1 External interrupt port F2..0 yes FFF4h-FFF5h
N/A
4 ei2 External interrupt port B3..0 yes FFF2h-FFF3h
5 ei3 External interrupt port B7..4 yes FFF0h-FFF1h
6 CAN CAN peripheral interrupts CANISR yes FFEEh-FFEFh
7 SPI SPI peripheral interrupts SPICSR yes1 FFECh-FFEDh
8 TIMER A TIMER A peripheral interrupts TASR no FFEAh-FFEBh
9 TIMER B TIMER B peripheral interrupts TBSR no FFE8h-FFE9h
10 SCI SCI Peripheral interrupts SCISR Lower no FFE6h-FFE7h
11 AVD Auxiliary Voltage detector interrupt SICSR Priority no FFE4h-FFE5h
12 I2C I2C Peripheral interrupts (see periph) no FFE2h-FFE3h
13 PWM ART PWM ART interrupt ARTCSR yes2 FFE0h-FFE1h
Notes:
1. Exit from HALT possible when SPI is in slave mode.
2. Exit from HALT possible when PWM ART is in external clock mode.
3. In Flash devices only a RESET or MCC/RTC interrupt can be used to wake-up from Active Halt mode.
38/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
Figure 22. External Interrupt Control bits
IS20 IS21
PAOR.3
PADDR.3
SENSITIVITY PA3
PA3 ei0 INTERRUPT SOURCE
CONTROL PA2
PA1
PA0
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.7
PBDDR.7
SENSITIVITY PB7
PB7 PB6 ei3 INTERRUPT SOURCE
CONTROL
PB5
PB4
39/215
ST72F521, ST72521B
40/215
ST72F521, ST72521B
INTERRUPTS (Cont’d)
Table 8. Nested Interrupts Register Map and Reset Values
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
ei1 ei0 MCC TLI
0024h ISPR0 I1_3 I0_3 I1_2 I0_2 I1_1 I0_1
Reset Value 1 1 1 1 1 1 1 1
SPI CAN 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
AVD SCI TIMER B TIMER A
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
PWMART I2C
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 TLIS TLIE
0028h
Reset Value 0 0 0 0 0 0 0 0
41/215
ST72F521, ST72521B
RUN fCPU
SLOW fOSC2
MCCSR
CP1:0 00 01
WAIT
SMS
SLOW WAIT
NORMAL RUN MODE
NEW SLOW REQUEST
FREQUENCY
ACTIVE HALT REQUEST
HALT
Low
POWER CONSUMPTION
42/215
ST72F521, ST72521B
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.
43/215
ST72F521, ST72521B
8.4 ACTIVE-HALT AND HALT MODES lay depending on option byte). Otherwise, the ST7
enters HALT mode for the remaining tDELAY peri-
ACTIVE-HALT and HALT modes are the two low- od.
est power consumption modes of the MCU. They
are both entered by executing the ‘HALT’ instruc- Figure 26. ACTIVE-HALT Timing Overview
tion. The decision to enter either in ACTIVE-HALT
or HALT mode is given by the MCC/RTC interrupt ACTIVE 256 OR 4096 CPU
enable flag (OIE bit in MCCSR register). RUN HALT CYCLE DELAY 1) RUN
44/215
ST72F521, ST72521B
45/215
ST72F521, ST72521B
46/215
ST72F521, ST72521B
9 I/O PORTS
47/215
ST72F521, ST72521B
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.
48/215
ST72F521, ST72521B
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.
49/215
ST72F521, ST72521B
50/215
ST72F521, ST72521B
51/215
ST72F521, ST72521B
52/215
ST72F521, ST72521B
10 ON-CHIP PERIPHERALS
RESET
fOSC2
MCC/RTC
WATCHDOG CONTROL REGISTER (WDGCR)
DIV 64 WDGA T6 T5 T4 T3 T2 T1 T0
12-BIT MCC
RTC COUNTER WDG PRESCALER
TB[1:0] bits DIV 4
MSB LSB
(MCCSR
11 6 5 0
Register)
53/215
ST72F521, ST72521B
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
54/215
ST72F521, ST72521B
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
55/215
ST72F521, ST72521B
56/215
ST72F521, ST72521B
57/215
ST72F521, ST72521B
10.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
10.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-
10.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 8.2 SLOW MODE for more details). the ST7 enters ACTIVE-HALT mode when the
The prescaler selects the fCPU main clock frequen- HALT instruction is executed. See Section 8.4 AC-
cy and is controlled by three bits in the MCCSR TIVE-HALT AND HALT MODES for more details.
register: CP[1:0] and SMS. 10.2.4 Beeper
10.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 fCPU clock to drive on the BEEP pin (I/O port alternate function).
BC1 BC0
MCCBCR
BEEP
BEEP SIGNAL
SELECTION
MCO
58/215
ST72F521, ST72521B
59/215
ST72F521, ST72521B
0 0 Off
0 1 ~2-KHz
Output
1 0 ~1-KHz Beep signal
~50% duty cycle
1 1 ~500-Hz
60/215
ST72F521, ST72521B
LOAD
PORT
POLARITY
PWMx ALTERNATE COMPARE
FUNCTION CONTROL
ICx INTERRUPT
fEXT
ARTCLK
fCOUNTER
fCPU
MUX
fINPUT PROGRAMMABLE
PRESCALER
OVF INTERRUPT
61/215
ST72F521, ST72521B
fCOUNTER
ARTARR=FDh
COUNTER FDh FEh FFh FDh FEh FFh FDh FEh FFh
PWMx
62/215
ST72F521, ST72521B
255
DUTY CYCLE
REGISTER
COUNTER
(PWMDCRx)
AUTO-RELOAD
REGISTER
(ARTARR)
000
t
PWMx OUTPUT
WITH OEx=1
AND OPx=0
WITH OEx=1
AND OPx=1
ARTARR=FDh
OCRx=FCh
PWMx OUTPUT
WITH OEx=1
AND OPx=0
OCRx=FDh
OCRx=FEh
OCRx=FFh
63/215
ST72F521, ST72521B
fEXT=fCOUNTER
ARTARR=FDh
OVF
INTERRUPT INTERRUPT
IF OIE=1 IF OIE=1
64/215
ST72F521, ST72521B
fCOUNTER
COUNTER
01h 02h 03h 04h 05h 06h 07h
CFx FLAG
xxh 04h
ICRx REGISTER
t
65/215
ST72F521, ST72521B
Bit 7 = EXCL External Clock CA7 CA6 CA5 CA4 CA3 CA2 CA1 CA0
This bit is set and cleared by software. It selects the
input clock for the 7-bit prescaler.
0: CPU clock. Bit 7:0 = CA[7:0] Counter Access Data
1: External clock. These bits can be set and cleared either by hard-
Bit 6:4 = CC[2:0] Counter Clock Control ware or by software. The ARTCAR register is used
These bits are set and cleared by software. They to read or write the auto-reload counter “on the fly”
determine the prescaler division ratio from fINPUT. (while it is counting).
66/215
ST72F521, ST72521B
OE3 OE2 OE1 OE0 OP3 OP2 OP1 OP0 DC7 DC6 DC5 DC4 DC3 DC2 DC1 DC0
Bit 7:4 = OE[3:0] PWM Output Enable Bit 7:0 = DC[7:0] Duty Cycle Data
These bits are set and cleared by software. They These bits are set and cleared by software.
enable or disable the PWM output channels inde-
pendently acting on the corresponding I/O pin. A PWMDCRx register is associated with the OCRx
0: PWM output disabled. register of each PWM channel to determine the
1: PWM output enabled. second edge location of the PWM signal (the first
edge location is common to all channels and given
by the ARTARR register). These PWMDCR regis-
Bit 3:0 = OP[3:0] PWM Output Polarity ters allow the duty cycle to be set independently
These bits are set and cleared by software. They for each PWM channel.
independently select the polarity of the four PWM
output signals.
PWMx output level
OPx
Counter <= OCRx Counter > OCRx
1 0 0
0 1 1
67/215
ST72F521, ST72521B
68/215
ST72F521, ST72521B
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
69/215
ST72F521, ST72521B
70/215
ST72F521, ST72521B
fCPU
MCU-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)
71/215
ST72F521, ST72521B
72/215
ST72F521, ST72521B
CPU CLOCK
INTERNAL RESET
TIMER CLOCK
CPU CLOCK
INTERNAL RESET
TIMER CLOCK
CPU CLOCK
INTERNAL RESET
TIMER CLOCK
Note: The MCU is in reset state when the internal reset signal is high, when it is low the MCU is running.
73/215
ST72F521, ST72521B
74/215
ST72F521, ST72521B
TIMER CLOCK
ICAPi PIN
ICAPi FLAG
75/215
ST72F521, ST72521B
76/215
ST72F521, ST72521B
77/215
ST72F521, ST72521B
TIMER CLOCK
TIMER CLOCK
78/215
ST72F521, ST72521B
79/215
ST72F521, ST72521B
ICAP1
Figure 52. Pulse Width Modulation Mode Timing Example with 2 Output Compare Functions
COUNTER 34E2 FFFC FFFD FFFE 2ED0 2ED1 2ED2 34E2 FFFC
Note: On timers with only 1 Output Compare register, a fixed frequency PWM signal can be generated us-
ing the output compare and the counter overflow to define the pulse length.
80/215
ST72F521, ST72521B
81/215
ST72F521, ST72521B
10.4.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).
82/215
ST72F521, ST72521B
83/215
ST72F521, ST72521B
84/215
ST72F521, ST72521B
85/215
ST72F521, ST72521B
86/215
ST72F521, ST72521B
MSB LSB
87/215
ST72F521, ST72521B
88/215
ST72F521, ST72521B
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
89/215
ST72F521, ST72521B
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
90/215
ST72F521, ST72521B
Master SS
Slave SS
(if CPHA=0)
Slave SS
(if CPHA=1)
SSM bit
SSI bit 1
SS internal
SS external pin 0
91/215
ST72F521, ST72521B
92/215
ST72F521, ST72521B
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.
93/215
ST72F521, ST72521B
RESULT
2nd Step Read SPIDR SPIF =0
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
94/215
ST72F521, ST72521B
SS SS SS SS
SCK SCK SCK SCK
Slave Slave Slave Slave
MCU MCU MCU MCU
MOSI MISO
SCK
Ports
Master
MCU
5V SS
95/215
ST72F521, ST72521B
96/215
ST72F521, ST72521B
97/215
ST72F521, ST72521B
98/215
ST72F521, ST72521B
99/215
ST72F521, ST72521B
100/215
ST72F521, ST72521B
TDO
RDI
CR1
R8 T8 SCID M WAKE PCE PS PIE
WAKE
TRANSMIT UP RECEIVER RECEIVER
CONTROL UNIT CONTROL CLOCK
CR2 SR
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
BRR
SCP1 SCP0 SCT2 SCT1 SCT0 SCR2 SCR1SCR0
RECEIVER RATE
CONTROL
101/215
ST72F521, ST72521B
Start
Idle Frame Bit
Start
Idle Frame Bit
102/215
ST72F521, ST72521B
103/215
ST72F521, ST72521B
104/215
ST72F521, ST72521B
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
105/215
ST72F521, ST72521B
106/215
ST72F521, ST72521B
107/215
ST72F521, ST72521B
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
108/215
ST72F521, ST72521B
109/215
ST72F521, ST72521B
110/215
ST72F521, ST72521B
111/215
ST72F521, ST72521B
112/215
ST72F521, ST72521B
113/215
ST72F521, ST72521B
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 different from 00h is stored in this when a value different from 00h is stored in this
register. Therefore the clock frequency issued register. Therefore the clock frequency issued
from the 16 divider (see Figure 62) is divided by from the 16 divider (see Figure 62) is divided by
the binary factor set in the SCIERPR register (in the binary factor set in the SCIETPR register (in
the range 1 to 255). the range 1 to 255).
The extended baud rate generator is not used af- The extended baud rate generator is not used af-
ter a reset. ter a reset.
Table 21. Baudrate Selection
Conditions
Baud
Symbol Parameter Accuracy Standard Unit
fCPU Prescaler Rate
vs. Standard
Conventional Mode
TR (or RR)=128, PR=13 300 ~300.48
TR (or RR)= 32, PR=13 1200 ~1201.92
TR (or RR)= 16, PR=13 2400 ~2403.84
~0.16% TR (or RR)= 8, PR=13 4800 ~4807.69
fTx TR (or RR)= 4, PR=13 9600 ~9615.38
Communication frequency 8MHz TR (or RR)= 16, PR= 3 10400 ~10416.67 Hz
fRx
TR (or RR)= 2, PR=13 19200 ~19230.77
TR (or RR)= 1, PR=13 38400 ~38461.54
Extended Mode
~0.79% ETPR (or ERPR) = 35, 14400 ~14285.71
TR (or RR)= 1, PR=1
114/215
ST72F521, ST72521B
115/215
ST72F521, ST72521B
■ 7-bit/10-bit Addressing
– Slave transmitter/receiver
■ SMBus V1.1 Compliant
– Master transmitter/receiver
■ Transmitter/Receiver flag By default, it operates in slave mode.
■ End-of-byte transmission flag The interface automatically switches from slave to
■ Transfer problem detection
master after it generates a START condition and
from master to slave in case of arbitration loss or a
I2C Master Features: STOP generation, allowing then Multi-Master ca-
■ Clock generation pability.
2
■ I C bus busy flag Communication Flow
■ Arbitration Lost Flag In Master mode, it initiates a data transfer and
■ End of byte transmission flag generates the clock signal. A serial data transfer
■ Transmitter/Receiver Flag
always begins with a start condition and ends with
a stop condition. Both start and stop conditions are
■ Start bit detection flag
generated in master mode by software.
■ Start and Stop generation
In Slave mode, the interface is capable of recog-
I2C Slave Features: nising its own address (7 or 10-bit), and the Gen-
■ Stop bit detection eral Call address. The General Call address de-
2
■ I C bus busy flag
tection may be enabled or disabled by software.
■ Detection of misplaced start or stop condition
Data and addresses are transferred as 8-bit bytes,
2 MSB first. The first byte(s) following the start con-
■ Programmable I C Address detection
dition contain the address (one in 7-bit mode, two
■ Transfer problem detection in 10-bit mode). The address is always transmitted
■ End-of-byte transmission flag in Master mode.
■ Transmitter/Receiver flag A 9th clock pulse follows the 8 clock cycles of a
10.7.3 General Description byte transfer, during which the receiver must send
an acknowledge bit to the transmitter. Refer to Fig-
In addition to receiving and transmitting data, this ure 64.
interface converts it from serial to parallel format
Figure 64. I2C BUS Protocol
SDA
MSB ACK
SCL
1 2 8 9
START STOP
CONDITION CONDITION
VR02119B
116/215
ST72F521, ST72521B
COMPARATOR
INTERRUPT
117/215
ST72F521, ST72521B
118/215
ST72F521, ST72521B
10.7.4.2 Master Mode Next the master must enter Receiver or Transmit-
To switch from default Slave mode to Master ter mode.
mode a Start condition generation is needed. Note: In 10-bit addressing mode, to switch the
master to Receiver mode, software must generate
a repeated Start condition and resend the header
Start condition sequence with the least significant bit set
Setting the START bit while the BUSY bit is (11110xx1).
cleared causes the interface to switch to Master
mode (M/SL bit set) and generates a Start condi-
tion. Master Receiver
Once the Start condition is sent: Following the address transmission and after SR1
and CR registers have been accessed, the master
– The EVF and SB bits are set by hardware with receives bytes from the SDA line into the DR reg-
an interrupt if the ITE bit is set. ister via the internal shift register. After each byte
Then the master waits for a read of the SR1 regis- the interface generates in sequence:
ter followed by a write in the DR register with the – Acknowledge pulse if the ACK bit is set
Slave address, holding the SCL line low (see
Figure 66 Transfer sequencing EV5). – EVF and BTF bits are set by hardware with an in-
terrupt if the ITE bit is set.
Then the interface waits for a read of the SR1 reg-
Slave address transmission ister followed by a read of the DR register, holding
Then the slave address is sent to the SDA line via the SCL line low (see Figure 66 Transfer se-
the internal shift register. quencing EV7).
In 7-bit addressing mode, one address byte is To close the communication: before reading the
sent. last byte from the DR register, set the STOP bit to
In 10-bit addressing mode, sending the first byte generate the Stop condition. The interface goes
including the header sequence causes the follow- automatically back to slave mode (M/SL bit
ing event: cleared).
– The EVF bit is set by hardware with interrupt Note: In order to generate the non-acknowledge
generation if the ITE bit is set. pulse after the last received data byte, the ACK bit
Then the master waits for a read of the SR1 regis- must be cleared just before reading the second
ter followed by a write in the DR register, holding last data byte.
the SCL line low (see Figure 66 Transfer se-
quencing EV9).
119/215
ST72F521, ST72521B
120/215
ST72F521, ST72521B
121/215
ST72F521, ST72521B
10.7.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.
122/215
ST72F521, ST72521B
123/215
ST72F521, ST72521B
124/215
ST72F521, ST72521B
125/215
ST72F521, ST72521B
126/215
ST72F521, ST72521B
ADD7 ADD6 ADD5 ADD4 ADD3 ADD2 ADD1 ADD0 FR1 FR0 0 0 0 ADD9 ADD8 0
Bit 0 = Reserved.
127/215
ST72F521, ST72521B
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
128/215
ST72F521, ST72521B
ST7 Interface
BTR
ICR
RX BTL BCDL SHREG
ISR
TX EML CRC
CSR
TECR
CAN 2.0B passive Core
RECR
129/215
ST72F521, ST72521B
130/215
ST72F521, ST72521B
Inter-Frame Space
Inter-Frame Space Data Frame or Overload Frame
44 + 8 * N
Arbitration Field Control Field Data Field CRC Field Ack Field
2
12 6 8*N 16 7
ACK
Inter-Frame Space
Inter-Frame Space Remote Frame or Overload Frame
44
Arbitration Field Control Field CRC Field Ack Field End Of Frame
2
12 6 16 7
ID DLC CRC
IDE
r0
RTR
SOF
ACK
131/215
ST72F521, ST72521B
RESYNC
RUN
IDLE
Write to DATA7 |
TX Error & NRTX Start Of Frame
TX OK RX OK
Arbitration lost
TRANSMISSION RECEPTION
TX Error RX Error
BOFF
ERROR
BOFF
n
132/215
ST72F521, ST72521B
133/215
ST72F521, ST72521B
When TECR or RECR > 127, the EPSV bit gets set
ERROR ACTIVE
ERROR PASSIVE
When 128 * 11 recessive bits occur: When TECR > 255 the BOFF bit gets set
- the BOFF bit gets cleared and the EPSV bit gets cleared
- the TECR register gets cleared
- the RECR register gets cleared
BUS OFF
134/215
ST72F521, ST72521B
135/215
ST72F521, ST72521B
136/215
ST72F521, ST72521B
137/215
ST72F521, ST72521B
138/215
ST72F521, ST72521B
7 0 7 0
RJW1 RJW0 BRP5 BRP4 BRP3 BRP2 BRP1 BRP0 0 BS22 BS21 BS20 BS13 BS12 BS11 BS10
RJW[1:0] determine the maximum number of time BS2[2:0] determine the length of Bit Segment 2.
quanta by which a bit period may be shortened or tBS2 = tCAN * (BS2 + 1)
lengthened to achieve resynchronization. BS1[3:0] determine the length of Bit Segment 1.
tRJW = tCAN * (RJW + 1) tBS1 = tCAN * (BS1 + 1)
BRP[5:0] determine the CAN system clock cycle
time or time quanta which is used to build up the in- Note: Writing to this register is allowed only in
dividual bit timing. Standby mode to prevent any accidental CAN pro-
tCAN = tCPU * (BRP + 1) tocol violation through programming errors.
Where tCPU = time period of the CPU clock.
The resulting baud rate can be computed by the for- PAGE SELECTION REGISTER (PSR)
mula:
Read/Write
Reset Value: 00h
7 0
1
BR = ---------------------------------------------------------------------------------------------------
- PAGE PAGE PAGE
t CPU × ( BRP + 1 ) × ( BS1 + BS2 + 3 ) 0 0 0 0 0
2 1 0
0 0 1 Buffer 1
0 1 0 Buffer 2
0 1 1 Buffer 3
1 0 0 Filters
1 0 1 Reserved
1 1 0 Reserved
1 1 1 Reserved
139/215
ST72F521, ST72521B
7 0
LID[2:0] are the least significant 3 bits of the last
Identifier read on the CAN bus. REC7 REC6 REC5 REC4 REC3 REC2 REC1 REC0
LRTR is the last Remote Transmission Request bit
read on the CAN bus.
REC[7:0] is the Receive Error Counter implement-
LDLC[3:0] is the last Data Length Code read on the ing part of the fault confinement mechanism of the
CAN bus. CAN protocol. In case of an error during reception,
this counter is incremented by 1 or by 8 depending
on the error condition as defined by the CAN stand-
ard. After every successful reception the counter is
decremented by 1 or reset to 120 if its value was
higher than 128. When the counter value exceeds
127, the CAN controller enters the error passive
state.
7 0
140/215
ST72F521, ST72521B
7 0 7 0
ID2 ID1 ID0 RTR DLC3 DLC2 DLC1 DLC0 0 0 0 0 ACC RDY BUSY LOCK
ID[2:0] are the least significant 3 bits of the 11-bit Bit 3 = ACC Acceptance Code
message identifier. − Read Only
Set by hardware with the id of the highest priority
RTR is the Remote Transmission Request bit. It is filter which accepted the message stored in the
set to indicate a remote frame and reset to indicate buffer.
a data frame. ACC = 0: Match for Filter/Mask0. Possible match
DLC[3:0] is the Data Length Code. It gives the for Filter/Mask1.
number of bytes in the data field of the mes- ACC = 1: No match for Filter/Mask0 and match for
sage.The valid range is 0 to 8. Filter/Mask1.
Reset by hardware when either RDY or RXIF gets
DATA REGISTERS (DATA0-7x) reset.
Bit 2 = RDY Message Ready
Read/Write − Read/Clear
Reset Value: Undefined Set by hardware to signal that a new error-free
message is available (LOCK = 0) or that a trans-
7 0 mission request is pending (LOCK = 1).
Cleared by software when LOCK = 0 to release
DATA DATA DATA DATA DATA DATA DATA DATA the buffer and to clear the corresponding RXIF bit
7 6 5 4 3 2 1 0 in the Interrupt Status Register.
Cleared by hardware when LOCK = 1 to indicate
that the transmission request has been serviced or
DATA[7:0] is a message data byte. Up to eight such cancelled.
bytes may be part of a message. Writing to byte
Bit 1 = BUSY Busy Buffer
DATA7 initiates a transmit request and should al-
ways be done even when DATA7 is not part of the
− Read Only
Set by hardware when the buffer is being filled
message.
(LOCK = 0) or emptied (LOCK = 1) and reset after
the 2nd intermission bit.
Reset by hardware when the buffer is not ac-
cessed by the CAN core for transmission nor re-
ception purposes.
Bit 0 = LOCK Lock Buffer
− Read/Set/Clear
Set by software to lock a buffer. No more message
can be received into the buffer thus preserving its
content and making it available for transmission.
Cleared by software to make the buffer available
for reception. Cancels any pending transmission
request.
Cleared by hardware once a message has been
successfully transmitted provided the early trans-
mit interrupt mode is on. Left untouched otherwise.
Note that in order to prevent any message corrup-
tion or loss of context, LOCK cannot be set nor re-
set while BUSY is set. Trying to do so will result in
LOCK not changing state.
141/215
ST72F521, ST72521B
7 0 7 0
FIL11 FIL10 FIL9 FIL8 FIL7 FIL6 FIL5 FlL4 MSK1 MSK1
MSK9 MSK8 MSK7 MSK6 MSK5 MSK4
1 0
142/215
ST72F521, ST72521B
5Ch Control/Status
60h
Paged Reg1
Paged Reg1
Paged
Paged
Paged Reg2Reg1Reg0
Paged
Paged Reg2Reg1
Paged
Paged
Paged Reg3Reg2Reg1
Paged
Paged Reg3Reg2
Paged
Paged
Paged Reg4Reg3Reg2
Paged
Paged Reg4Reg3
Reg5Reg4Reg3
Paged
Paged
Paged
Paged
Paged Reg5Reg4
Paged
Paged
Paged Reg6Reg5Reg4
Paged
Paged Reg6Reg5
Paged
Paged
Paged Reg7Reg6Reg5
Paged
Paged Reg7Reg6
Paged
Paged
Paged Reg8Reg7Reg6
Paged
Paged Reg8Reg7
Paged
Paged
Paged Reg9Reg8Reg7
Paged
Paged Reg9Reg8
Paged
Paged
Paged Reg10Reg9Reg8
Paged
Paged Reg10Reg9
Paged Paged
Paged Reg10
Reg11 Reg9
Paged
Paged Reg10
Reg11
Paged Paged
Paged Reg10
Reg11
Reg12
Paged
Paged Reg11
Reg12
Paged Paged
Paged Reg11
Reg12
Reg13
Paged
Paged Reg12
Reg13
Paged Paged
Paged Reg12
Reg13
Reg14
Paged
Paged Reg13
Reg14
6Fh Paged Paged
Paged Reg13
Reg14
Reg15
Paged
Paged Reg14
Reg15
Paged
Paged Reg14
Reg15
Paged Reg15
Paged Reg15
143/215
ST72F521, ST72521B
6Ah
6Bh
Reserved
6Ch Reserved Reserved Reserved
6Dh
6Eh TECR
144/215
ST72F521, ST72521B
145/215
ST72F521, ST72521B
146/215
ST72F521, ST72521B
147/215
ST72F521, ST72521B
148/215
ST72F521, ST72521B
149/215
ST72F521, ST72521B
Application Requests
an Abort
YES NO
READY == 1
MASK INT
SET NRTX
YES BUSY == 0
NO
AND
READY == 1
YES NO
BUSY == 0
YES NO
READY == 1
RESET LOCK
NO YES
READY == 1
ENABLE INT
Abort Done
150/215
ST72F521, ST72521B
CAN TX
CAN TX
CAN RX
CAN RX
LOCK
LOCK READY
READY BUSY
BUSY NRTX
NRTX
In this case the NRTX bit is set but has no effect,
as the previous transmission attempt failed due to
In this case the abort request performed during the an arbitration lost. The application waits for the
transmission has no effect, as the first transmis- falling edge of BUSY bit and checks that READY is
sion is successful. still set. This is the case, this means pCAN has lost
Figure 77. Abort and transmission delayed by the arbitration and LOCK bit can be safely reset.
Abort is immediate and pCAN resets the READY
busy CAN bus and BUSY bits.
TX RQST
ABORT RQST
Timing Considerations
CAN TX As no interrupt signals that an abort has been suc-
CAN RX cessful, the application has to wait until the trans-
LOCK mit buffer is empty (transmission has been aborted
READY or transmitted successfully). This time can vary
BUSY depending on the case in which the abort is per-
NRTX formed (arbitration lost, error or successful trans-
mission). To show the impact of the software work-
In this case the NRTX bit is set to abort the trans- around on this timing behaviour Figure 80 and Fig-
mission after the first attempt. As the first attempt ure 81 compare the reference behaviour (worst
is successful the READY and BUSY bits are reset case when abort is done by LOCK only) with the
by pCAN and the transmit buffer becomes empty. behaviour when NRTX, BUSY and LOCK bits are
An abort is no longer required. used.
Figure 78. Abort and error during transmission Figure 80. Abort by LOCK only - Reference
Error
TX RQST behaviour
ABORT RQST
TX RQST
CAN TX ABORT RQST
CAN RX CAN TX
LOCK CAN RX
READY LOCK
BUSY READY
NRTX BUSY
NRTX
151/215
ST72F521, ST72521B
152/215
ST72F521, ST72521B
When TECR or RECR > 127, the EPSV bit gets set
ERROR ACTIVE
ERROR PASSIVE
When 128 * 11 recessive bits occur: When TECR > 255 and RECR < 128 the BOFF bit
- the BOFF bit gets cleared gets set and the EPSV bit gets cleared
- the TECR register gets cleared
- the RECR register gets cleared
BUS OFF
153/215
ST72F521, ST72521B
/************************************************/
/* BUS-OFF MONITORING SEQUENCE
/************************************************/
154/215
ST72F521, ST72521B
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
155/215
ST72F521, ST72521B
156/215
ST72F521, ST72521B
7 0
D9 D8 D7 D6 D5 D4 D3 D2
7 0
0 0 0 0 0 0 D1 D0
157/215
ST72F521, ST72521B
Address Register
7 6 5 4 3 2 1 0
(Hex.) Label
158/215
ST72F521, ST72521B
11 INSTRUCTION SET
11.1 CPU ADDRESSING MODES so, most of the addressing modes may be subdi-
vided in two sub-modes called long and short:
The CPU features 17 different addressing modes
which can be classified in 7 main groups: – Long addressing mode is more powerful be-
cause it can use the full 64 Kbyte address space,
Addressing Mode Example however it uses more bytes and more CPU cy-
Inherent nop cles.
Immediate ld A,#$55 – Short addressing mode is less powerful because
it can generally only access page zero (0000h -
Direct ld A,$55
00FFh range), but the instruction size is more
Indexed ld A,($55,X) compact, and faster. All memory to memory in-
Indirect ld A,([$55],X) structions use short addressing modes only
Relative jrne loop (CLR, CPL, NEG, BSET, BRES, BTJT, BTJF,
INC, DEC, RLC, RRC, SLL, SRL, SRA, SWAP)
Bit operation bset byte,#5
The ST7 Assembler optimizes the use of long and
short addressing modes.
The CPU Instruction set is designed to minimize
the number of bytes required per instruction: To do
Table 26. CPU Addressing Mode Overview
Pointer Pointer Size Length
Mode Syntax Destination Address (Hex.) (Bytes)
(Hex.)
Inherent nop +0
Immediate ld A,#$55 +1
159/215
ST72F521, ST72521B
160/215
ST72F521, ST72521B
Short Instructions
Function
Only
CLR Clear
INC, DEC Increment/Decrement
TNZ Test Negative or Zero
CPL, NEG 1 or 2 Complement
BSET, BRES Bit Operations
Bit Test and Jump Opera-
BTJT, BTJF
tions
SLL, SRL, SRA, RLC, Shift and Rotate Opera-
RRC tions
SWAP Swap Nibbles
CALL, JP Call or Jump subroutine
161/215
ST72F521, ST72521B
Using a pre-byte
The instructions are described with one to four op- These prebytes enable instruction in Y as well as
codes. indirect addressing modes to be implemented.
In order to extend the number of available op- They precede the opcode of the instruction in X or
codes for an 8-bit CPU (256 opcodes), three differ- the instruction using direct addressing mode. The
ent prebyte opcodes are defined. These prebytes prebytes are:
modify the meaning of the instruction they pre- PDY 90 Replace an X based instruction
cede. using immediate, direct, indexed, or inherent ad-
The whole instruction becomes: dressing mode by a Y one.
PC-2 End of previous instruction PIX 92 Replace an instruction using di-
rect, direct bit, or direct relative addressing mode
PC-1 Prebyte to an instruction using the corresponding indirect
PC opcode addressing mode.
PC+1 Additional word (0 to 2) according It also changes an instruction using X indexed ad-
to the number of bytes required to compute the ef- dressing mode to an instruction using indirect X in-
fective address dexed addressing mode.
PIY 91 Replace an instruction using X in-
direct indexed addressing mode by a Y one.
162/215
ST72F521, ST72521B
163/215
ST72F521, ST72521B
164/215
ST72F521, ST72521B
12 ELECTRICAL CHARACTERISTICS
ST7 PIN
CL
165/215
ST72F521, ST72521B
166/215
ST72F521, ST72521B
fCPU [MHz]
8 FUNCTIONALITY
FUNCTIONALITY GUARANTEED
NOT GUARANTEED IN THIS AREA
6 (UNLESS
IN THIS AREA
OTHERWISE
4 SPECIFIED
IN THE TABLES
2 OF PARAMETRIC
DATA)
1
0
3.5 3.8 4.0 4.5 5.5
Note: Some temperature ranges are only available with a specific package and memory size. Refer to Or-
dering Information.
167/215
ST72F521, ST72521B
168/215
ST72F521, ST72521B
Notes:
1. Data based on characterization results, tested in production at VDD max. and fCPU max.
2. Measurements are done in the following conditions:
- Program executed from RAM, CPU running with RAM access. The increase in consumption when executing from Flash
is 50%.
- All I/O pins in input mode with a static value at VDD or VSS (no load)
- All peripherals in reset state.
- LVD disabled.
- Clock input (OSC1) driven by external square wave.
- In SLOW and SLOW WAIT mode, fCPU is based on fOSC divided by 32.
To obtain the total current consumption of the device, add the clock source (Section 12.4.2) and the peripheral power
consumption (Section 12.4.3).
3. All I/O pins in push-pull 0 mode (when applicable) with a static value at VDD or VSS (no load), LVD disabled. Data
based on characterization results, tested in production at VDD max. and fCPU max.
4. Data based on characterisation results, not tested in production. All I/O pins in push-pull 0 mode (when applicable) with
a static value at VDD or VSS (no load); clock input (OSC1) driven by external square wave, LVD disabled. To obtain the
total current consumption of the device, add the clock source consumption (Section 12.4.2).
169/215
ST72F521, ST72521B
6 8MHz
9 8MHz
4MHz
4MHz
8 2MHz
2MHz 5
1MHz
7 1MHz
4
6
Idd (mA)
Idd (mA)
5 3
4
2
3
2 1
1
0
0
3.2 3.6 4 4.4 4.8 5.2 5.5
3.2 3.6 4 4.4 4.8 5.2 5.5
Vdd (V)
Vdd (V)
Figure 88. Typical IDD in SLOW mode Figure 90. Typ. IDD in SLOW-WAIT mode
1.20
500kHz
1.20 500kHz 250kHz
250kHz 1.00 125kHz
1.00 125kHz 62.5kHz
62.5kHz 0.80
)
0.80
Idd (mA)
0.60
(
0.60
0.40
0.40
0.20
0.20
0.00
0.00 3.2 3.6 4 4.4 4.8 5.2 5.5
3.2 3.6 4 4.4 4.8 5.2 5.5
Vdd (V)
Vdd (V)
170/215
ST72F521, ST72521B
Notes:
1.. Data based on characterization results done with the external components specified in Section 12.5.3, not tested in
production.
2. As the oscillator is based on a current source, the consumption does not depend on the voltage.
171/215
ST72F521, ST72521B
Notes:
1. Data based on a differential IDD measurement between reset configuration (timer counter running at fCPU/4) and timer
counter stopped (only TIMD bit set). Data valid for one timer.
2. Data based on a differential IDD measurement between reset configuration (timer stopped) and timer counter enabled
(only TCE bit set).
3. Data based on a differential IDD measurement between reset configuration (SPI disabled) and a permanent SPI master
communication at maximum speed (data sent equal to 55h).This measurement includes the pad toggling consumption.
4. Data based on a differential IDD measurement between SCI low power state (SCID=1) and a permanent SCI data trans-
mit sequence.
5. 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).
6. Data based on a differential IDD measurement between reset configuration and continuous A/D conversions.
7. Data based on a differential IDD measurement between reset configuration (CAN disabled) and a permanent CAN data
transmit sequence with RX and TX connected together. This measurement include the pad toggling consumption.
172/215
ST72F521, ST72521B
90%
VOSC1H
10%
VOSC1L
OSC2
Not connected internally
fOSC
EXTERNAL
IL
CLOCK SOURCE
OSC1
ST72XXX
Notes:
1. Data based on typical application software.
2. Time measured between interrupt event and interrupt vector fetch. ∆tc(INST) is the number of tCPU cycles needed to finish
the current instruction execution.
3. Data based on design simulation and/or technology characteristics, not tested in production.
173/215
ST72F521, ST72521B
fOSC
CL1 OSC1
RESONATOR RF
CL2
OSC2
ST72XXX
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.
174/215
ST72F521, ST72521B
4 CSTCR4M00G55B-R0 MS Mode
8 CSTCE8M00G55A-R0 HS Mode
16 CSTCE16M0G53A-R0 HS Mode
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]
3. LP mode is not recommended for 2 MHz resonator because the peak to peak amplitude is too small (>0.8V)
For more information on these resonators, please consult www.murata.com
175/215
ST72F521, ST72521B
4
Vdd = 5V
fOSC(RCINT) (MHz)
3.8
Vdd = 5.5V
3.6
3.4
3.2
3
-45 0 25 70 130
TA(°C)
176/215
ST72F521, ST72521B
Note:
1. Data characterized but not tested.
The user must take the PLL jitter into account in the application (for example in serial communication or
sampling of high frequency signals). The PLL jitter is a periodic effect, which is integrated over several
CPU cycles. Therefore the longer the period of the application signal, the less it will be impacted by the
PLL jitter.
Figure 94 shows the PLL jitter integrated on application signals in the range 125kHz to 4MHz. At frequen-
cies of less than 125KHz, the jitter is negligible.
Figure 94. Integrated PLL Jitter vs signal frequency1
+/-Jitter (%)
1.2
FLASH typ
1 ROM max
0.8 ROM typ
0.6
0.4
0.2
0
4 MHz 2 MHz 1 MHz 500 kHz 250 kHz 125 kHz
Application Frequency
177/215
ST72F521, ST72521B
178/215
ST72F521, ST72521B
179/215
ST72F521, ST72521B
180/215
ST72F521, ST72521B
Notes:
1. Data based on characterization results, not tested in production.
12.7.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 10 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 1)
TA=+25°C A
LU Static latch-up class TA=+85°C A
TA=+125°C A
DLU Dynamic latch-up class VDD=5.5V, fOSC=4MHz, TA=+25°C A
Notes:
1. Class description: A Class is an STMicroelectronics internal specification. All its limits are higher than the JEDEC spec-
ifications, that means when a device belongs to Class A it exceeds the JEDEC standard. B Class strictly covers all the
JEDEC criteria (international standard).
181/215
ST72F521, ST72521B
Figure 95. Unused I/O Pins configured as input Figure 96. Typical IPU vs. VDD with VIN=VSS
90
VDD ST7XXX Ta=140°C
80
Ta=95°C
70
10kΩ UNUSED I/O PORT
Ta=25°C
Ta=-45°C
60
Ipu(uA )
50
ST7XXX 20
10
Note: I/O can be left unconnected if it is configured as output
(0 or 1) by the software. This has the advantage of 0
greater EMC robustness and lower cost. 2 2.5 3 3.5 4 4.5 5 5.5 6
V dd(V)
Notes:
1. Data based on characterization results, not tested in production.
2. Hysteresis voltage between Schmitt trigger switching levels. Based on characterization results, not tested.
3. When the current limitation is not possible, the VIN maximum must be respected, otherwise refer to IINJ(PIN) specifica-
tion. A positive injection is induced by VIN>VDD while a negative injection is induced by VIN<VSS. Refer to section 12.2.2
on page 166 for more details.
4. Configuration not recommended, all unused pins must be kept at a fixed voltage: using the output mode of the I/O for
example and leaving the I/O unconnected on the board or an external pull-up or pull-down resistor (see Figure 95). Data
based on design simulation and/or technology characteristics, not tested in production.
5. The RPU pull-up equivalent resistor is based on a resistive transistor (corresponding IPU current characteristics de-
scribed in Figure 96).
6. 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.
182/215
ST72F521, ST72521B
VDD=5V
when 4 pins are sunk at same time TA≥85°C 1.5 V
(see Figure 98 and Figure 100) IIO=+8mA 0.6
Output high level voltage for an I/O pin IIO=-5mA, TA≤85°C VDD-1.4
VOH 2) when 4 pins are sourced at same time TA≥85°C VDD-1.6
(see Figure 99 and Figure 102) IIO=-2mA VDD-0.7
Figure 97. Typical VOL at VDD=5V (standard) Figure 99. Typical VOH at VDD=5V
1.4
5.5
1.2
5
1
V dd-Voh (V) at Vdd=5V
V ol (V ) at Vdd=5V
4.5
0.8
4
0.6
3.5
Ta =14 0°C " V dd= 5V 1 40°C m in
0.4
Ta =95 °C 3 V dd= 5v 95°C m in
Ta =25 °C
0.2 V dd= 5v 25°C m in
Ta =-45 °C
2.5
V dd= 5v -4 5°C m in
0
2
0 0.005 0.01 0.015
Iio(A) -0.01 -0.008 -0.006 -0.004 -0.002 0
0.9
0.8
0.7
V ol(V ) at Vdd=5V
0.6
0.5
0.4
Ta= 140 °C
0.3
Ta= 95 °C
0.2 Ta= 25 °C
0
0 0.01 0.02 0.03
Iio(A)
Notes:
1. The IIO current sunk must always respect the absolute maximum rating specified in Section 12.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 12.2.2 and the sum of
IIO (I/O ports and control pins) must not exceed IVDD. True open drain I/O pins do not have VOH.
183/215
ST72F521, ST72521B
Vol(V) at Iio=2mA
0.3
0.6
0.5 0.25
0.4 0.2
0.3 0.15
0.2
0.1
0.1
0.05
0
2 2.5 3 3.5 4 4.5 5 5.5 6 0
2 2.5 3 3.5 4 4.5 5 5.5 6
Vdd(V )
Vdd(V)
1 .4 Ta = 140 °C
0 .5
Ta =95 °C
1 .2 Ta =25 °C
0 .4 Ta =-45°C
1
Vol(V ) at Iio=20m A
Vol(V ) at Iio=8m A
0 .3 0 .8
0 .6
0 .2
Ta= 14 0°C
0 .4
Ta=9 5°C
0 .1 Ta=2 5°C
0 .2
Ta=-45 °C
0 0
2 2.5 3 3.5 4 4.5 5 5.5 6 2 2.5 3 3.5 4 4.5 5 5.5 6
V dd (V ) V dd(V )
Ta= -4 5°C
5
5 Ta= 25°C
Vdd-Voh(V) at Iio=-2m A
Ta= 95°C
Vdd-Voh(V) at Iio=-5mA
4.5
4 Ta= 140°C
4
3
3.5
Ta= -4 5°C
2
3 Ta= 25°C
Ta= 95°C
2.5 1
Ta= 140°C
2
0
2 2.5 3 3.5 4 4.5 5 5.5 6 2 2.5 3 3.5 4 4.5 5 5.5 6
Vdd(V) Vdd(V)
184/215
ST72F521, ST72521B
Notes:
1. Data based on characterization results, not tested in production.
2. Hysteresis voltage between Schmitt trigger switching levels.
3. The IIO current sunk must always respect the absolute maximum rating specified in Section 12.2.2 and the sum of IIO
(I/O ports and control pins) must not exceed IVSS.
4. To guarantee the reset of the device, a minimum pulse has to be applied to the RESET pin. All short pulses applied on
the RESET pin with a duration below th(RSTL)in can be ignored.
5. The reset network (the resistor and two capacitors) protects the device against parasitic resets, especially in noisy en-
vironments.
6. Data guaranteed by design, not tested in production.
185/215
ST72F521, ST72521B
VDD ST72XXX
0.01µF
1MΩ WATCHDOG
PULSE
GENERATOR
LVD RESET
VDD VDD
RON
USER 0.01µF 4.7kΩ INTERNAL
EXTERNAL RESET
RESET Filter
CIRCUIT
0.01µF
PULSE
WATCHDOG
GENERATOR
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 12.9.1 on page 185. 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 12.2.2 on page 166.
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 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.
186/215
ST72F521, ST72521B
ICCSEL/VPP VPP
PROGRAMMING
TOOL
10kΩ
ST72XXX ST72XXX
Notes:
1. Data based on design simulation and/or technology characteristics, not tested in production.
2. When ICC mode is not required by the application ICCSEL/VPP pin must be tied to VSS.
187/215
ST72F521, ST72521B
188/215
ST72F521, ST72521B
SS INPUT
tsu(SS) tc(SCK) th(SS)
CPHA=0
SCK INPUT
CPOL=0
CPHA=0
CPOL=1
tw(SCKH)
ta(SO) tw(SCKL) tv(SO) th(SO) tr(SCK) tdis(SO)
tf(SCK)
MISO OUTPUT see
see note 2 MSB OUT BIT6 OUT LSB OUT note 2
tsu(SI) th(SI)
Notes:
1. Data based on design simulation and/or characterisation results, not tested in production.
2. When no communication is on-going the data output line of the SPI (MOSI in master mode, MISO in slave mode) has
its alternate function capability released. In this case, the pin status depends on the I/O port configuration.
3. Measurement points are done at CMOS levels: 0.3xVDD and 0.7xVDD.
189/215
ST72F521, ST72521B
SS INPUT
tsu(SS) tc(SCK) th(SS)
CPHA=1
SCK INPUT
CPOL=0
CPHA=1
CPOL=1
tsu(SI) th(SI)
SS INPUT
tc(SCK)
CPHA=0
CPOL=0
CPHA=0
SCK INPUT
CPOL=1
CPHA=1
CPOL=0
CPHA=1
CPOL=1
tw(SCKH) tr(SCK)
tw(SCKL) tf(SCK)
tsu(MI) th(MI)
tv(MO) th(MO)
MOSI OUTPUT see note 2 MSB OUT BIT6 OUT LSB OUT see note 2
Notes:
1. Measurement points are done at CMOS levels: 0.3xVDD and 0.7xVDD.
2. When no communication is on-going the data output line of the SPI (MOSI in master mode, MISO in slave mode) has
its alternate function capability released. In this case, the pin status depends of the I/O port configuration.
190/215
ST72F521, ST72521B
12.11.2 I2C - Inter IC Control Interface Refer to I/O port characteristics for more details on
Subject to general operating conditions for VDD, the input/output alternate function characteristics
fCPU, and TA unless otherwise specified. (SDAI and SCLI). The ST7 I2C interface meets the
requirements of the Standard I2C communication
protocol described in the following table.
Standard mode I2C Fast mode I2C5)
Symbol Parameter Unit
Min 1) Max 1) Min 1) Max 1)
tw(SCLL) SCL clock low time 4.7 1.3
µs
tw(SCLH) SCL clock high time 4.0 0.6
tsu(SDA) SDA setup time 250 100
th(SDA) SDA data hold time 0 3) 0 2) 900 3)
tr(SDA) ns
SDA and SCL rise time 1000 20+0.1Cb 300
tr(SCL)
tf(SDA)
SDA and SCL fall time 300 20+0.1Cb 300
tf(SCL)
th(STA) START condition hold time 4.0 0.6
µs
tsu(STA) Repeated START condition setup time 4.7 0.6
tsu(STO) STOP condition setup time 4.0 0.6 µs
tw(STO:STA) STOP to START condition time (bus free) 4.7 1.3 µs
Cb Capacitive load for each bus line 400 400 pF
Figure 109. Typical Application with I2C Bus and Timing Diagram 4)
VDD VDD
SCK
Notes:
1. Data based on standard I2C protocol requirement, not tested in production.
2. The device must internally provide a hold time of at least 300ns for the SDA signal in order to bridge the undefined
region of the falling edge of SCL.
3. The maximum hold time of the START condition has only to be met if the interface does not stretch the low period of
SCL signal.
4. Measurement points are done at CMOS levels: 0.3xVDD and 0.7xVDD.
5. At 4MHz fCPU, max.I2C speed (400kHz) is not achievable. In this case, max. I2C speed will be approximately 260KHz.
191/215
ST72F521, ST72521B
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.
Notes:
1. Data based on simulation results, not tested in production
192/215
ST72F521, ST72521B
Notes:
1. 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.
2. For Flash devices: injecting negative current on any of the analog input pins significantly reduces the accuracy of any
conversion being performed on any analog input. Analog pins of flash devices can be protected against negative injection
by adding a Schottky diode (pin to ground). Injecting negative current on digital input pins degrades ADC accuracy espe-
cially if performed on a pin close to the analog input pins. Any positive injection current within the limits specified for
IINJ(PIN) and ΣIINJ(PIN) in Section 12.8 does not affect the ADC accuracy.
193/215
ST72F521, ST72521B
Figure 110. RAIN max. vs fADC with CAIN=0pF1) Figure 111. Recommended CAIN & RAIN values.2)
45 1000
40 Cain 10 nF
35 2 MHz Cain 22 nF
100
Max. R AIN (Kohm)
15
10 1
0 0.1
0 10 30 70 0.01 0.1 1 10
CPARASITIC (pF) fAIN(KHz)
CAIN VT
0.6V IL CADC
±1µA 12pF
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).
194/215
ST72F521, ST72521B
12.12.1 Analog Power Supply and Reference – Filter power to the analog power planes. It is rec-
Pins ommended to connect capacitors, with good high
Depending on the MCU pin count, the package frequency characteristics, between the power
may feature separate VAREF and VSSA analog and ground lines, placing 0.1µF and optionally, if
power supply pins. These pins supply power to the needed 10pF capacitors as close as possible to
A/D converter cell and function as the high and low the ST7 power supply pins and a 1 to 10µF ca-
reference voltages for the conversion. pacitor close to the power source (see Figure
113).
Separation of the digital and analog power pins al-
low board designers to improve A/D performance. – The analog and digital power supplies should be
Conversion accuracy can be impacted by voltage connected in a star network. Do not use a resis-
drops and noise in the event of heavily loaded or tor, as VAREF is used as a reference voltage by
badly decoupled power supply lines (see Section the A/D converter and any resistance would
12.12.2 General PCB Design Guidelines). cause a voltage drop and a loss of accuracy.
12.12.2 General PCB Design Guidelines – Properly place components and route the signal
traces on the PCB to shield the analog inputs.
To obtain best results, some general design and Analog signals paths should run over the analog
layout rules should be followed when designing ground plane and be as short as possible. Isolate
the application PCB to shield the noise-sensitive, analog signals from digital signals that may
analog physical interface from noise-generating switch while the analog inputs are being sampled
CMOS logic signals. by the A/D converter. Do not toggle digital out-
– Use separate digital and analog planes. The an- puts on the same I/O port as the A/D input being
alog ground plane should be connected to the converted.
digital ground plane via a single point on the
PCB.
Figure 113. Power Supply Filtering
ST72XXX
1 to 10µF 0.1µF VSS
ST7
DIGITAL NOISE
FILTERING
VDD
VDD
POWER
SUPPLY
0.1µF VAREF
SOURCE
EXTERNAL
NOISE
FILTERING VSSA
195/215
ST72F521, ST72521B
196/215
ST72F521, ST72521B
13 PACKAGE CHARACTERISTICS
mm inches
Dim.
Min Typ Max Min Typ Max
D
A
D1 A2
A 1.60 0.063
A1 A1 0.05 0.15 0.002 0.006
A2 1.35 1.40 1.45 0.053 0.055 0.057
b
b 0.22 0.32 0.38 0.009 0.013 0.015
C 0.09 0.20 0.004 0.008
D 16.00 0.630
e
E1 E
D1 14.00 0.551
E 16.00 0.630
E1 14.00 0.551
e 0.65 0.026
θ 0° 3.5° 7° 0° 3.5° 7°
c
L 0.45 0.60 0.75 0.018 0.024 0.030
L1
L L1 1.00 0.039
h
Number of Pins
N 80
D A mm inches
A2
Dim.
D1 Min Typ Max Min Typ Max
A1 A 1.60 0.063
A1 0.05 0.15 0.002 0.006
A2 1.35 1.40 1.45 0.053 0.055 0.057
b b 0.30 0.37 0.45 0.012 0.015 0.018
c 0.09 0.20 0.004 0.008
D 16.00 0.630
e
D1 14.00 0.551
E1 E
E 16.00 0.630
E1 14.00 0.551
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
L
L1 1.00 0.039
L1
c Number of Pins
h N 64
197/215
ST72F521, ST72521B
mm inches
Dim.
D A
Min Typ Max Min Typ Max
D1 A2 A 1.60 0.063
A1
A1 0.05 0.15 0.002 0.006
A2 1.35 1.40 1.45 0.053 0.055 0.057
b 0.17 0.22 0.27 0.007 0.009 0.011
b c 0.09 0.20 0.004 0.008
D 12.00 0.472
E1 E D1 10.00 0.394
e
E 12.00 0.472
E1 10.00 0.394
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
h
L L1 1.00 0.039
Number of Pins
N 64
198/215
ST72F521, ST72521B
Notes:
1. The power dissipation is obtained from the formula PD=PINT+PPORT where PINT is the chip internal power (IDDxVDD)
and PPORT is the port power dissipation determined by the user.
2. The average chip-junction temperature can be obtained from the formula TJ = TA + PD x RthJA.
199/215
ST72F521, ST72521B
200/215
ST72F521, ST72521B
PLLOFF
FMP_R
RSTC
PKG0
PKG1
Res.
HALT
SW
1 0 1 0 2 1 0
Default 1 1 1 0 0 1 1 1 1 1 1 0 1 1 1 1
The option bytes allow the hardware configuration 1: Software (watchdog to be enabled by software)
of the microcontroller to be selected. They have no
address in the memory map and can be accessed OPT5 = Reserved, must be kept at default value.
only in programming mode (for example using a
standard ST7 programming tool). The default con-
tent of the FLASH is fixed to FFh. To program the OPT4:3= VD[1:0] Voltage detection
FLASH devices directly using ICP, FLASH devices These option bits enable the voltage detection
are shipped to customers with the internal RC block (LVD, and AVD) with a selected threshold for
clock source. In masked ROM devices, the option the LVD and AVD (EVD+AVD).
bytes are fixed in hardware by the ROM code (see
option list). Selected Low Voltage Detector VD1 VD0
201/215
ST72F521, ST72521B
M TQFP80 1 1 HS 8~16MHz 0 1 1
202/215
ST72F521, ST72521B
1 = Standard 0 to +70 °C
3 = Standard -40 to +125 °C
5 = Standard -10 to +85 °C
6 = Standard -40 to +85 °C
A = Automotive -40 to +85 °C
B = Automotive -40 to +105 °C
C = Automotive -40 to +125 °C
ST72521BR9, ST72521BR6
ST72521BAR9, ST72521BAR6
ST72521BM9
203/215
ST72F521, ST72521B
Date ................................
Signature ................................
204/215
ST72F521, ST72521B
205/215
ST72F521, ST72521B
Note 1: Add suffix /EU, /UK, /US for the power supply of your region.
206/215
ST72F521, ST72521B
207/215
ST72F521, ST72521B
208/215
ST72F521, ST72521B
209/215
ST72F521, ST72521B
210/215
ST72F521, ST72521B
15 KNOWN LIMITATIONS
15.1 ALL FLASH AND ROM DEVICES The symptom does not occur when the interrupts
are handled normally, i.e.
15.1.1 External RC option
when:
The External RC clock source option described in
previous datasheet revisions is no longer support- – The interrupt flag is cleared within its own inter-
ed and has been removed from this specification. rupt routine
15.1.2 Safe Connection of OSC1/OSC2 Pins – The interrupt flag is cleared within any interrupt
routine
The OSC1 and/or OSC2 pins must not be left un-
connected otherwise the ST7 main oscillator may – The interrupt flag is cleared in any part of the
start and, in this configuration, could generate an code while this interrupt is disabled
fOSC clock frequency in excess of the allowed If these conditions are not met, the symptom can
maximum (>16MHz.), putting the ST7 in an un- be avoided by implementing the following se-
safe/undefined state. Refer to section 6.2 on page quence:
25. Perform SIM and RIM operation before and after
15.1.3 Reset pin protection with LVD Enabled resetting an active interrupt request.
As mentioned in note 2 below Figure 103 on page Example:
186, when the LVD is enabled, it is recommended SIM
not to connect a pull-up resistor or capacitor. A
10nF pull-down capacitor is required to filter noise reset interrupt flag
on the reset line. RIM
15.1.4 Unexpected Reset Fetch Nested interrupt context:
If an interrupt request occurs while a “POP CC” in- The symptom does not occur when the interrupts
struction is executed, the interrupt controller does are handled normally, i.e.
not recognise the source of the interrupt and, by
default, passes the RESET vector address to the when:
CPU. – The interrupt flag is cleared within its own inter-
Workaround rupt routine
To solve this issue, a “POP CC” instruction must – The interrupt flag is cleared within any interrupt
always be preceded by a “SIM” instruction. routine with higher or identical priority level
15.1.5 Clearing active interrupts outside – The interrupt flag is cleared in any part of the
interrupt routine code while this interrupt is disabled
When an active interrupt request occurs at the If these conditions are not met, the symptom can
same time as the related flag is being cleared, an be avoided by implementing the following se-
unwanted reset may occur. quence:
Note: clearing the related interrupt mask will not PUSH CC
generate an unwanted reset SIM
Concurrent interrupt context reset interrupt flag
POP CC
211/215
ST72F521, ST72521B
212/215
ST72F521, ST72521B
15.2 ALL FLASH DEVICES modes are critical because the I/Os PG[7:0] and
PH[7:0] are forced to output push-pull.
15.2.1 Internal RC Oscillator with LVD
Impact on the Application
The internal RC can only be used if LVD is ena-
bled. The PG and PH I/O ports are forced to output
push-pull during three pulses on ICCDATA. In cer-
15.2.2 I/O behaviour during ICC mode entry tain circumstances, this behaviour can lead to a
sequence short-circuit between the I/O signals and VDD, VSS
Symptom or an output signal of another application compo-
In 80-pin devices (Flash), both Port G and H are nent.
forced to output push-pull during ICC mode entry In addition, switching these I/Os to output mode
sequence. 80-pin ROM devices are not impacted can cause the application to leave reset state, dis-
by this issue. turbing the ICC communication and preventing the
Details user from programming the flash.
To enable programming of all flash sectors, the
device must leave USER mode and be configured 15.2.3 Read-out protection with LVD
in ICC mode. Once in ICC mode, the ICC protocol The LVD is not supported if Readout protection is
enables an ST7 microcontroller to communicate enabled.
with an external controller (such as a PC). ICC
mode is entered by applying 39 pulses on the IC-
CDATA signal during reset. To enter ICC mode,
the device goes through other modes, some
213/215
ST72F521, ST72521B
16 REVISION HISTORY
Table 34. Revision History
Date Revision Description of Changes
Added Figure 82 on page 153
Reinstated “I/O behaviour during ICC mode entry sequence” on page 213
7-Dec-2004 3
Reinstated “BUSOFF not entered” in “CAN Cell Limitations” on page 212
Added “flash only” to PC6 Iinj spec in Section 12.2 and Section 12.8
Added Note on SMbus to Section 10.7
Static current consumption modified in section 12.8 on page 182
4-Mar-2005 4 Updated footnote and Figure 103 and Figure 104 on page 186
Modified VtPOR in section 12.3.2 on page 168
Added note 4 below Table of “CAN Cell Limitations” on page 212
Corrected MCO description in Table 1 and Section 10.2
Updated footnotes and Figure 103 and Figure 104 on page 186.
Updated soldering information in section 13.3 on page 200
18-May-2005 5
Added Suffix 3 to Figure 118 on page 203
Updated partnumbers in Table 30 on page 205
Added “Reset pin protection with LVD Enabled” on page 211
214/215
ST72F521, ST72521B
Notes:
Information furnished is believed to be accurate and reliable. However, STMicroelectronics assumes no responsibility for the consequences
of use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is granted
by implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are subject
to change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are not
authorized for use as critical components in life support devices or systems without express written approval of STMicroelectronics.
215/215