The ST7MCxdevice is member of the ST7 microcontroller family designed for mid-range applications with a Motor Control dedicated peripheral.
All devices are based on a common industrystandard 8-bit core, featuring an enhanced instruction set and are available with FLASH, ROM or
FASTROM program memory.
Under software control, all devices can b e placed
in WAIT, SLOW, ACTIVE-HALT or HALT mode,
reducing power consumption when the application
is in idle or stand-by state.
Figure 1. Device Block Diagram
8-BIT CO RE
RESET
V
PP
V
SS
V
DD
OSC1
OSC2
ALU
CONTROL
LVD
AVD
OSC
SCI/LIN
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.
The devices feature an on-chip Debug Module
(DM) to support in-circuit debugging (ICD). For a
description of the DM registers, refer to the ST7
ICC Protocol Reference Manual.
PROGRAM
MEMORY
(8K - 60K Bytes)
RAM
(384 - 15 36 B ytes)
1)
PORT H
ADDRESS AND DATA BUS
PORT G
WATCHDOG
1)
1)
PH7:0
(8-bits)
PG7:0
(8-bits)
1)
PORT D
PD7:0
(8-bits)
V
AREF
V
SSA
PE5:0
(6-bits)
PF5:0
(6-bits)
On some devices only, see Table 1, “ST 7MC Devi ce Pin De scription,” on page 11
(HS) 20mA high sink c ap ability
eix associated external interrupt vector
* Once the MTC peripheral i s ON , the pin PC4 is configured t o an alternate function. PC4 is no l onger usable as a digital I/ O
MCIB / PB2
PG7
PG4
PG5
PG6
(HS) PC0
MISO / PB4
MCIC / PB3
SCK / (HS) PB6
AIN3 / MOSI / PB5
AIN4 /SS /(HS) PB7
OAP / PC2
OAN / PC3
MCPWMV/ PC6
MCPWMU/ PC5
* MCCREF / PC4
AIN5 / MCCFI 0/ PC1
AIN6 / MCCFI 1/ OAZ
5/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
Figure 3. 64-Pin TQFP 14x14 Package Pinout
ICCSEL
PP /
PE5 /
PE4 / EXTCLK_B
PE3 / ICAP1_B
AIN3 / MOSI / PB5
PE2 / ICAP2_B
/(HS) PB7
SCK / (HS) PB6
AIN4 / SS
MCO2 (HS)
MCO1 (HS)
MCO0 (HS)
V
(HS) MCO3
(HS) MCO4
(HS) MCO5
MCES
OSC1
OSC2
V
SS
V
DD
PWM3 / PA0
PWM2 / (HS) PA1
PWM1 / PA2
AIN0 / PWM0 / PA3
ARTCLK / (HS) PA4
AIN1 / ARTIC1 / PA5
ARTIC2 / PA6
AIN2 / PA7
(HS) 20mA high sink capability
eix associated external interrupt vector
* Once the MTC peripheral is ON, the pin PC4 is configured to an alte rnate function. PC4 is no lo nger usable as a digital I/O
64 63 62 61 60 59 58 57 56 55 54 53 52 51 50 49
1
2
3
4
5
6
_1
7
_1
8
9
10
11
12
ei1
13
14
ei1
15
16
17 18 19 20 21 22 23 2429 30 31 3225 26 27 28
MCIA / PB1
MCIB / PB2
MISO / PB4
MCIC / PB3
MCVREF / PB0
ei2
_2
_2
DD
SS
PE1 / OCMP1_B
PE0 (HS) / OCMP2_B
(HS) PC0
AIN5 / MCCFI0 / PC1
PD7 (HS) / TDO
V
V
PD6 (HS)/ RDI
PD5 / AIN15 / ICCDATA
PD4 /EXTCLK_A / AIN14 / ICCCLK
PD3 / ICAP1_A / AIN13
48
PD2 / ICAP2_A / AIN12
47
PD1 (HS) / OCMP1_A
46
ei0
OAP / PC2
OAN / PC3
MCPWMU / PC5
* MCCREF / PC4
AIN6 / MCCFI1 / OAZ
PD0 / OCMP2_A / AIN11
45
PF5 (HS)
44
PF4 (HS)
43
PF3 (HS) / BEEP
42
PF2 / MCO / AIN10
41
PF1 / MCZEM / AIN9
40
PF0 / MCDEM / AIN8
39
RESET
38
V
37
DD_0
V
SS_0
36
V
35
SSA
V
AREF
34
PC7 / MCPWMW / AIN7
33
MCPWMV/ PC6
6/294
1
Figure 4. 32-Pin SDIP Package Pinouts
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
ST7MC1/ST7MC2
ICCSEL / V
MCO0
MCO1
MCO2
MCO3
MCO4
MCO5
MCES
OSC1
OSC2
AIN0 / PWM0 / PA3
AIN1 / ARTIC1 / PA5
MCVREF / PB0
MCIA / PB1
MCIB / PB2
MCIC / PB3
PP
1
2
3
4
5
6
7
8
9
10
11
ei1
12
13
14
15
16
ei0
ei2
32
PD7 (HS) / TDO
31
PD6 (HS) / RDI
30
PD5 / AIN15 / ICCDATA
29
PD4 / EX TCLK_A / AIN14 / ICCCLK
28
PD3 / ICAP1_A / AIN13
27
PD2 / ICAP2_A / MC ZEM / AIN12
26
PD1 (HS) / OCMP1_A / MCPWMV / MCDEM
25
PD0 / OCMP2_A / MCPWMW / AIN11
24
RESET
23
V
DD_0
22
V
SS_0
21
V
AREF
20
PC4 / MCCREF *
19
OAZ / MCCFI1 / AIN6
18
PC3 / OAN
17
PC2 / OAP
(HS) 20mA high sink capability
eix associated external interrupt vector
* Once the MTC peripheral i s ON , the pin PC4 is configured t o an alternate function. PC4 is no l onger usable as a digital I/ O
(HS) 20mA high sink capability
eix associated external interrupt vector
* Once the MTC peripheral is ON, the pin PC4 is configured to an alte rnate function. PC4 is no lo nger usable as a digital I/O
8/294
1
Figure 6. 44-Pin TQFP Package Pinouts
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
MCO2 (HS)
MCO1 (HS)
(HS) MCO3
(HS) MCO4
(HS) MCO5
MCES
OSC1
OSC2
V
SS
V
DD
AIN0 / PWM0 / PA3
AIN1 / ARTIC1 / PA5
MCVREF / PB0
44 43 42 41 40 39 38 37 36 35 34
1
2
3
4
5
6
_1
7
_1
8
9
ei1
10
11
12 13 14 15 16 17 18 19 20 21 22
ST7MC1/ST7MC2
ICCSEL
/
PP
PE3 / ICAP1_B
PE2 / ICAP2_B
V
MCO0 (HS)
PE1 / OCMP1_B
ei2
PE0 (HS) / OC M P 2_B
PD7 (HS) / TDO
PD6 (HS)/ RDI
PD5 / AIN15 / ICCDATA
PD4 /EXTCLK_A / AIN14 / ICCCLK
33
ei0
PD3 / ICAP1_A / AIN13
32
PD2 / ICAP2_A / MCZEM / AIN12
31
PD1 (HS) / OCMP1_A / MCPWMV/MCDEM
30
PD0 / OCMP 2_A / A I N11
29
RESET
28
V
27
DD_0
V
26
SS_0
V
25
SSA
V
24
AREF
PC7 / MCPWMW / AIN7
23
/(HS) PB7
OAP / PC2
MCIA / PB1
MCIB / PB2
MISO / PB4
MCIC / PB3
SCK / (HS) PB6
(HS) 20mA high sink capability
eix associatedexternal interrupt vector
* Once the MTC peripheral i s ON , the pin PC4 is con figured to an alternate fun ct i on. PC4 is no longer usable as a digital I/ O
AIN3 / MOSI / PB5
OAN / PC3
* MCCREF / PC4
AIN4 / SS
AIN6 / MCC FI1 / OAZ
9/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
Figure 7. 32-Pin TQFP 7x7 Package Pinout
MCO2 (HS)
MCO1 (HS)
(HS) MCO3
(HS) MCO4
(HS) MCO5
MCES
OSC1
OSC2
AIN0 / PWM0 / PA3
AIN1 / ARTIC1 / PA5
32 31 30 29 28 27 26 25
1
2
3
4
5
6
7
ei1
8
9 10111213141516
/ICCSEL
PP
MCO0 (HS)
PD7 (HS) / TDO
V
ei2
ei0
PD4 /EXTCLK_A / AIN14 / ICCCLK
PD6 (HS)/ RDI
PD5 / AIN15 / ICCDATA
24
PD3 / ICAP1_A / AIN13
23
PD2 / ICAP2_A / MCZEM / AIN12
22
PD1 (HS) / OCMP1_A / MCPWMV / MCDEM
21
PD0 / OCMP2_A / MCPWMW /AIN11
20
RESET
19
V
DD_0
18
V
SS_0
17
V
AREF
OAP / PC2
MCIA / PB1
MCIB / PB2
MCVREF / PB0
(HS) 20mA high sink capability
eix associated external interrupt vector
* Once the MTC peripheral i s O N, the pin PC4 is co nf i gured to an alternate function. PC4 i s no longer usable as a digit al I/ O
OAN / PC3
MCIC / PB3
* MCCREF / PC4
AIN6 / MCCFI1 / OAZ
10/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
PIN DESCRIPTION (Cont’d)
For external pin connection guidelines, See “ELECTRICAL CHARACTERISTICS” on page 243.
Legend / Abbreviations for Tab le 1:
Type: I = input, O = output, S = supply
Input level:A = Dedicated analog input
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, wpd = weak pull-down, int = i nterrupt
– Output: OD = open drain, PP = push-pull
Refer to “I/O PORTS” on page 50 for more details on the software configuration of the I/O ports.
The RESET con figu ratio n of each pin is shown i n bo ld wh ich is val id as long a s th e devi ce i s in r eset stat e.
Table 1. ST7MC Device Pin Description
= CMOS 0.3VDD/0.7VDD with Schmitt trigger
T
= Refer to the G&H ports Characteristics in section 11.8.1 on page 260
T
T
1)
, ana = analog
Pin n°
LevelPort
Main
Outp
ut
OD
function
(after
reset)
PP
Alternate function
TQFP80
TQFP64
SDIP56
TQFP44
SDIP32
TQFP32
Pin Name
Input
Type
Input
Output
int
wpu
float
ana
118151MCO3 (HS) OHSXMotor Control Output 3
229262MCO4 (HS) OHSXMotor Control Output 4
3310373MCO5 (HS)OHSX Motor Control Output 5
4411484MCES
5-----PG0 I/OT
6-----PG1 I/OT
7-----PG2 I/OT
8-----PG3 I/OT
I/O CTHS X XX X Port E0 Timer B Ou t p ut C om p a r e 2
I/O C
T
T
T
I/O C
T
T
I
wpu
float
X XX X X Port E1 Timer B Output Compare 1
X XX X Port E2Timer B Input Capture 2
X XX X X Port E3Timer B Input Capture 1
X XXXPort E4
X XX X X Port E5
Outp
int
ana
Main
function
ut
(after
reset)
PP
OD
Must be tied low. In the programming
mode when available, this pin acts as
the programming voltage input V
ICC mode pin. See section 11.9.2 on
page 264
Alternate function
Timer B External Clock
source
2)
PP
./
Notes:
1. In the interrupt input column, “eiX ” defines the associated ex ternal in terrupt vecto r. If the weak pull-up
column (wpu) is merged with the interrupt column (int), then the I/O configuration is pull-up interrupt input,
else the configuration is floating interrupt input.
2. If two alternate func tion output s are enabled at the sa me time on a given pin (for instance, MCP WMV
and MCDEM on PD1 on TQFP32), the two signals will be ORed on the output pin.
4. OSC1 and OSC2 pins connect a crystal/ceramic resonator or an external source to the on-chip oscillator; se e Section 1 INTRODUCTION and Section 11.5 CLOCK AND TIMING CHARACTERISTICS for
more details.
5. MCCFI can be mapped on 2 different pins on 80 ,64 and 56-pin packages. This allows:
- either to use PC1 as a standard I/O and m ap M CCF I o n A OZ w ith or without us ing the operational amplifier (selected case after reset),
- or to map MCCFI on PC1 and use the amplifier for another function.
The mapping can be selected in MREF register of motor control cell. See section MOTOR CONTROL for
more details.
6. MCZEM is mapped on PF1 on 80, 64 and 56-pin packages and on PD2 on 44 and 32-pins.
MCDEM is mapped on PF0 on 80, 64 and 56-pin packages and on PD1 on 44 and 32-pin packages.
7. MCPWMV is mappe d on PC 6 on 8 0 and 64 -pin pac kages an d on P D1 on 44 ,and 32-p ins packag es.
MCPWMW is mapped on PC7 on 80, 64 and 44-pin packages and on PD0 on 32-pins package .
8. 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 configuration of these pads must be kept at reset state to avoid added c urrent consumption.
9. Once the MTC peripheral is ON (bits CKE=1 or DAC=1 in the regist er MCRA), the pin PC4 i s configured
to an alternate function. PC4 is no longer usable as a digital I/O.
14/294
1
3 REGISTER & MEMORY MAP
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
ST7MC1/ST7MC2
As sho wn in Figure 8, 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 2Kbytes of RAM
and up to 60Kbytes of user program memory. The
RAM space includes up to 256 byt es fo r the stac k
from 0100h to 01FFh.
Figure 8. Me m ory M a p
0000h
007Fh
0080h
067Fh
0680h
0FFFh
1000h
FFDFh
FFE0h
FFFFh
HW Registers
(see Table 2)
RAM
(1536/1024
768/384 Bytes)
Reserved
Program Memory
(60K, 48K, 32K, 24K, 8K)
Interrupt & Reset Vectors
(see Table 8)
0080h
00FFh
0100h
01FFh
0200h
01FFh
or 037Fh
or 047Fh
or 067Fh
The highest address by tes contain the user re set
and interrupt vectors.
IMPORTANT: Memory locations marked as “Re-
served” must never be ac ces sed. A ccessi 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
4000h
8000h
A000h
E000h
FFFFh
60 KBytes
48 KBytes
32 KBytes
24 KBytes
8 KBytes
As sho wn in Figure 9, 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 1536 bytes of
RAM and up to 60 Kbytes of user program memo-
ry. The RAM space includes up to 256 bytes for
the stack from 0100h to 01FFh.
The highest address by tes contain the user re set
and interrupt vectors.
15/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
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
000Fh
0010h
Port F
0011h
0012h
0013h
Port G
0014h
Register
Label
PADR
PADDR
PAOR
PBDR
PBDDR
PBOR
PCDR
PCDDR
PCOR
PDDR
PDDDR
PDOR
PEDR
PEDDR
PEOR
PFDR
PFDDR
PFOR
PGDR
PGDDR
PGOR
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
Port F Data Register
Port F Data Direction Register
Port F Option Register
Port G Data Register
Port G Data Direction Register
Port G Option Register
Main Clock Control / Status Register
Main Clock Controller: Beep Control Register
Control/Status Register
Data Register MSB
Data Register LSB
Timer A Control Register 2
Timer A Control Register 1
Timer A Control/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
Register Name
Reset
Status
00h
00h
00h
00h
00h
00h
00h
xxh
xxh
xxh
80h
00h
FFh
FCh
FFh
FCh
xxh
xxh
80h
00h
Remarks
R/W
R/W
R/W
Read Only
Read Only
R/W
R/W
R/W
Read Only
Read Only
R/W
R/W
Read Only
Read Only
Read Only
Read Only
Read Only
Read Only
R/W
R/W
0040hSIMSICSRSystem Integrity Control/Status Register000x000x b R/W
Timer B Control Register 2
Timer B Control Register 1
Timer B Control/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
00h
00h
xxh
xxh
xxh
80h
00h
FFh
FCh
FFh
FCh
xxh
xxh
80h
00h
R/W
R/W
R/W
Read Only
Read Only
R/W
R/W
Read Only
Read Only
Read Only
Read Only
Read Only
Read Only
R/W
R/W
Timer Counter High Register
Timer Counter Low Register
Capture Z
Capture Z
Compare C
Register
n-1
Register
n
Register
n+1
Demagnetization Register
A
Weight Register
n
Prescaler & Sampling Register
Interrupt Mask Register
Interrupt Status Register
Control Register A
Control Register B
Control Register C
Phase State Register
D event Filter Register
Current feedback Filter Register
Reference Register
PWM Control Register
Repetition Counter Register
Compare Phase W Preload Register High
Compare Phase W Preload Register Low
Compare Phase V Preload Register High
Compare Phase V Preload Register Low
Compare Phase U Preload Register High
Compare Phase U Preload Register Low
Compare Phase 0 Preload Register High
Compare Phase 0 Preload Register Low
AR Timer Input Capture Control/Status Reg.
AR Timer Input Capture Register 1
AR Timer Input Capture Register 2
Reset
Status
00h
00h
00h
00h
00h
00h
00h
00h
00h
00h
00h
Remarks
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
R/W
Read Only
Read Only
Legend: x=unde fined, R/W=read/write
Notes:
1. The contents of the I/O p ort D R regist ers are read able only i n out put c onf iguration. 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.
19/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
4 FLASH PROG RAM MEMORY
4.1 Introduc tion
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 tructure
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 9). 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.
ICC needs a minimum of 4 and up to 6 pins to be
connected to the programming tool (see Figure
10). These pins are:
– RESET
– V
: device reset
: device power supply ground
SS
Figure 10. Ty pi c al IC C 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 ap plication, no signal isolation 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 in 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 the appl ication 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 (option-
DD
al, see Figure 10, Note 3)
ICC CONNECTOR
975 3
10kΩ
SS
V
ICCSEL/VPP
ICC Cabl e
1
246810
RESET
ICCCLK
HE10 CONNECTOR TYPE
ICCDATA
APPLICATION BOARD
ICC C ONNECTOR
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 t he selected clock option is
not programmed in the opt ion byte. ST7 devices
with multi-oscillator capability need to have OSC2
grounded in this case.
21/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
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 downloade d 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 specific microcontroller device, the user needs only to
implement the ICP hardware interface on the application board (see Figure 10). For more details
on the pin locations, refer to the device pinout description.
4.6 IAP (In-Application Pr ogramming)
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.
22/294
1
5 SUPPLY, RESET AND CLOCK M ANAGEMENT
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
ST7MC1/ST7MC2
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
Figure 11. Clock, Reset and Supply Block Diagram
CLOCK SECURITY SYSTEM
OSC2
OSCILLATOR
OSC1
f
1/2
OSC
■
Reset Sequence Manager (RSM)
■
1 Crystal/ C e ra m ic res o nator osc illator
■
System Integrity Management (SI)
– Main supply Low voltage detection (LVD)
– Auxiliary Voltage detector (AVD) with interrupt
capability for mon ito ring the m ain supply
– Clock Security System (CSS) w ith the VCO of
the PLL, providing a backup safe oscillator
– Clock Detector
– PLL which can be used to multiply the fre-
quency by 2 if the clock frequency input is
8MHz
8Mhz
SYSTEM
PLL
Safeosc
INTEGRITY MANAGEMENT
f
OSC
f
MAIN CLOCK
CLK
CONTROLLER
16Mhz
lock
WITH REALTIME
CLOCK (MCC/RTC)
CKSELDIV2 OPT
f
f
CPU
MTC
RESET
V
SS
V
DD
RESETSEQUENCE
MANAGER
(RSM)
Clock Dete ctor
SICSR, page 0
PA
AVD AVD
GE
SICSR, page 1
PA
0
GE
AVD Interrupt Request
LVD
IE
F
AUXILIARY VOLTAGE
0
RF
LOW VOLTAG E
DETECTOR
(LVD)
DETECTOR
(AVD)
VCO
LOCKPLL
EN
CSS
CSSDWDG
IE
CSS Interrupt Request
EN
RF
0
CK
0
SEL
WATCHDOG
TIMER (WDG)
23/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
5.1 OSCILLATOR
The main clock of the ST7 can be generated by a
crystal or ce ramic reso nato r oscilla tor o r an exter nal source.
The associated hardware configurations are
shown in Table 4. Refer to the electrical characteristics section for more details.
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 wh ile the O SC2 pin is not c onnected.
Crystal/Ceramic Oscillators
This family of oscillators has the advantage of producing a very accurate rate on the main clock of
the ST7. In this mode, the reson ator and the load
capacitors have to be placed as clo se as poss ibl e
to the oscillator pins in order to minimize output
distortion and start-up stabilization time.
This oscillator is not stopped during the RESET
phase to avoid losing time in its start-up phase.
See Electrical Characteristics for more details.
Table 4. ST7 Clock Sources
Hardware Configuration
ST7
OSC1OSC2
External ClockCrystal/Ceramic Resonators
EXTERNAL
SOURCE
OSC1OSC2
C
L1
CAPACITORS
ST7
LOAD
NC
C
L2
24/294
1
5.2 RESET SEQUENCE MANAGER (RSM)
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
ST7MC1/ST7MC2
5.2.1 Introd uct i 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 t e)
■
RESET vector fe tch
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 RESET
256 or 4096 CLOCK CYCLES
5.2.2 Async hronous External R ESET
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 fixed v alue but varies in accordance with the input voltage. It
can be pulled
low by external circuitry to reset the dev ice. 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
25/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
RESET SEQUENCE MANAGER (Cont’d)
The RESET
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.
5.2.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
can generally be provide d by an ext ernal RC net work connected to the RESET
Figure 14. RESET Sequences
pin is an asynchronous signal which
is over the m inimum
DD
frequency.
OSC
supply
DD
pin.
V
DD
5.2.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
pin acts as an output that is
DD<VIT+
(rising edge) or
larger than t
DD
g(VDD)
to
avoid parasitic resets.
5.2.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 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
)
26/294
1
5.3 SYSTEM INTEGRITY MANAGEMENT (SI)
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
ST7MC1/ST7MC2
The System Integrity Managem ent block contains
the Low Voltage Detector (LVD), Auxiliary Voltage
Detector (AVD) and Clock Security System (CSS)
functions. It is managed by the SICSR register.
5.3.1 Low Voltage Detector (LVD)
The Low Voltage Detector funct ion (LVD) generates a static reset when the V
below a V
reference value. This m eans that it
IT-
supply voltage is
DD
secures the power-up as well as the power-dow n
keeping the ST7 in reset.
The V
than the V
to avoid a parasitic reset when the MCU starts run-
reference value for a voltage drop is lower
IT-
reference value for power-on in order
IT+
ning and sinks current on the supply (hysteresis).
The LVD Reset circuitry generates a res et when
is below:
V
DD
– V
when VDD is rising
IT+
when VDD is falling
– V
IT-
Figure 15. Low Voltage Detector vs Reset
V
DD
The LVD function is illustrated in Figure 15.
Provided the minimum V
the oscillator frequency) is above V
value (guaranteed for
DD
, the MCU
IT-
can only be in two modes:
– 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.
V
V
RESET
IT+
IT-
V
hys
27/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
SYSTEM INTEGRITY MANAGEMENT (Cont’d)
5.3.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
lower than the V
reference value and the VDD main sup-
reference value for f alling voltage is
IT-
reference value for rising volt-
IT+
IT-(AVD)
age 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 CSR regi ster. Th is
bit is read only.
Caution: The AVD function is active only if the
LVD is enabled through the option byte (see sec-
tion 13.1 on page 284).
5.3.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).
and
IT+(AVD)
or
In the case of a drop i n v oltage, t he AV D interrupt
acts as an early warning, allowing software to shut
down safely before the LVD re sets the microcontroller. See Fi gure 16.
The interrupt on the rising edge is used to inform
the application that the V
If the voltage rise time t
warning state is over.
DD
is less than 256 or 4096
rv
CPU cycles (depending on the reset delay selected by option byte), no AVD interrupt will be generated when V
is greater than 256 or 4096 cycles then:
If t
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
IT+(AVD)
threshold is reached then only one AVD interrupt
will occur.
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 bit001
AVD INTERRUPT
REQUEST
IF AVDIE bit = 1
LVD RESET
hyst
INTERRUPT PROCESS
t
VOLTAGE RISE TIME
rv
INTERRUPT PROCESS
28/294
1
SYSTEM INTEGRITY MANAGEMENT (Cont’d)
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
5.3.3 Clock Security System (CSS)
The Clock Security System (CSS) protects the
ST7 against main clock problems. To allow the integration of the security features in the applications, it is based on a PLL which can provide a
backup clock. The PLL can be enabled or disabled
by option byte or by software. It requires an 8-MHz
input clock and provides a 16-MHz output clock.
5.3.3.1 Safe Oscillator Control
The safe oscillator of the CSS block is made of a
PLL.
If the clock signal disappears (due to a broken or
disconnected resonator...) the PLL continues to
provide a lower frequency, which allows the ST7 to
perform some rescue operations.
Automatically, the ST7 clock source switches back
from the safe os cilla tor if the orig ina l cloc k so urce
recovers.
5.3.3.2 Limitation detection
The automatic safe oscillator selection is notified
by hardware setting the CSSD bit of the SICSR
register. An interrupt can be gen erated if the CSSIE bit has been previously set.
These two bits are described in the SICSR register
description.
ST7MC1/ST7MC2
5.3.4 Low Power Modes
Mode Description
WAIT
HALT
5.3.4.1 Interrupts
The CSS or AVD i nterrupt events generat e an interrupt if the corresponding Enable Control Bit
(CSSIE or AVDIE) is set and the interrupt mask in
the CC register is reset (RIM instruction).
Interrupt Event
CSS event detection
(safe oscillator activated as main clock)
AVD event AVDF AVDIEYesYes
No effect on SI. CSS and AVD interrupts
cause the device to exit from Wait mode.
The CRSR register is frozen.
The CSS (including the safe oscillator) is
disabled until HALT mode is exited. The
previous CSS configuration resumes when
the MCU is woken up by an interrupt with
“exit from HALT mode” capability or from
the counter reset value when the MCU is
woken up by a RESET. The AVD remains
active, and an AVD interrupt can be used to
exit from Halt mode.
Flag
Enable
Control
Bit
Event
CSSD CSSIEYesNo
Exit
from
Wait
Exit
from
Halt
1)
Note 1: This int errupt allows to exit from activehalt mode.
29/294
1
ST7MC1/ST7MC2
http://www.xinpian.net
提供单片机解密、IC解密、芯片解密业务
010-62245566 13810019655
SYSTEM INTEGRITY MANAGEMENT (Cont’d)
5.3.5 Register Description
SYSTEM INTEGRITY (SI) CONTROL/ STAT U S RE GI STER (SICSR, page 0)
Read/Write
Reset Value: 000x 000x (00h)
70
AVD
PAG
E
IE
AVDFLVD
RF
CSSIECSSDWDG
0
RF
Bit 7 = PAGE SICSR Register Page Selection
This bit selects the SICSR regi ster page. It is set
and cleared by software
0: Access to SICSR register mapped in page 0.
1: Access to SICSR register mapped in page 1.
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
1: AVD interrupt enabled
Bit 5 = AVDF Voltage Detector flag
This read-only bit is set and cleared by hardware.
If the VDIE bit is set, an interrupt request is generated when the AVDF bit changes value.
0: V
1: V
DD
DD
over V
under V
IT+ (AVD)
IT-(AVD)
threshold
threshold
Bit 4 = L VDRF LVD reset flag
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.
Bit 3 = Reserved, must be kept cleared.
is detected by the Clock Security System (CSSD
bit set). It is set and cleared by software.
0: Clock security system interrupt disabled
1: Clock security system interrupt enabled
When the PLL is disabled (PLLE N=0), the CSS IE
bit has no effect.
Bit 1 = CSSD Clock security system detection
This bit indicates a disturbance on t he main clock
signal (f
): the clock stops (at least for a few c y-
OSC
cles). It is set by hardware and cleared by reading
the SICSR register when the original oscillator recovers.
0: Safe oscillator is not active
1: Safe oscillator has been activated
When the PLL is d isabled (PLLEN=0), t he CSSD
bit value is forced to 0.
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
(writing zero) or an LVD Reset (to ensure a stable
cleared state of the WDGRF flag when CPU
starts).
Combined with the LVDRF flag information, the
flag description is given by the following table.
RESET SourcesLVDRFWDGRF
External RESET pin00
Watchdog01
LVD1X
Application notes
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.
Bit 2 = CSSIE Clock security syst
This bit enables the interrupt when a disturbance
30/294
1
.
interrupt enable
Loading...
+ 264 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.