ROM with read-out protection capability. InApplication Programming a nd In-Circuit Pro-
gramming for HDFlash devices
– 1 to 2K RAM
– HDFlash endurance: 100 cycles, data reten-
TQFP32
7x7mm
tion: 20 years at 55°C
■ Clock, Re set and Supp ly Managem ent
– Low power crystal/ceramic resona tor oscilla-
tors and bypass for external clock
– PLL for 2x frequency multiplication
– Five Power Saving Modes: Halt, Auto Wake
Up From Halt, Active-Halt, Wait and Slow
■ Interrupt Management
– Nested interrupt controller
– 14 interrupt vectors plus TRAP and RESET
– TLI top level interrupt (on 64-pin devices)
– Up to 21 external interrupt lines (on 4 vectors)
■ Up to 48 I/O Ports
– Up to 48 multifunctional bidirectional I/O lines
– Up to 36 alternate function lines
– Up to 6 high sink outputs
■ 5 Timers
– 16-bit Timer with: 2 input capt ures, 2 output
compares, external clock input, PWM and
pulse generator modes
– 8-bit Timer with: 1 or 2 input captures, 1 or 2
output compares, PWM and pu lse generator
modes
– 8-bit PWM Auto-Reload Time r with: 1 or 2 in-
put captures, 2 or 4 independent PWM output
channels, output compare and time base in-
terrupt, external clock with event detector
■ Up to 4 Communications Interfaces
■ Analog peripheral (low current coupling)
■ Instruction Set
TQFP44
10x10mm
– Main Clock Controller with: Real time base
and Clock output
– Window watchdog timer
– SPI synchronous serial interface
– Master/slave
interface
– Master-only
terface
– CAN 2.0B active
– 10-bit A/D Converter with up to 16 inputs
– Up to 9 robust ports (low current coupling)
– 8-bit data manipulation
– 63 basic instructions
– 17 main addressing modes
– 8 x 8 unsigned multiply instruction
The ST72561/ST72563 devices are members of
the ST7 microcontroller fam ily designed for midrange applications with CAN (Controller Area Network) and LIN (Local Interconnect Network) interface.
All devices are based on a common industrystandard 8-bit core, featuring an enhanced instruction set and are available with FLASH or ROM program memory.
Figure 1. Device Block Diagram
option
OSC1
OSC2
V
DD
V
SS
RESET
1
TLI
OSC
PLL x 2
/2
POWER
SUPPLY
CONTROL
8-BIT CO RE
ALU
The enhanced instruction set and addressing
modes of the ST7 offer both power and flexibility to
software developers, enabling the design of highly
efficient and compact application code. In addition
to standard 8-bit data management, all ST7 microcontrollers feature true bit manipulation, 8x8 unsigned multiplication and indirect addressing
modes.
PWM
ART
8-bit
TIMER
16-Bit
TIMER
PA7:0
PORT A
PORT B
ADDRESS AND DATA BUS
PORT C
PORT D
PORT E
PORT F
(8 bits)
PB7:0
(8 bits)
PC7:0
(8 bits)
PD7:0
(8 bits)
PE7:0
(8 bits)
PF7:0
(8 bits)
1
1
1
1
1
1
PROGRAM
MEMORY
(16 - 60 K Bytes)
RAM
(512 - 204 8 Bytes)
MCC
(Clock C ont rol)
SPI
LINSCI2
(LIN master)
LINSCI1
(LIN master/slave)
CAN
(2.0B ACTIVE)
WINDOW
WATCHDOG
1
On some devices only, see Device Summary on page 1
(HS) 20mA high sink capability
eix associated external interrupt vector
(*) : by option bit:
T16_ICAP 1 can be moved t o PD 4
T16_ICAP 2 can be moved t o PD 1
T16_OCMP 1 can be moved to PD 3
T16_OCMP 2 can be moved to PD 5
For external pin connection guidelines, refer to See “ELECTRICAL CHARACTERISTICS” on page 221.
8/262
ST72561
PIN DESCRIPTION (Cont’d)
For external pin connection guidelines, refer to See “ELECTRICAL CHARACTERISTICS” on page 221.
Legend / Abbreviations for Tab le 1:
Type: I = input, O = output, S = supply
In/Output le v el: C
Output level: HS = 20mA high sink (on N-buffer only)
Port and control configuration:
– Input:float = floating, wpu = weak pull-up, int = interrupt
– Output: OD = open drain, PP = push-pull
Refer to “I/O PORTS” on page 47 for more details on the software configuration of the I/O ports.
The RESET con figur atio n of each pin is shown i n bol d whic h i s valid as long as the devi ce is i n rese t sta te .
Table 1. Device Pin Description
= CMOS 0.3VDD/0.7VDD with Schmitt trigger
T
T
= TTL 0.8V / 2V with Schmitt trigger
T
1)
, ana = analog, RB = robust
Pin n°
Pin Name
Type
TQFP64
TQFP44
TQFP32
111OSC1
222OSC2
3)
3)
I
I/OResonator oscillator inverter output
3--PA0 / ARTIC1I/O C
433PA1 / PWM0I/O C
544PA2 (HS) / PWM1I/O C
65-PA3 / PWM2I/O C
76-PA4 / PWM3I/O C
8--V
9--V
SS_3
DD_3
SDigital Ground Voltage
SDigital Main Supply Voltage
1075PA5 (HS) / ARTCLKI/O C
118-PA6 (HS) / ARTIC2I/O C
12--PA7 / T8_OCMP2I/O C
13--PB0 /T8_ICAP2I/O C
1496PB1 /T8_OCMP1I/O C
15 107PB2 / T8_ICAP1I/O C
16 118PB3 / MCOI/O C
17--PE0 / AIN12I/O T
18--PE1 / AIN13I/O T
19 129PB4 / AIN0 / ICCCLKI/O C
20--PE2 / AIN14I/O T
21--PE3 / AIN15I/O T
22 13 10 PB5 / AIN1 / ICCDATA I/O C
LevelPort
InputOutput
Input
Output
float
int
wpu
OD
ana
function
(after
reset)
PP
Main
Alternate function
External clock input or Resonator oscillator inverter input
Flash programming voltage.Must be
tied low in user mode
Alternate function
TIM16 Output Compare
1
TIM16 Output Compare
2
TIM16 Input
Capture 1
SPI Slave
Select
LINSCI1 Transmit Data out-
ADC Analog
Input 2
ADC Analog
Input 3
ADC Analog
Input 4
ADC Analog
Input 6
put
LINSCI2 Serial Clock Out-
put
10/262
ST72561
Pin n°
Pin Name
TQFP64
TQFP44
TQFP32
55 37 27 V
56 38 28 V
57 39 29 V
58 40 30 V
SSA
SS_0
DDA
DD_0
59 41 31 PD5 / SCI2_TDOI/O C
60 42 32 RESET
61 43-PD6 / AIN10I/O C
62 44-PD7 / AIN11I/O C
63--PF6I/O T
64--PF7I/O T
LevelPort
Type
Input
Output
float
InputOutput
int
wpu
OD
ana
function
(after
reset)
PP
Main
Alternate function
SAnalog Ground Voltage
SDigital Ground Voltage
IAnalog Reference Voltage for ADC
SDigital Main Supply Voltage
LINSCI2 Transmit Data out-
put
I/O C
T
T
T
T
T
T
XXXXPort D5
Top priority non maskable interrupt.
Xei3XXXPort D6ADC Analog Input 10
Xei3 XXXPort D7ADC Analog Input 11
XXXXPort F6
XXXXPort F7
Notes:
1. In the interrupt input column, “eiX ” defines the associated ex ternal in terrupt vecto r. If the weak pul l-up
column (wpu) is merged with the interrupt column (int), then the I/O configuration is pull-up interrupt input,
else the configuration is floating interrupt input.
2. Input mode can be used for general purpose I/O, output mode only for CANTX.
3. OSC1 and OSC2 p ins c onnect a cry stal/ceram ic resonator, or an external source to t he on-chi p os cillator; see Section 1 and Section 12.5 "CLOCK AND TIMING CHARACTERISTICS" for more details.
4. On the chip, each I/O port has 8 pads. Pads that are not bonded to external pins are in input pull-up configuration after reset. The c onfiguration of th ese pads must be kept at reset st at e to av oi d ad ded c urrent
consumption.
11/262
ST72561
3 REGISTER & MEMORY MAP
As sho wn in Figure 5, the MCU is capable of addressing 64K bytes of memories and I/O registers.
The available memory locations consist of 128
bytes of register locations, up to 2 Kbytes of RA M
and up to 60 Kbytes of user program memory.
Figure 5. Me m ory Map
0000h
007Fh
0080h
087Fh
0880h
0FFFh
1000h
FFDFh
FFE0h
FFFFh
HW Registers
(see Table 2)
RAM
(2048/1024/
512 Bytes)
Reserved
Program Memory
(60K, 32K,16K)
Interrupt & Reset Vectors
(see Table 8)
0080h
00FFh
0100h
01FFh
0200h
027Fh
or 047Fh
or 087Fh
The RAM space includes up to 256 byt es for the
stack from 0100h to 01FFh.Th e highest address
bytes contain the user reset and interrupt vectors.
IMPORTANT: Memory locations marked as “Re-
served” must never be ac ces sed. Ac cessi ng a reseved area can have unpredictable e ffects on the
device.
Short Addressing
RAM (zero page)
256 Bytes Stack
16-bit Addressing
RAM
1000h
60 KBytes
8000h
32 KBytes
C000h
16 KBytes
FFDFh
Table 2. Hardware Register Map
AddressBlock
0000h
0001h
Port A
0002h
0003h
0004h
Port B
0005h
0006h
0007h
Port C
0008h
0009h
000Ah
Port D
000Bh
000Ch
000Dh
Port E
000Eh
12/262
Register
Label
PADR
PADDR
PAOR
PBDR
PBDDR
PBOR
PCDR
PCDDR
PCOR
PDDR
PDDDR
PDOR
PEDR
PEDDR
PEOR
Register Name
Port A Data Register
Port A Data Direction Register
Port A Option Register
Port B Data Register
Port B Data Direction Register
Port B Option Register
Port C Data Register
Port C Data Direction Register
Port C Option Register
Port D Data Register
Port D Data Direction Register
Port D Option Register
Port E Data Register
Port E Data Direction Register
Port E Option Register
Reset
Status
1)
00h
00h
00h
1)
00h
00h
00h
1)
00h
00h
00h
1)
00h
00h
00h
1)
00h
00h
00h
Remarks
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
2)
R/W
ST72561
AddressBlock
000Fh
0010h
Port F
0011h
Register
Label
PFDR
PFDDR
PFOR
Register Name
Port F Data Register
Port F Data Direction Register
Port F Option Register
Reset
Status
1)
00h
00h
00h
0012h
to
Reserved Area (15 Bytes)
0020h
0021h
0022h
0023h
SPI
SPIDR
SPICR
SPICSR
SPI Data I/O Register
SPI Control Register
SPI Control/Status Register
xxh
0xh
00h
0024hFLASHFCSRFlash Control/Sta tus Registe r00hR/W
0025h
CAN Master Control Register
CAN Master Status Register
CAN Transmit Status Register
CAN Transmit Priority Register
CAN Receive FIFO Register
CAN Interrupt Enable Register
CAN Diagnosis Register
CAN Page Selection Register
1. The contents of the I/O p ort D R registers are read able only in output configuration. In i nput conf iguration, 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.
15/262
ST72561
4 FLASH PROGRAM MEMO RY
4.1 In troduc t ion
The ST7 dual voltage High Density Flash
(HDFlash) is a non-volatile memory that can be
electrically erased as a single block or by individual sectors and programmed on a Byte-by-Byte basis using an external V
supply.
PP
The HDFlash devices can be programmed and
erased off-board (plugge d in a programming tool)
or on-board using ICP (In-Circuit Programming) or
IAP (In-Application Programming).
The array matrix organ isation allows each sector
to be erased and reprogrammed wi thout affecting
other sectors.
4.2 Main Features
■ Three Flash programming modes:
– Insertion in a programming tool. In this mode,
all sectors including option bytes can be programmed or erased.
– ICP (In-Circuit Programming). In this mode, all
sectors including option bytes can be programmed or erased without removing the device from the application board.
– IAP (In-Application Programming) In this
mode, all sectors except Sector 0, can be programmed or erased without removing the device from the appli cation board a nd wh ile the
application is running.
■ ICT (In-Circuit Testing) for downloading and
executing user application test patterns in RAM
■ Read-out protection against piracy
■ Register Access Security System (RASS) to
prevent accidental programming or erasing
4.3 S tru cture
Depending on the overall Flash memory size in the
microcontroller device, there are up to three user
sectors (see Table 3). Each of these sectors can
be erased independently to avoid unnecessary
erasing of the whole Flas h memory when only a
partial erasing is required.
The first two sectors have a fixed siz e of 4 K bytes
(see Figure 6). They are mapped in the upper part
of the ST7 addressing space so the reset and interrupt vectors are located in Sector 0 (F000hFFFFh).
Table 3. Sectors available in Flash devices
Flash Size (bytes)Available Sectors
4KSector 0
8KSectors 0,1
> 8KSectors 0,1, 2
4.3.1 Read-out Protection
Read-out protection, when selected, provides a
protection against Program Memory content extraction and against write access to Flash memory.
In Flash devices, this protection is removed by reprogramming the option. In this case, the entire
program memory is first automatically erased and
the device can be reprogrammed.
Read-out protection selection depends on the device type:
– In Flash devices it is enabled and removed
through the FMP_R bit in the option byte.
– 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.
Figure 6. Me m ory Map and Sec t or Address
4K10K24K48K
1000h
3FFFh
7FFFh
9FFFh
BFFFh
D7FFh
DFFFh
EFFFh
FFFFh
16/262
8K16K32K60K
2Kbytes
8Kbytes40 Kbytes
16 Kbytes
4 Kbytes
4 Kbytes
24 Kbytes
FLASH
MEMORY SIZE
SECTOR 2
52 Kbytes
SECTOR 1
SECTOR 0
FLASH PROGRAM MEMORY (Cont’d)
ST72561
4.4 ICC Interface
ICC needs a minimum of 4 and up to 6 pins to be
connected to the programming tool (see Figure 7).
These pins are:
– RESET
– V
: device reset
: device power supply ground
SS
Figure 7. Typical ICC Interface
PROGRAMMING TOOL
APPLICATION
POWER SUPPLY
(See Note 3)
C
L2
DD
V
OSC2
OPTIONAL
(See Note 4)
C
L1
OSC1
ST7
Notes:
1. If the ICCCLK or ICCDATA pins are only used
as outputs in the application, no signal i solat ion is
necessary. As soon as the Programming Tool is
plugged to the board, even if an ICC session is not
in progress, the ICCCLK and ICCDATA pins are
not available for the application. If they are used as
inputs by the application, isolation such as a serial
resistor has to implemented i n case another device forces the signal. Refer to the Programming
Tool documentation for recommended resistor values.
2. During the ICC session, the programming tool
must control the RESET
flicts between the programming tool and the application reset circuit if it drives more than 5mA at
high level (push pull output or pull-up resistor<1K).
A schottky diode can be used to isolate th e application RESET circuit in this case. When using a
classical RC network with R>1K or a reset man-
pin. This can lead to con-
– ICCCLK: ICC output serial clock pin
– ICCDATA: ICC input/output serial data pin
– ICCSEL/V
: programming voltage
PP
– OSC1(or OSCIN): main clock input for exter-
nal source (optional)
– V
: application board power supply (opt ion-
DD
al, see Figure 7, Note 3)
ICC CONNECTOR
975 3
10kΩ
SS
V
ICCSEL/VPP
ICC Cabl e
RESET
ICCCLK
HE10 CONNECTOR TYPE
1
246810
ICCDATA
APPLICATION BOARD
ICC CONNECTOR
APPLICATION
RESET SOURCE
See Note 2
See Note 1
APPLICATION
I/O
agement IC with open drain outpu t and pull-up resistor>1K, no additional com ponents are needed.
In all cases the user must ensure that no external
reset is generated by the application during the
ICC session.
3. The use of Pin 7 of the ICC con nector de pends
on the Programming Tool architecture. This pin
must be connected when using most ST Programming Tools (it is used to monitor the application
power supply). Please refer to the Programming
Tool manual.
4. Pin 9 has to be connecte d to the OSC1 or OS CIN pin of the ST7 when the clock is not available
in the application or if the selec ted clock option is
not programmed in the opt ion byte. ST7 devices
with multi-oscillator capability need to hav e OS C2
grounded in this case.
17/262
ST72561
FLASH PROGRAM MEMORY (Cont’d)
4.5 ICP (In-Circuit Programming)
To perform ICP the microcontroller must be
switched to ICC (In-Circuit Communication) mode
by an external controller or programming tool.
Depending on the ICP code dow nloaded in RAM,
Flash memory programming can be fully customized (number of bytes to prog ram, program locations, or selection serial communication interface
for downloading).
When using an STMicroelect ronics or third-party
programming tool that supp orts ICP and the s pecific microcontroller device, the user needs only to
implement the ICP hardware interface on the application board (see Figure 7). For more details on
the pin locations, refer to the device pinout description.
4.6 IAP (In-Applic ation Progra m m i ng)
This mode uses a BootLoader program previously
stored in Sector 0 by the user (in ICP mode or by
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, (user-defined strategy for entering programming
mode, choice of communications protocol used to
fetch the data to be stored, etc.). For example, it is
possible to download code from the SPI, SCI, USB
or CAN interface and program it in the Flash. IAP
mode can be used to program any of the Flash
sectors except Sector 0, which is write/erase protected to allow recovery in case errors occur during the programming operation.
4.7 Related Documentation
For details on Flash program ming and I CC protocol, refer to the ST7 Flash Programming Reference Manual and to th e ST7 ICC Protocol Reference Manual
This register is reserved for use by Programming
Tool software. It controls the Flash programming
and erasing operations.
Table 4. Flash Control/Status Register Address and Reset Value
Address
(Hex.)
0024h
18/262
Register
Label
FCSR
Reset Value00000000
76543210
5 CENTRAL PRO CESSING UNI T
ST72561
5.1 INTRODUCTION
This CPU has a full 8-bit architecture and contains
six internal registers allowing efficient 8-bit data
manipulation.
5.2 MAIN FEATURES
■ Enable executing 63 basic instructions
■ Fast 8-bit by 8-bit multiply
■ 17 main addressing modes (with indirect
addressing mode)
■ Two 8-bit index registers
■ 16-bit stack pointer
■ Low power HALT and WAIT modes
■ Priority maskable hardware interrupts
■ Non-maskable software/hardware interrupts
Figure 8. CPU Registers
5.3 CPU REGISTERS
The 6 CPU registers shown in Figure 8 are not
present in the memory mapping and are accessed
by specific instruc tions.
Accumulator (A)
The Accumulator is an 8-bit general purpose register used to hold operan ds and the results of the
arithmetic and logic calculations and to manipulate
data.
Index Registers (X and Y)
These 8-bit registers are use d to create effective
addresses or as tempo rary storage areas f or data
manipulation. (The Cross-A ssembler generates a
precede instruction (PRE) to indicate that the following instruction refers to the Y register.)
The Y register is not affected by the interrupt automatic procedures.
Program Cou nt er (P C )
The program counter is a 16-bit register containing
the address of the next instruction to be executed
by the CPU. It is made of two 8-bit registers PCL
(Program Counter Low which is the LSB) and PCH
(Program Counter High which is the MSB).
70
RESET VALUE = XXh
70
RESET VALUE = XXh
70
RESET VALUE = XXh
158
RESET VALUE = RESET VECTOR @ FFFEh-FFFFh
15
RESET VALUE = STACK HIGHER ADDRESS
PCH
RESET VALUE =
7
70
1C1I1HI0NZ
1X11X1XX
70
8
PCL
0
ACCUMULATOR
X INDEX REGISTER
Y INDEX REGISTER
PROGRAM COUNTER
CONDITION CODE REGISTER
STACK POINTER
X = Undefined Value
19/262
ST72561
CENTRAL PROCESSING UNIT (Cont’d)
Condition Code Register (CC)
Read/Write
Reset Value: 111x1xxx
70
11I1HI0NZ
C
The 8-bit Condition Code register c ontains the interrupt masksand four flags representative of the
result of the instruction just executed. This register
can also be handled by the PUSH and POP instructions.
These bits can be individually tested and/or controlled by specific instructions.
Arithmetic Management Bits
Bit 4 = H Hal f carry.
This bit is set by hardware when a carry occurs be-
tween bits 3 and 4 of the A LU during an ADD or
ADC instructions. It is reset by hardware during
the same instruction s.
0: No half carry has occurred.
1: A half carry has occurred.
This bit is tested using the JRH or JRNH instruction. The H bit is useful in BCD arithmetic subroutines.
Bit 2 = N Negative.
This bit is set and cleared by hardware. It is repre-
sentative of the result sign of the last arithmetic,
logical or data manipulation. It’s a copy of the re-
th
sult 7
bit.
0: The result of the last operation is positive or null.
1: The result of the last operation is negative
(i.e. the most significant bit is a logic 1).
This bit is accesse d by the JRMI and JRPL instructions.
Bit 1 = Z Zero.
This bit is set and cleared by hardware. This bit in-
dicates that the result of the last arithmetic, logical
or data manipulation is zero.
0: The result of the last operation is different from
zero.
1: The result of the last operation is zero.
This bit is accessed by the JREQ and JRNE test
instructions.
Bit 0 = C Carry/borrow.
This bit is set and cleared b y hardware and software. It indicates an overflow or an underflow has
occurred during the last arithmetic operation.
0: No overflow or underflow has occurred.
1: An overflow or underflow has occurred.
This bit is driven by the SCF and RCF instructions
and tested by the JRC and JRNC instructions. It i s
also affected by the “bit test and branch”, shift and
rotate instructions.
Interrupt Managem ent B i ts
Bit 5,3 = I1, I0 Interrupt
The combination of the I1 and I0 bits gives the cur-
These two bits are set/cleared b y hardware when
entering in interrupt. The loaded value is given by
the corresponding bits in the interrupt software priority registers (IxSPR). They can be also set/
cleared by software with the RIM, SIM, IRET,
HALT, WFI and PUSH/POP instructions.
See the interrupt management chapter for more
details.
20/262
CENTRAL PROCESSING UNIT (Cont’d)
ST72561
Stack Pointer (SP)
Read/Write
Reset Value: 01 FFh
158
00000001
The least significant byte of the Stack Pointer
(called S) can be directly accessed by a LD instruction.
Note: When the lower limit is exceeded, the Stack
Pointer wraps around to the stack upper limit, without indicating the stack o verflow. The previously
stored information is then o verwritten and therefore lost. The stack also wraps in case of an underflow.
70
SP7SP6SP5SP4SP3SP2SP1
SP0
The stack is used to sav e the return address during a subroutine call and the CPU context during
an interrupt. The user may also directly manipulate
the stack by means of the PUSH and POP instruc-
The Stack Pointer is a 16-bit register which is always pointing to the next free location in the stack.
It is then decremented after data has been pushed
onto the stack and incremented before data is
popped from the stack (see Figure 9).
Since the stack is 256 bytes deep, the 8 most significant bits are forced by hardw are. Following a n
MCU Reset, or after a Reset Stack Pointer i nstruction (RSP), the Stack Pointer contains its reset value (the SP7 to SP0 bits are set) which is the stack
tions. In the case of an interrupt, the PCL is stored
at the first location pointed t o by t he SP. Then the
other registers are stored in the next locations as
shown in Figure 9.
– When an interrupt is received, the SP is decre-
mented and the context is pushed on the stack.
– On return from interrupt, the SP is incremented
and the context is popped from the stack.
A subroutine call occupies two locations and an interrupt five locat ion s i n the sta ck ar ea.
The device includes a range of utility features for
securing the application in critical situations (for
example in case of a power brown-out), and reducing the number of external components. An
overview is shown in Figure 11.
For more details, refer to dedicated parametric
section.
Main features
■ Optional PLL for multiplying the frequency by 2
■ Reset Sequence Manager (RSM)
■ Multi-Oscillator Clock Management (MO)
– 4 Crystal/Ceram ic reso n ator oscilla t or s
■ System Integrity Management (SI)
– Main supply Low voltage detection (LVD)
– Auxiliary Voltage detector (AVD) with interrupt
capability for monitoring the main supply
Figure 11. Clock, Reset and Supply Block Diagram
OSC2
OSC1
MULTI-
OSCILLATOR
(MO)
f
OSC
PLL
(option)
f
OSC2
SYSTEM INTEGRITY MANAGEMENT
6.1 PHASE LOCKED LOOP
If the clock frequency input to the PLL is in the
range 2 to 4 MHz, the PLL can be used to multiply
the frequency by two to obtain an f
OSC2
of 4 to 8
MHz. The PLL is enabled by option byte. If the PLL
is disabled, then f
OSC2 = fOSC
/2.
Caution: T he PLL is not recom mended for applications where timing accuracy is required. See
“PLL Characteristics” on page 231.
Figure 10. PLL Block Diagram
f
OSC
PLL x 2
/ 2
/ 8000
0
1
PLL OPTION BIT
8-BIT TIMER
MAIN CLOCK
CONTROLLER
WITH REALTIME
CLOCK (MCC/RT C)
f
OSC2
f
CPU
RESET
V
SS
V
DD
22/262
RESET SEQUENCE
MANAGER
(RSM)
SICSR
0
AVD Inter rupt Reques t
AVD AVD
IE
LVD
F
RF
LOW VOLTAGE
DETECTOR
(LVD)
AUXILIARY VOLTAGE
DETECTOR
(AVD)
0
00
WATCHDOG
TIMER (WDG)
WDG
RF
6.2 MULTI-OSCILLATOR (MO)
ST72561
The main clock of the ST7 can be generated by
three different source types coming from the multioscillator block:
■ an external source
■ a crystal or ceramic resonator oscillator
Each oscillator is optimized for a given freq uency
range in terms of consumption and is selectable
through the option byte. The associated hardware
configuration are shown in Table 5. Refer to the
electrical characteristics section for more details.
Caution: T he OSC1 and/or OSC2 pins must not
be left unconnected. For the purpos es of Failure
Mode and Effect Analysis, it should be noted that if
the OSC1 and/or OSC2 pins are left unconnected,
the ST7 main oscillat or m ay s tart an d, in this c onfiguration, could generate an f
clock frequency
OSC
in excess of the allowed maximum (>16MHz.),
putting the ST7 in an unsafe/undefined state. The
product behaviour must therefore be considered
undefined when the OSC pins are left unc onnected.
External Clock Source
In external clock mode, a clock signal (square, sinus or triangle) with ~50% duty cycle has to driv e
the OSC1 pin while the OSC2 pin is tied to ground.
Crystal/Ceramic Oscillators
This family of oscillators has the advantage of producing a very accurate rate on the main clock of
the ST7. The selection within a list of 5 oscillators
with different frequency ran ges has to be done by
option byte in order to reduce consumption (refer
to Section 14.1 on p age 254 for more details on
the frequency ranges). The resonator and the load
capacitors have to be placed as close as possi ble
to the oscillator pins in order to minimize output
distortion and start-up stabilization time. The loading capacitance values must be adjusted according to the selected oscillator.
These oscillators are not stopped during the
RESET phase to avoid losing time in the oscillator
start-up phase.
Table 5. ST7 Clock Sources
Hardware Configuration
ST7
OSC1OSC2
External ClockCrystal/Ceramic Resonators
EXTERNAL
SOURCE
OSC1OSC2
C
L1
CAPACITORS
ST7
LOAD
C
L2
23/262
ST72561
6.3 RESET SEQUENCE MANAGER (RSM)
6.3.1 Introd uc ti on
The reset sequence manager in cludes three RESET sources as shown in Figure 13:
■ External RESET source pulse
■ Internal LVD RESET (Low Voltage Detection)
■ Internal WATCHDOG RESET
These sources act on the RESET
pin and it is al-
ways kept low during the delay phase.
The RESET service routine vector is fixed at ad-
dresses FFFEh-FFFFh in the ST7 memory map.
The basic RESET sequence consists o f 3 p has es
as shown in F igure 12:
■ Active Phase depending on the RESET source
■ 256 or 4096 CPU clock cycle delay (selected by
opti on by te)
■ RESET vector fetch
The 256 or 4096 CPU clock cycle delay allows the
oscillator to stabilise and ensures that recovery
has taken place from the Reset st ate. T he short er
or longer clock cycle delay should be selected by
option byte to correspond to the stabilizat ion time
of the external oscillator used in the application.
Figure 13. Reset Block Diagram
The RESET vector fetch phase duration is 2 clock
cycles.
Figure 12. RESET Sequence Phases
RESET
Active Phase
INTERNAL RE SE T
256 or 4096 CLOCK CYCLES
6.3.2 Asynchr onous Externa l RESET
The RESET
output with integrated R
pin is both an input and an open-drain
weak pull-up resistor.
ON
FETCH
VECTOR
pin
This pull-up has no f ixed value but varies in accordance with the input voltage. It
can be pulled
low by external circuitry to reset the device. See
Electrical Characteristic section for more details.
A RESET signal originating from an external
source must have a duration of at least t
h(RSTL)in
in
order to be recognized (see Figure 14). This detection is asynchronous and therefore the MCU
can enter reset state even in HALT mode.
RESET
V
DD
R
ON
Filter
PULSE
GENERATOR
INTERNAL
RESET
WATCHDOG RESET
LVD RESET
24/262
RESET SEQUENCE MANAGER (Cont’d)
The RESET
pin is an asynchronous signal which
plays a major role in EMS performance. In a noisy
environment, it is recommended to follow the
guidelines mentioned in the electrical charact eristics section.
6.3.3 External Power-On RESET
If the LVD is disabled by option byte, to s tart up the
microcontroller correctly, the user must ensure by
means of an external reset circuit that the reset
signal is held low until V
level specified for the selected f
A proper reset signal for a slow rising V
is over the m inimum
DD
frequency.
OSC
supply
DD
can generally be provided by an ext ernal RC network connected to the RESET
pin.
Figure 14. RESET Sequences
V
DD
ST72561
6.3.4 Internal Low Voltage Detector (LVD)
RESET
Two differen t RESET sequences caused by the internal LVD circuitry can be distinguished:
■ Power-On RESET
■ Voltage Drop RESET
The device RESET
pulled low when V
V
DD<VIT-
(falling edge) as shown in Figure 14.
The LVD filters spikes on V
avoid parasitic resets.
6.3.5 Internal Watchdog RESET
The RESET sequence generated by a internal
Watchdog counter overflow is shown in Figure 14.
Starting from the Watchdog counter underflow, the
device RESET
low during at least t
pin acts as an output that is
DD<VIT+
(rising edge) or
larger than t
DD
g(VDD)
to
pin acts as an output that is pulled
w(RSTL)out
.
V
IT+(LVD)
V
IT-(LVD)
EXTERNAL
RESET
SOURCE
RESET PIN
WATCHDOG
RESET
RUN
LVD
RESET
ACTIVE PHASE
RUN
t
h(RSTL)in
EXTERNAL
RESET
ACTIVE
PHASE
WATCHDOG UNDERFLOW
RUNRUN
INTERNAL RESET (256 or 4096 T
VECTOR FETCH
WATCHDOG
RESET
ACTIVE
PHASE
t
w(RSTL)out
CPU
)
25/262
ST72561
6.4 SYSTEM INTEGRITY MANAGEMENT (SI)
The System Integrity Mana gement b lock contains
the Low Voltage Detector (LVD) and Auxiliary Voltage Detector (AVD) functions. It is managed by
the SICSR register.
6.4.1 Low Voltage Detector (LVD)
The Low Voltage Detector funct ion (LVD) generates a static reset when the V
below a V
IT-(LVD)
reference value. This means that
supply voltage is
DD
it secures the power-up as well as the power-down
keeping the ST7 in reset.
The V
IT-(LVD)
lower than the V
on in order to avoid a parasitic reset when the
reference value for a voltage drop is
IT+(LVD)
reference value for power-
MCU starts running and sinks current on the supply (hysteresis).
The LVD Reset circuitry generates a res et when
is below:
V
DD
– V
– V
IT+(LVD)
IT-(LVD)
when VDD is rising
when VDD is falling
The LVD func t io n is illustrate d in F igure 15.
Figure 15. Low Voltage Detector vs Reset
V
DD
Provided the minimum V
the oscillator frequency) is above V
MCU can only be in two modes:
value (guaranteed for
DD
IT-(LVD)
, the
– under full software control
– in static safe reset
In these conditions, secure operation is always ensured for the application without the need for external reset hardware.
During a Low Voltage Detector Reset, the RESET
pin is held low, thus p ermitting the MCU to reset
other devices.
Notes:
The LVD allows the device to be used without any
external RESET circuitry.
The LVD is an optional func tion which can be se-
lected by option byte.
It is recommended to make sure that the V
DD
supply voltage rises monotonously when the device is
exiting from Reset, to ensure the application functions properly.
V
IT+
(LVD)
V
IT-
(LVD)
RESET
V
hys
26/262
SYSTEM INTEGRITY MANAGEMENT (Cont’d)
6.4.2 Auxiliary Voltage Detector (AVD)
The Voltage Detector function (AVD) i s based on
an analog comparison between a V
V
IT+(AVD)
ply. The V
age is lower than the V
reference value and the VDD main sup-
IT-(AVD)
reference value for falling volt-
IT+(AVD)
reference value for
IT-(AVD)
and
rising voltage in order to avoid parasitic detection
(hysteresis).
The output of the AVD comparator is directly readable by the application software through a real
time status bit (AVDF) in t he SI CS R regi ster. This
bit is read only.
Caution: The AVD function is active only if the
LVD is enabled through the option byte.
6.4.2.1 Monitoring the V
Main Su pply
DD
If the AVD interrupt is enabled, an interrupt is generated when the voltage crosses the V
V
IT-(AVD)
threshold (AVDF bit toggles).
IT+(AVD)
or
In the case of a drop in v oltage, th e A VD interrupt
acts as an early warning, allowing software to shut
ST72561
down safely before the LVD re sets the microcontroller. See Figure 16.
The interrupt on the rising edge is used to inform
the application that the V
If the voltage rise time t
CPU cycles (depending on the reset delay selected by option byte), no AVD interrupt will be generated when V
If t
is greater than 256 or 4096 cycles then:
rv
IT+(AVD)
is reached.
– If the AVD interrupt is enabled before the
V
IT+(AVD)
threshold is reached, then 2 AVD interrupts will be received: the first when the AVDIE
bit is set, and the second when the threshold is
reached.
– If the AVD interrupt is enabled after the V
threshold is reached then only one AVD interrupt
will occur.
warning state is over.
DD
is less than 256 or 4096
rv
IT+(AVD)
Figure 16. Using the AVD to Monitor V
V
DD
DD
Early Warning Interr upt
(Power has dropped, MCU not
not yet in reset)
V
V
IT+(AVD)
V
IT-(AVD)
V
IT+(LVD)
V
IT-(LVD)
AVDF bit00RESET VALUE
AVD INTERRUPT
REQUEST
IF AVDIE bit = 1
LVD RESET
1
hyst
INTERRUPT PROCESS
t
VOLTAGE RISE TIME
rv
1
INTERRUPT PROCESS
27/262
ST72561
SYSTEM INTEGRITY MANAGEMENT (Cont’d)
6.4.3 Low Power Modes
Mode Description
WAIT
HALTThe SICSR register is frozen.
6.4.3.1 Interrupts
The AVD interrupt event generates an interrupt if
the AVDIE bit is set and the interrupt mask in the
CC register is reset (RIM instructio n ).
No effect on SI. AVD interrupts cause the
device to exit from Wait mode.
Flag
Enable
Control
Bit
Interrupt Event
AVD event AVDF AVDIEYesNo
Event
Exit
from
Wait
Exit
from
Halt
28/262
SYSTEM INTEGRITY MANAGEMENT (Cont’d)
6.4.4 Register Description
SYSTEM INTEGRITY (SI) CONTROL/STATUS REGISTER (SICSR)
Read/Write
Reset Value: 000x 000x (00h)
Bits 3:1 = Reserved, must be kept cleared.
ST72561
70
AVD
IE
AVDFLVD
RF
000
0
WDG
RF
Bit 0 = WDGRF Watchdog reset flag
This bit indicates that the last Reset was generated by the Watchdog p eripheral. It is set by hardware (watchdog reset) and cleared by software
Bit 7 = Reserved, must be kept cleared.
(writing zero) or an LVD Reset (to ensure a stable
cleared state of the WDGRF flag when CPU
starts).
Bit 6 = AVDIE Voltage Detector interrupt enable
This bit is set and cleared by software. It enables
an interrupt to be generated when the AVDF flag
changes (toggles). The pending interrupt information is automatically cleared when software enters
the AVD interrupt routine.
0: AVD interrupt disabled
Combined with the LVDRF flag information, the
flag description is given by the following table.
RESET SourcesLVDRFWDGRF
External RESET
Watchdog01
LVD1X
pin00
1: AVD interrupt enabled
Bit 5 = AVDF Voltage Detector flag
This read-only bit is set and cleared by hardware.
If the AVDIE bit is set, an interrupt request is generated when the AVDF bit changes value. Refer to
Figure 16 and to Section 6. 4.2.1 for additional de-
tails.
0: V
1: V
over V
DD
under V
DD
IT+(AVD)
IT-(AVD)
threshold
threshold
Application note s
The LVDRF flag is not cleared when another RESET type occurs (external or watchdog), the
LVDRF flag remains set to keep tra ce of the original failure.
In this case, a watchdog reset can be detected by
software while an external reset can not.
CAUTION: When the LVD is not activated with the
associated option byte, the WDGRF flag can not
Bit 4 = L VDRF LVD reset flag
be used in the application.
This bit indicates that the last Reset was generated by the LVD block. It is set by hardware (LVD reset) and cleared by software (writing zero). See
WDGRF flag description for more details. When
the LVD is disabled by OPTION BYTE, the LVDRF
bit value is undefined.
29/262
ST72561
7 INTERRUPTS
7.1 INTRODUCTION
The ST7 enhanced interrupt management provides the following features:
■ Hardware interrupts
■ Software interrupt (TRAP)
■ Nested or concurrent interrupt management
with flexible interrupt priority and level
management:
– Up to 4 software programmable nesting levels
– Up to 16 interrupt vectors fixed by hardware
– 2 non maskable events: RESET, TRAP
– 1 maskable Top Level Event: TLI
This interrupt management is based on:
– Bit 5 and bit 3 of the CPU CC register (I1:0),
– Interrupt software priority registers (ISPRx),
– Fixed interrupt vector addresses located at the
high addresses of the memory map (FFE0h to
FFFFh) sorted by hardware priority order.
This enhanced interrupt cont roller guarantees full
upward compatibility with the standard (not nested) ST7 interrupt controller.
7.2 MASKIN G AN D PROC ESSING FLOW
The interrupt masking is managed by the I1 and I0
bits of the CC register and the ISPRx registers
which give the interrupt software priority level of
each interrupt vector (see Table 6). The processing flow is shown in Figure 17
When an interrupt request has to be serviced:
– Normal processing is suspended at the end of
the current instruction execution.
– The PC, X, A and CC registers are saved onto
the stack.
– I1 and I0 bits of CC register are set according to
the corresponding values in the ISPRx registers
of the serviced interrupt vector.
– The PC is then loaded with the interrupt vector of
the interrupt to service and the first instruction of
the interrupt service routine is fetched (refer to
“Inter rupt M a pping ” table for vector addresses).
The interrupt service routine should end with the
IRET instruction which causes the contents of the
saved registers to be recovered from the stack.
Note: As a consequence of the IRET instruction,
the I1 and I0 bits will be rest ored from the stack
and the program in the previous level will resume.