Operati ng Supply3.0V to 5.5V3.0 to 5.5V
CPU Frequency2 to 8 MHz (with 4 to 16 MHz oscillator)2 to 4 MHz
Operati ng T em perature-40°C to +85°C (-40°C to +105/125°C optional)
PackagesTQFP64
Note 1. See Section 12.3.1 on page 119 for more information on VDD versus f
2
PROM Data memory
Watchdog, two 16-bit timers, 8-bi t PWM ART,
SPI, SCI, CAN, ADC
TQFP64
14 x 14
– Two 16-bit timers with: 2 input captures, 2 out-
put compares, external clock input on one timer, PWM and Pulse generator modes
■ 3 Communications Interfaces
– SPI synchronous serial interface
– SCI asynchronous serial interface
– CAN interface (except on ST72311Rx)
■ 1 Analog peripheral
– 8-bit ADC with 8 input channels
■ Instruction Set
– 8-bit data manipulation
– 63 basic instructions
– 17 main addressing modes
– 8 x 8 unsigned multiply instruction
– True bit manipulation
The ST72311R, ST72511R, and ST72532R devices are members of the ST7 microcontroller family.
They can be grouped as follows:
– ST725xxR devices are designed for mid-range
applications with a CAN bus interface (Controller
Area Network). These devices are available in
OTP and EPROM versions only.
– ST72311R devices target the same range of ap-
plications but without the CAN interface. These
devices are available in ROM, OTP and EPROM
versions.
All devices are based on a common industrystandard 8-bit core, featuring an enhanced instruction set.
Figure 1. Device Block Diagram
8-BIT CORE
ALU
RESET
V
TLI
V
DD
V
OSC1
OSC2
PF7:0
(8-BIT)
PP
SS
CONTROL
LVD
OSC
MCC/RTC
PORT F
TIMER A
BEEP
Under software control, all devices can be p laced
in WAIT, SLOW, ACTIVE-HALT or HALT mode,
reducing power consumption when the application
is in idle or standby state.
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.
PROGRAM
MEMORY
(16K - 60K By tes)
RAM
(1024, 2048 Bytes)
EEPROM
(256 Bytes)
ADDRESS AND DATA BUS
WATCHDOG
PORT A
PORT B
PWM ART
PA7:0
(8-BIT)
PB7:0
(8-BIT)
6/152
4
PE7:0
(8-BIT)
PD7:0
(8-BIT)
V
DDA
V
SSA
PORT E
CAN
SCI
PORT D
8-BIT ADC
PORT C
TIMER B
SPI
PC7:0
(8-BIT)
1.2 PIN DESCRIPTI ON
Figure 2. 64-Pin TQFP Package Pinout
– Output : OD = open drain
Refer to Section 8 "I/O PORTS" on page 38 for more details on the software configuration of the I/O ports.
The RESET configur at i on of each pin is shown in bold. This configuratio n is va li d as l o ng as the device is
in reset state.
Table 1. Device Pin Description
/0.7VDD,
DD
2)
, PP = push-pull
1)
, ana = analog
Pin n°
Pin Name
LevelPort
InputOutput
Type
Input
TQFP64
Output
float
wpu
int
ana
OD
PP
1PE4 (HS)I/O CTHS XXXXPort E4
2PE5 (HS)I/O C
3PE6 (HS)I/O C
4PE7 (HS)I/O C
5PB0/PWM3I/OC
6PB1/PWM2I/OC
7PB2/PWM1I/OC
8PB3/PWM0I/OC
Xei1XXPort F0Main clock output (f
Xei1XXPort F1Beep signal output
Xei1XXPort F2
XXXX Port F3Timer A Output Compare 2
XXXX Port F4Timer A Output Compare 1
XXXX Port F5Timer A Input Capture 2
HS XXXXPort F6Timer A Input Capture 1
HS XXXXPort F7Timer A External Clock Source
XXXX Port C0Timer B Output Compare 2
XXXX Port C1Timer B Output Compare 1
HS XXXXPort C2Timer B Input Capture 2
HS XXXXPort C3Timer B Input Capture 1
XXXX Port C4SPI Master In / Slave Out Data
XXXX Port C5SPI Master Out / Slave In Data
XXXX Port C6SPI Serial Clock
XXXX Port C7SPI Slave Select (active low)
Xei0XXPort A0
Xei0XXPort A1
Xei0XXPort A2
Xei0XXPort A3
1. In the interrupt input column, “eiX” define s the asso ciated exte rnal interrupt vec tor. 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. In the open drain output column, “T” defines a true open drain I/O (P-Buffer and protection diode to V
are not implemented). See Section 8 "I/O PORT S" o n page 38 and Section 12.8 "I /O PORT PIN CHAR-
DD
ACTERISTICS" on page 131 for more details.
3. OSC1 and OSC2 pins connect a crystal/ceramic resonator or an external source to the on-chip oscillator
see Section 1.2 "PIN DESCRIPTION" on page 7 and Section 12.5 "CLOCK AND TIMING CHARACTER-
ISTICS" on page 124 for more details.
10/152
1.3 REGISTER & MEMORY MAP
ST72311R, ST72511R, ST72532R
As shown in the Figure 3, the MCU is capable of
addressing 64K bytes of memories and I/O registers.
The available memory locations consist of 128
bytes of register location, up to 2Kbytes of RAM,
up to 256 bytes of data EEPROM and up to
Figure 3. Me m ory Map
0000h
007Fh
0080h
087Fh
0880h
0BFFh
0C00h
0CFFh
0D00h
0FFFh
1000h
FFDFh
FFE0h
FFFFh
HW Registers
(see Table 2)
1024 Bytes RAM
1536 Bytes RAM
2048 Bytes RAM
Reserved
Optional EEPROM
(256 Bytes)
Reserved
Program Memory
(60K, 48K, 32K, 16K Bytes)
Interrupt & Reset Vectors
(see Table 7 on page 32)
60Kbytes of user program memory. The RAM
space includes up to 2 56 bytes for the st ack from
0100h to 01FFh.
The highest address by tes contain the user re set
and interrupt vectors.
0080h
00FFh
0100h
01FFh
0200h
047Fh
or 067Fh
or 087Fh
Short Addressing
RAM (zero page)
Stack
(256 Bytes)
16-bit Addressing
RAM
1000h
60 KBytes
4000h
48 KBytes
8000h
32 KBytes
C000h
16 KBytes
FFFFh
11/152
ST72311R, ST72511R, ST72532R
Table 2. Hardware Register Map
AddressBlock
0000h
0001h
Port A
0002h
Register
Label
PADR
PADDR
PAOR
Register Name
Port A Data Register
Port A Data Direction Register
Port A Option Register
0003hReserved Area (1 Byte)
0004h
0005h
0006h
Port C
PCDR
PCDDR
PCOR
Port C Data Register
Port C Data Direction Register
Port C Option Register
0007hReserved Area (1 Byte)
0008h
0009h
000Ah
Port B
PBDR
PBDDR
PBOR
Port B Data Register
Port B Data Direction Register
Port B Option Register
000BhReserved Area (1 Byte)
000Ch
000Dh
000Eh
Port E
PEDR
PEDDR
PEOR
Port E Data Register
Port E Data Direction Register
Port E Option Register
000FhReserved Area (1 Byte)
0010h
0011h
0012h
Port D
PDDR
PDDDR
PDOR
Port D Data Register
Port D Data Direction Register
Port D 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
R/W
R/W
2)
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
2)
R/W
2)
R/W
R/W
R/W
R/W
0013hReserved Area (1 Byte)
1)
0014h
0015h
0016h
Port F
PFDR
PFDDR
PFOR
Port F Data Register
Port F Data Direction Register
Port F Option Register
00h
00h
00h
0017h
to
Reserved Area (9 Bytes)
001Fh
0020hMISCR1Miscellaneous Register 100hR/W
0021h
0022h
0023h
0024h
0025h
0026h
0027h
SPI
ITC
SPIDR
SPICR
SPISR
ISPR0
ISPR1
ISPR2
ISPR3
SPI Data I/O Register
SPI Control Register
SPI Status Register
Watchdog Control Register
Watchdog Status Register
Reserved Area (4 Bytes)
Timer A Control Register 2
Timer A Control Register 1
Timer A Status Register
Timer A Input Capture 1 High Register
Timer A Input Capture 1 Low Register
Timer A Output Compare 1 High Register
Timer A Output Compare 1 Low Register
Timer A Counter High Register
Timer A Counter Low Register
Timer A Alternate Counter High Register
Timer A Alternate Counter Low Register
Timer A Input Capture 2 High Register
Timer A Input Capture 2 Low Register
Timer A Output Compare 2 High Register
Timer A Output Compare 2 Low Register
Reset
Status
7Fh
000x 000x
00h
00h
xxh
xxh
xxh
80h
00h
FFh
FCh
FFh
FCh
xxh
xxh
80h
00h
Remarks
R/W
R/W
R/W
R/W
Read Only
Read Only
Read Only
R/W
R/W
Read Only
Read Only
Read Only
Read Only
Read Only
Read Only
R/W
Timer B Control Register 2
Timer B Control Register 1
Timer B Status Register
Timer B Input Capture 1 High Register
Timer B Input Capture 1 Low Register
Timer B Output Compare 1 High Register
Timer B Output Compare 1 Low Register
Timer B Counter High Register
Timer B Counter Low Register
Timer B Alternate Counter High Register
Timer B Alternate Counter Low Register
Timer B Input Capture 2 High Register
Timer B Input Capture 2 Low Register
Timer B Output Compare 2 High Register
Timer B Output Compare 2 Low Register
SCI Status Register
SCI Data Register
SCI Baud Rate Register
SCI Control Register 1
SCI Control Register 2
SCI Extended Receive Prescaler Register
Reserved area
SCI Extended Transmit Prescaler Register
00h
00h
xxh
xxh
xxh
80h
00h
FFh
FCh
FFh
FCh
xxh
xxh
80h
00h
C0h
xxh
00xx xxxx
xxh
00h
00h
00h
R/W
R/W
Read Only
Read Only
Read Only
R/W
R/W
Read Only
Read Only
Read Only
Read Only
Read Only
Read Only
R/W
R/W
Read Only
R/W
R/W
R/W
R/W
R/W
R/W
13/152
ST72311R, ST72511R, ST72532R
AddressBlock
0058h
0059h
005Ah
005Bh
005Ch
005Dh
005Eh
005Fh
0060h
to
006Fh
0070h
0071h
0072h
0073h
0074h
0075h
0076h
0077h
0078h
0079h
CAN
ADC
PWM ART
Register
Label
CANISR
CANICR
CANCSR
CANBRPR
CANBTR
CANPSR
ADCDR
ADCCSR
PWMDCR3
PWMDCR2
PWMDCR1
PWMDCR0
PWMCR
ARTCSR
ARTCAR
ARTARR
Register Name
Reserved Area (2 Bytes)
CAN Interrupt Status Register
CAN Interrupt Control Register
CAN Control / Status Register
CAN Baud Rate Prescaler Register
CAN Bit Timing Register
CAN Page Selection Register
First address
to
Last address of CAN page X
Data Register
Control/Status Register
PWM AR Timer Duty Cycle Register 3
PWM AR Timer Duty Cycle Register 2
PWM AR Timer Duty Cycle Register 1
PWM AR Timer Duty Cycle Register 0
PWM AR Timer Control Register
1. The contents of the I/O p ort DR registers are readable only i n out put c onfigurat ion. I n i nput c onfiguration, 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.
14/152
2 EPROM PROGRAM MEMORY
ST72311R, ST72511R, ST72532R
The program memory of the OTP and EPROM devices can be programmed with E PROM program ming tools available from STMicroelectronics
EPROM Erasure
EPROM devices are erased by exposure to high
intensity UV light admitted through the transparent
window. This exposure discharges the floating
gate to its initial state through induced photo current.
It is recommended that the EPROM devices be
kept out of direct sunlight, since the UV content of
sunlight can be sufficient t o cause functional failure. Extended exposure to room level fluorescent
lighting may also cause erasure.
An opaque coating (paint, tape, label, etc...)
should be placed over the package window if the
product is to be operated under these lighting conditions. Covering the window also reduces I
power-saving modes du e to photo-diode leakage
currents.
DD
in
15/152
ST72311R, ST72511R, ST72532R
3 DATA EEPROM
3.1 INTRODUCTION
The Electrically Erasable Programmable Read
Only Memory can be us ed as a non volatile backup for storing data. Using the EEPROM requires a
basic access protocol described in this chapter.
Figure 4. EEPR OM Block Diagra m
FALLI N G
EEPROM INTERRUPT
EECSR
DETECTOR
EEPROMRESERVED
IELAT00000PGM
3.2 MAIN FEATURES
■ Up to 16 Bytes programmed in the same cycle
■ EEPROM mono-voltage (charge pump)
■ Chained erase and progr ammi ng cycle s
■ Interna l c ont rol of the global programming cycle
duration
■ End of programming cycle interrupt flag
■ WAIT mode management
EDGE
HIGH VOLTAGE
PUMP
ADDRESS
DECODER
ADDRESS BUS
4
ROW
DECODE R
4
4
MEMORY MATRIX
(1 ROW = 1 6 x 8 BITS)
DATA
MULTIPLEXER
EEPROM
128128
16 x 8 BITS
DATA LATCH ES
DATA BUS
16/152
DATA EEPROM (Cont’d)
ST72311R, ST72511R, ST72532R
3.3 MEMORY ACCESS
The Data EEPROM memory read/write access
modes are controlled by the LAT bit of the EEPROM Control/Status register (EECSR). The flowchart in Figure 5 describes these different memory
access modes.
Read Operation (LAT=0)
The EEPROM can be read as a normal ROM location when the LAT bit of the EECSR register is
cleared. In a read cycle, the byte to be accessed is
put on the dat a bus in l ess th an 1 CPU clock cycle .
This means that reading data from EEPROM
takes the same time as reading data from
EPROM, but this memory cannot be used to execute machine code.
Note: In order to ensure the correct read out of the
EEPROM over the entire temperature range, the
cell whose contents will be read, must be read
twice in compliance with the following conditions:
■ a first reading must be immediately foll owed by
a second reading
– all interrupts must be disabled until the two
readings are performed
– no other instructions are allowed between the
two reading instructions
■ the data of the first reading has to be discarded
The described procedu re corresponds to the fo llowing code sequence:
sim
ld A,eeprom_var
ld A,eeprom_var
rim
where eeprom_var adresses t he EERPOM cell to
be read. Any of the ST7 addressing modes may be
used.
Write Operation (LAT=1)
To access the write m ode, the LAT bit has to be
set by software (the PGM bit remains cleared).
When a write access t o the EEPRO M area o ccurs ,
the value is l atched in side the 16 data latch es ac cording to its address.
When PGM bit is set by the software, all the previous bytes written in the data latches (up to 16) are
programmed in the EEPR OM cells. The effective
high address (row) is determined by the la st EEPROM write sequence. To avoid wrong programming, the user must take care that all the bytes
written between two programming sequences
have the same hig h address: only the four Le ast
Significant Bits of the address can change.
At the end of the programming cycle, the PGM and
LAT bits are cleared simultaneously, and an in terrupt is generated if the IE bit is set. The Data EEPROM interrupt request is cleared by hardware
when the Data EEPROM interrupt vector is
fetched.
Note: Care should be taken during the programming cycle. Writing to the same memory location
will over-program the memory (logical AND between the two w rite access data result) because
the data latches are only cleared at the end of the
programming cycle and by the falling edge of LA T
bit. It is not possible to read the latched data.
This note is ilustrated by the Figure 6.
Figure 5. Data EE P R OM Pr ogramming Fl ow c hart
READ MOD E
LAT=0
PGM=0
READ B YT ES
IN EEPROM AREA
INTERRUPT GENERATION
IF IE= 101
CLEARED BY HARDWARE
WRITE MODE
LAT=1
PGM=0
WRITEUPTO16BYTES
IN EEPROM AREA
(with the same 12 MSB of the address)
STARTPROGRAMMING CYCLE
LAT=1
PGM=1 (set by software)
LAT
17/152
ST72311R, ST72511R, ST72532R
DATA EEPROM (Cont’d)
3.4 POWER SAVI NG MO DE S
Wait mode
The DATA EEPROM can enter WAIT mode on execution of the WFI inst ruction of the m icrocontroller. The DATA EEPROM will immediately enter
this mode if there is no programming i n progress,
otherwise the DATA EEPROM will finish the cycle
and then enter WAIT mode.
Halt mode
The DATA EEPROM immediatly enters HALT
mode if the microcontroller exec utes the HA LT instruction. Therefore the EEPROM will stop the
function in progress, and data may be corrupted.
Figure 6. Data EE P R OM Pr ogramming Cy cl e
READ OP ERATION NOT POSSIBLE
INTERNAL
PROGRAMMING
VOLTAGE
ERASE CYCLEWRITE CYCLE
WRITEOF
DATA LATCHES
3.5 ACCESS ERROR HANDLING
If a read access occurs while LAT=1, then the data
bus will not be driven.
If a write access occurs while LAT=0, then the
data on the bu s w ill not be latche d.
If a programming cycl e is interrupted (by software/
RESET action), the memory data will not be guaranteed.
READ OPERATION POSSIBLE
t
PROG
EEPROM INTERRUPT
LAT
PGM
18/152
DATA EEPROM (Cont’d)
ST72311R, ST72511R, ST72532R
3.6 REGISTER DESCRIPTION
Bit 1 = LAT
Latch Access Transfer
This bit is set by software. It is cleared by hard-
CONTROL/STATUS REGISTER (CSR)
Read/Write
Reset Value: 0000 0000 (00h)
70
00000IELATPGM
ware at the end of the programming cycle. It can
only be cleared by software if PGM bit is cleared.
0: Read mode
1: Write mode
Bit 0 = PGM
Programming control and status
This bit is set by software to begin the programming
cycle. At the end of the programming cycle, this bit
is cleared by hardware and an interrupt is generated
Bits 7:3 = Reserved, forced by hardware to 0.
if the ITE bit is set.
0: Programming finished or not yet started
Bit 2 = IE
Interrupt enable
This bit is set and cleared by software. It enables the
Data EEPROM interrupt capability when t he PGM
bit is cleared by hardware. The interrupt request is
1: Programming cycle is in progress
Note: if the PGM bit is cleared during the programming cycle, the memory data is not guaranteed
automatically cleared when the software enters the
interrupt routine.
0: Interrupt disabled
1: Interrupt enabled
Table 3. DATA EEPROM Register Map and Reset Values
Address
(Hex.)
Register
Label
76543210
002Ch
EECSR
Reset Value
00000IE0
RWM
0
PGM
0
19/152
ST72311R, ST72511R, ST72532R
4 CENTRAL PROCE SSI NG UNIT
4.1 INTRODUCTION
This CPU has a full 8-bit architecture and contains
six internal registers allowing efficient 8-bit data
manipulation.
4.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 7. CPU Registers
4.3 CPU REGISTERS
The 6 CPU registers shown in Figure 7 are not
present in the memory mapping and are accessed
by specifi c ins t r uc 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 used to create effective
addresses or as tempora ry storage areas f or dat a
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
20/152
ST72311R, ST72511R, ST72532R
CENTRAL PROCESSING UNIT (Cont’d)
Zero
Condition Code Register (CC)
Read/Write
Reset Value: 111x1xxx
70
Bit 1 = Z
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.
11I1HI0NZ
C
1: The result of the last operation is zero.
This bit is accessed by the JREQ and JRNE test
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
Half carry
.
This bit is set by hardware when a carry occurs between bits 3 and 4 of t he ALU 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 representative of the result sign of the last arithmetic,
logical or data manipulation. I t’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 accessed by the JRMI and JRPL instructions.
instructions.
Bit 0 = C
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 is
also affected by the “bit test and branch”, shift and
rotate instructions.
Interrupt Manageme nt B i ts
Bit 5,3 = I1, I0
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.
.
Carry/borrow.
Interrupt
21/152
ST72311R, ST72511R, ST72532R
CENTRAL PROCESSING UNIT (Cont’d)
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, wi thout indicating the s tack ove rflow. 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 save the retu rn 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 8).
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 Pointe r instruction (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 point ed to by the SP. Then the
other registers are stored in the next locations as
shown in Figure 8.
– 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 ions i n the sta ck ar ea.
The ST72311R, ST72511R and ST72532R microcontrollers include 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
Main features
■ Main supply low voltage detection (LVD)
■ RESET Manager (RSM)
■ Low consumption resonator oscillator
is shown in F igure 9.
Figure 9. Cl oc k , RESET, Option and Supply Manage ment Overview
OSC2
OSC1
RESET
V
DD
V
SS
OSCILLATOR
RESET
LOW VOLTAGE
DETECTOR
(LVD)
f
OSC
TO
MAIN CLOCK
CONTROLLER
FROM
WATCHDOG
PERIPHERAL
23/152
ST72311R, ST72511R, ST72532R
5.1 LOW VOLTAGE DETECTOR (LVD)
To allow the integration of power management
features in the application, the Low Voltage Detector function (LVD) generates a static reset when
the V
supply voltage is below a V
DD
reference
IT-
value. This means that it secures the power-up as
well as the power-down keeping the ST7 in reset.
The V
than the V
reference value for a voltage drop is lower
IT-
reference value for power-on in order
IT+
to avoid a parasitic reset when the MCU starts running and sinks current on the supply (hysteresis).
The LVD Reset circuitry generates a reset when
V
is below:
DD
when VDD is rising
–V
IT+
when VDD is falling
–V
IT-
The LVD func t ion is illustrated in F igure 10.
Provided the minimum V
the oscillator frequency) is below V
value (guaranteed for
DD
, the MCU
IT-
can only be in two modes:
Figure 10. Low Voltage Detector vs Reset
V
DD
V
IT+
V
IT-
– 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 function whi ch can be se-
lected when ordering the device (ordering information).
V
hys
RESET
24/152
5.2 RESET SEQUENCE MANAGER (RSM)
ST72311R, ST72511R, ST72532R
5.2.1 Introd uct i on
The reset sequence manager in cludes three RESET sources as shown in F igure 12:
■ 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 s eque nc e cons i sts o f 3 p has es
as shown in Figure 11:
■ Delay depending on the RESET source
■ 4096 CPU clock cycle delay
■ RESET vector fetch
Figure 12. Reset Block Diagram
V
RESET
DD
R
ON
f
CPU
The 4096 CPU clock cycle delay allows the oscillator to stabilise and ensures that recovery has
taken place from the Reset state.
The RESET vector fetch phase duration is 2 clock
cycles.
Figure 11. RESET Sequence Phases
RESET
DELAY
INTERNAL RESET
4096 CLOCK CYCLES
COUNTER
FETCH
VECTOR
INTERNAL
RESET
WATC HDOG RESET
LVD RESET
25/152
ST72311R, ST72511R, ST72532R
RESET SEQUENCE MANAGER (Cont’d)
5.2.2 Asynchronous External RES ET
The RESET
output with integrated R
pin is both an input and an open-drain
weak pull-up resistor.
ON
pin
This pull-up has no fixe d value but varies in accordance with the input voltage. It
can be pulled
low by external circuitry to reset the device. See
electrical characteristics 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 as shown in Figure 13. This
detection is asynchronous and theref ore the M C U
can enter reset state even in HALT mode.
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 electr ical characteristics section.
Figure 13. RESET Sequences
V
DD
V
IT+
V
IT-
5.2.3 Inte r na l Lo w Volta ge Detection 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 13.
The LVD filters spikes on V
pin acts as an output that is
DD<VIT+
(rising edge) or
larger than t
DD
g(VDD)
to
avoid parasitic resets.
5.2.4 Internal Watchdog RESET
The RESET sequence generated by a internal
Watchdog counter overflow is shown in Figure 13.
Starting from the Watchdog counter underflow, the
device RESET
low during t
pin acts as an output that is pulled
w(RSTL)out
.
CAUTION: this output signal as not enough energy to be used to drive external devices.
WATCHDOG
RESET
EXTERNAL
RESET
SOURCE
RESET PIN
WATCHDOG
RESET
RUN
LVD
RESET
DELAY
RUN
t
h(RSTL)in
SHORT EXT.
RESET
RUN
DELAY
WATCHDOGUNDERFLOW
RUN
DELAY
t
w(RSTL)out
INTERNAL RESET (4096T
FETCH VECTOR
CPU
)
26/152
5.3 LOW CONSUMPTION OSCILLATOR
ST72311R, ST72511R, ST72532R
The f
main clock of the ST7 can be generated
OSC
by two different source types:
■ an external source
■ a crystal or ceramic resonator oscillators
The associated hardware configuration are shown
in Table 4 . Refer to the electrical characteristics
section for mor e d etails.
External Clock Source
In this external clock mode, a clock signal (square,
sinus or triangle) with ~50% duty cycle has to drive
the OSC1 pin while the OSC2 pin is tied to ground.
Crystal/Ceramic Oscillator
This oscillator (based on constant current source)
is optimized in t erms of c onsumption and has the
advantage of producing a very accurate rate on
the m ain clo ck of th e S T7.
When using this oscillator, the resonator and the
load capacitances have to be connected as shown
in T able 4 and have to be mounted as close as
possible to the oscillator pins in ord er to minimize
output distortion and start-up stabilization time.
This oscillator is not stopped during the RESET
phase to avoid losing time in the oscillator start-up
phase.
These oscillators are not stopped during the
RESET phase to avoid losing time in the oscillator
start-up phase.
Table 4. ST7 Clock Sources
Hardware Configuration
OSC1OSC2
External ClockCrystal/Ceramic Resonators
EXTERNAL
SOURCE
OSC1OSC2
C
L1
ST7
ST7
LOAD
CAPACITORS
V
DD
R
OBP
C
L2
27/152
ST72311R, ST72511R, ST72532R
6 INTE RRUPTS
6.1 INTRODUCTION
The CPU 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 int errupt vector addre sses located at the
high addresses of the memory map (FFE0h to
FFFFh) sorted by hardware priority order.
This enhanced interrupt controller guarantees full
upward compatibility with the standard (not nested) CPU interrupt controller.
6.2 MASKI NG 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 1). The processing flow is shown in Figure 1.
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 t o
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
“Interrupt Mapping” table for vector addresses).
The interrupt service routine should end with the
IRET instruction which causes the c ontents of t he
saved registers to be recovered from the stack.
Note: As a consequence of the IRET instruction,
the I1 and I0 bits will be restored from the stack
and the program in the previous level will resume.
As several interrupts can b e pending at the sam e
time, the interrupt to be taken into account is determined by the following two-step process:
– the highest software priority interrupt is serviced,
– if several interrupts have the same software pri-
ority then the interrupt with the highest hardware
priority is serviced first.
Figure 2 describes this decision process.
Figure 15. Priority Decision Process
PENDING
INTERRUPTS
Same
HIGHEST HARDWARE
PRIORITY SERVICED
SOFTWARE
PRIORITY
HIGHEST SOFTWARE
PRIORITY SERVICED
Different
When an interrupt request is not serviced immediately, it is latched and then processed when its
software priority combined with the hardware priority becomes the highest one.
Note 1: The hardware priority is exclusive while
the software one is not. This allows the previ ous
process to succeed with only one interrupt.
Note 2: RESET, TRAP and TLI can be considered
as having the highest software priority in the decision process.
Different Interrupt Vector Sources
Two interrupt source types are managed by the
CPU interrupt controller: the non-maskable type
(RESET, TRAP) and the maskable type (ex ternal
or from internal peripherals).
Non-Maskable Sources
These sources are processed regardless of the
state of the I1 and I0 bits of the CC register (see
Figure 1). After stacking the PC, X, A and CC reg-
isters (except for RESET), the corresponding vector is loaded in the PC register and the I1 and I0
bits of the CC are set to disable interrupts (level 3).
These sources allow the processor to exit HALT
mode.
■ TRAP (Non Maskable Software Interrupt)
This software interrupt is serviced when the TRAP
instruction is executed. It will be serviced according to the flowchart in Figure 1 as a TLI.
Caution: TRAP can be interrupted by a TLI.
■ RESET
The RESET source has the highest priority in the
CPU. This means that the first current routine has
the highest software priority (level 3) and the highest hardware priority.
See the RESET chapter for more details.
Maskable Sources
Maskable interrupt vect or sourc es can be serviced
if the corresponding interrupt is e nabled and if its
own interrupt software priority (in ISPRx registers)
is higher than the one currently being serviced (I1
and I0 in CC regist er). If any of these two conditions is false, the interrupt is la tched and thus remains pending.
■ TLI (Top Level Hardware Interrupt)
This hardware interrupt occurs when a specific
edge is detected on the dedicated TLI pin.
Caution: A TRAP instruction must not be used in a
TLI se rvice routi ne.
■ External Interrupts
External interrupts allow the processor to exit from
HALT low power mode.
External interrupt sensitivity is software selectable
through the External Interrupt Control register
(EICR).
External interrupt triggered on edge will be latched
and the interrupt request automatically cleared
upon entering the interrupt service routine.
If several input pins of a grou p connected to the
same interrupt line are selected simultaneously,
these will b e lo gically NAND ed.
■ Peripheral Interrupts
Usually the peripheral interrupts cause the Device
to exit from HALT mode except those mentioned in
the “Interrupt Mapping” table.
A peripheral interrupt occurs when a specific flag
is set in the peripheral status registers and if the
corresponding enable bit is set in the peripheral
control register.
The general sequence for clearing an interrupt is
based on an access to the status register followed
by a read or write to an associated register.
Note: The clearing sequence resets the internal
latch. A pending interrupt (i.e. waiting for being
serviced) will therefore be lost if the clear sequence is executed.
29/152
ST72311R, ST72511R, ST72532R
INTERRUPTS (Cont’d)
6.3 INTERRUPTS AND LOW POWER MODES
All interrupts allow the processor to exit the WAIT
low power mode. On the contrary, only external
and other specified interrupts allow the processor
to exit from the HALT modes (see column “Exit
from HALT” in “Interrupt Mapping” table). When
several pending interrupts are present while exiting HALT mode, the first one serviced can only be
an interrupt with e xit from HALT mode capab ility
and it is selected through the same decision process shown in Figure 2.
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 16. Concurrent Int errupt Manag e m ent
IT2
IT1
IT4
IT2
RIM
IT1
IT3
TLI
IT0
TLI
IT1
HARDWARE PRIORITY
MAIN
11 / 10
6.4 CONCURRENT & NESTED MANAGEMENT
The following Figure 3 and Fig ure 4 show two different interrupt management modes. The first is
called concurrent mode and does not allow an interrupt to be interrupted, unlike the nested mode in
Figure 4. The interrupt hardware priority is given in
this order from the lowest to the highest: MAIN,
IT4, IT3, IT2, IT1, IT0, TLI. The software priority is
given for each interrupt.
Warning: A stack overflow may occur without notifying the software of the failure.
SOFTWARE
PRIORITY
LEVEL
IT0
IT3
IT4
MAIN
3
3
3
3
3
3
3/0
I1
11
11
11
11
11
11
10
I0
USED STACK = 10 BYTES
Figure 17. Nested Interrupt Management
IT2
IT1
IT4
IT1
IT2
RIM
HARDWARE PRIORITY
MAIN
IT4
IT3
TLI
IT0
TLI
11 / 10
30/152
IT4
IT0
IT3
IT1
SOFTWARE
PRIORITY
LEVEL
IT2
10
MAIN
I1I0
3
3
2
1
3
3
3/0
11
11
00
01
11
11
USED STACK = 20 BYTES
Loading...
+ 122 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.