The ST7262 and ST72F62 devices are members
of the ST7 microcontroller family designed for USB
applications.
All devices are based on a common industrystandard 8-bit core, featuring an enhanced instruction set.
The ST7262 devices are ROM versions.
The ST72F62 versions feature dual-voltage
FLASH memory with FLASH Programming capability.
Under software control, all devices can be placed
in WAIT, SLOW, or HALT mode, reducing power
Figure 1. General Block Diagram
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.
4/139
1
Doc ID 6996 Rev 5
2 PIN DESCRIPTION
44 43 42 41 40 39 38 37 36 35 34
33
32
31
30
29
28
27
26
25
24
23
12 13 14 15 16 17 18
19 20 21 22
1
2
3
4
5
6
7
8
9
10
11
38
37
36
35
34
33
32
31
30
29
28
27
16
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
39
40
41
42
PD6
PD5
OSCOUT
OSCIN
IT9 / PC2
IT10 / SCK / PC3
IT11 / SS
/ PC4
IT12 / MISO / PC5
MOSI / PC6
PD1
V
PP
PD2
PD3
PD4
PC7
PD0
V
DDA
USBVCC
PB1 (HS) / RDI
PB0 (HS) / MCO
PA7 / AIN7
PA6 / AIN6
PA5 / AIN5
PA4 / AIN4
PA3 / AIN3 / IT4
PA0 / AIN0 / IT1 / USBOE
RESET
V
SSA
USBDM
USBDP
PA1 / AIN1 / IT2
PA2 / AIN2 / IT3
21
20
17
18
19
IT8 / PWM1 / PB7 (HS)
PC0
PC1
V
DD
V
SS
26
25
24
23
22
PB6 (HS) / PWM0 / IT7 / ICCDATA
PB5 (HS) / ARTIC2 / IT6 / ICCCLK
PB4 (HS) / ARTIC1 / IT5
PB3 (HS) / ARTCLK
PB2 (HS) / TDO
OSCOUT
OSCIN
IT9 / PC2
IT10 / SCK / PC3
IT11 / SS
/ PC4
IT12 / MISO / PC5
MOSI / PC6
PD1
V
PP
PC7
PD0
IT8 / PWM1 / PB7
PC0
PC1
V
DD
V
SS
ARTCLK / PB3 (HS)
IT5 / ARTIC1 / PB4 (HS)
ICCCLK / IT6 / ARTIC2 / PB5 (HS)
ICCDATA /IT7 / PWM0 / PB6 (HS)
N.C.
TDO / PB2 (HS)
PB1 (HS) / RDI
PB0 (HS) / MCO
PA7 / AIN7
PA6 / AIN6
PA5 / AIN5
PA4 / AIN4
PA3 / AIN3 / IT4
PA0 / AIN0 / IT1 / USBOE
RESET
PA1 / AIN1 / IT2
PA2 / AIN2 / IT3
V
DDA
USBVCC
V
SSA
USBDM
USBDP
PD3
PD4
Reserved*
PD6
PD5
PD2
* Pin 39 of the LQFP44 package
must be left unconnected.
Figure 2. 44-pin LQFP and 42-Pin SDIP Package Pinouts
ST7262xxx
Doc ID 6996 Rev 5
5/139
ST7262xxx
28
27
26
25
24
23
22
21
20
19
18
29
30
31
32
PC4 / SS / INT11
PC5 / MISO / IT12
PA4 / AIN4
PA3 / AIN3 / IT4
PA2 / AIN2 / IT3
PA1 / AIN1 / IT2
PA0 / AIN0 / IT1 / USBOE
V
SSA
USBDM
USBVCC
V
DDA
V
PP
RESET
PC6 / MOSI
USBDP
PC7
16
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
IT10 / SCK / PC3
IT9 / PC2
AIN7 / PA7
MCO / PB0 (HS)
RDI / PB1 (HS)
TDO / PB2 (HS)
ARTCLK / PB3 (HS)
IT5 / ARTIC1 / PB4 (HS)
ICCCLK / IT6 /ARTIC2 / PB5 (HS)
IT8 / PWM1 / PB7 (HS)
V
DD
V
SS
OSCOUT
OSCIN
ICCDATA / IT7 / PWM0 / PB6 (HS)
PA5 / AIN5
AIN6 / PA6
33
34
17
28
27
26
25
24
23
22
21
20
19
18
17
16
15
1
2
3
4
5
6
7
8
9
10
11
12
13
14
29
30
31
32
IT10 / SCK / PC3
IT9 / PC2
AIN7 / PA7
MCO / PB0 (HS)
RDI / PB1 (HS)
TDO / PB2 (HS)
ARTCLK / PB3 (HS)
IT5 / ARTIC1 / PB4 (HS)
ICCCLK / IT6 / ARTIC2 / PB5 (HS)
IT8 / PWM1 / PB7 (HS)
V
DD
V
SS
OSCOUT
OSCIN
ICCDATA / IT7 / PWM0 / PB6 (HS)
AIN6 / PA6
PC4 / SS
/ INT11
PC5 / MISO / IT12
PA4 / AIN4
PA3 / AIN3 / IT4
PA2 / AIN2 / IT3
PA1 / AIN1 / IT2
PA0 / AIN0 / IT1 / USBOE
V
SSA
USBDM
USBVCC
V
DDA
V
PP
RESET
PC6 / MOSI
USBDP
PA5 / AIN5
PC1
PIN DESCRIPTION (Cont’d)
Figure 3. 34-Pin SO and 32-Pin SDIP Package Pinouts
Note 1: Peripheral not present on all devices. Refer to “Device Summary” on page 1.
2.1 PCB LAYOUT RECOMMENDATION
In the case of DIP20 devices the user should layout the PCB so that the DIP20 ST7262 device and
the USB connector are centered on the same axis
ensuring that the D- and D+ lines are of equal
length. Refer to Figure 6
Figure 6. Recommended PCB Layout for USB Interface with DIP20 package
Alternate Function
10/139
Doc ID 6996 Rev 5
3 REGISTER & MEMORY MAP
0000h
Program Memory
Interrupt & Reset Vectors
HW Registers
BFFFh
0040h
003Fh
(see Table 2)
C000h
FFDFh
FFE0h
FFFFh
(see Table 6)
0340h
Reserved
033Fh
Short Addressing
RAM (zero page)
or Stack
017Fh
0040h
00FFh
768 Bytes RAM
E000h
8 KBytes
(128 Bytes)
16 KBytes
384 Bytes RAM
64 Bytes
01BFh
16-bit Addressing
RAM
Short Addressing
RAM (zero page)
017Fh
0040h
00FFh
448 Bytes
033Fh
16-bit Addressing
RAM
16-bit Addressing
RAM
or Stack
(128 Bytes)
16-bit Addressing
RAM
192 Bytes
192 Bytes
ST7262xxx
As shown in the Figure 7, the MCU is capable of
addressing 64K bytes of memories and I/O registers.
The available memory locations consist of 64
bytes of register locations, 768 bytes of RAM and
up to 16 Kbytes of user program memory. The
RAM space includes up to 128 bytes for the stack
from 0100h to 017Fh.
The highest address bytes contain the user reset
and interrupt vectors.
Figure 7. Memory Map
IMPORTANT: Memory locations marked as “Re-
served” must never be accessed. Accessing a reserved area can have unpredictable effects on the
device.
Doc ID 6996 Rev 5
11/139
ST7262xxx
Table 2. Hardware Register Map
AddressBlock
0000h
0001h
0002h
0003h
0004h
0005h
0006h
0007h
Port A
Port B
Port C
Port D
Register
Label
PADR
PADDR
PBDR
PBDDR
PCDR
PCDDR
PDDR
PDDDR
Register Name
Port A Data Register
Port A Data Direction Register
Port B Data Register
Port B Data Direction Register
Port C Data Register
Port C Data Direction Register
Port D Data Register
Port D Data Direction Register
Reset
Status
1)
00h
00h
1)
00h
00h
1)
00h
00h
1)
00h
00h
0008hITRFRE1Interrupt Register 100hR/W
0009hMISCMiscellaneous Register00hR/W
000Ah
000Bh
000Ch
ADC
ADCDRMSB
ADCDRLSB
ADCCSR
ADC Data Register (bit 9:2)
ADC Data Register (bit 1:0)
ADC Control Status Register
00h
00h
00h
000DhWDGWDGCRWatchdog Control Register7FhR/W
000Eh
0010h
0011h
0012h
0013h
SPI
SPIDR
SPICR
SPICSR
SPI Data I/O Register
SPI Control Register
SPI Control Status Register
USB PID Register
USB DMA Address register
USB Interrupt/DMA Register
USB Interrupt Status Register
USB Interrupt Mask Register
USB Control Register
USB Device Address Register
USB Endpoint 0 Register A
USB Endpoint 0 Register B
USB Endpoint 1 Register A
USB Endpoint 1 Register B
USB Endpoint 2 Register A
USB Endpoint 2 Register B
Reserved Area (4 Bytes)
TBU Counter Value Register
TBU Control/Status Register
1. The contents of the I/O port DR registers are readable only in output configuration. In input configuration, the values of the I/O pins are returned instead of the DR register contents.
2. The bits associated with unavailable pins must always be kept at their reset value.
Doc ID 6996 Rev 5
13/139
ST7262xxx
4 Kbytes
4 Kbytes
2Kbytes
SECTOR 1
SECTOR 0
16 Kbytes
SECTOR 2
8K16K32K60K
FLASH
FFFFh
EFFFh
DFFFh
3FFFh
7FFFh
1000h
24 Kbytes
MEMORY SIZE
8 Kbytes40 Kbytes
52 Kbytes
9FFFh
BFFFh
D7FFh
4K10K24K48K
4 FLASH PROGRAM MEMORY
4.1 INTRODUCTION
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 (plugged in a programming tool)
or on-board using ICP (In-Circuit Programming) or
IAP (In-Application Programming).
The array matrix organisation allows each sector
to be erased and reprogrammed without affecting
other sectors.
4.2 MAIN FEATURES
■ 3 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 application board and while the
application is running.
■ ICT (In-Circuit Testing) for downloading and
executing user application test patterns in RAM
■ Read-out protection
■ Register Access Security System (RASS) to
prevent accidental programming or erasing
4.3 STRUCTURE
The Flash memory is organised in sectors and can
be used for both code and data storage.
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 Flash memory when only a
partial erasing is required.
The first two sectors have a fixed size of 4 Kbytes
(see Figure 8). 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. Even if no protection can be considered as totally unbreakable, the feature provides a very high
level of protection for a general purpose microcontroller.
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.
Figure 8. Memory Map and Sector Address
14/139
Doc ID 6996 Rev 5
FLASH PROGRAM MEMORY (Cont’d)
ICC CONNECTOR
ICCDATA
ICCCLK
RESET
V
DD
HE10 CONNECTOR TYPE
APPLICATION
POWER SUPPLY
1
246810
975 3
PROGRAMMING TOOL
ICC CONNECTOR
APPLICATION BOARD
ICC Cable
(See Note 3)
10kΩ
V
SS
ICCSEL/VPP
ST7
C
L2
C
L1
OSC1
OSC2
OPTIONAL
See Note 1
See Note 2
APPLICATION
RESET SOURCE
APPLICATION
I/O
(See Note 4)
ST7262xxx
4.4 ICC INTERFACE
ICC (In-Circuit Communication) needs a minimum
of four and up to six pins to be connected to the
programming tool (see Figure 9). These pins are:
– RESET
–V
: device reset
: device power supply ground
SS
Figure 9. Typical ICC Interface
– 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)
: application board power supply (see Fig-
–V
DD
ure 9, Note 3)
Notes:
1. If the ICCCLK or ICCDATA pins are only used
as outputs in the application, 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 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-
Doc ID 6996 Rev 5
agement IC with open drain output and pull-up
resistor > 1K, no additional components 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 connector depends
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 connected to the OSC1 or OSCIN pin of the ST7 when the clock is not available
in the application or if the selected clock option is
not programmed in the option byte. ST7 devices
with multioscillator capability need to have OSC2
grounded in this case.
15/139
ST7262xxx
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 downloaded in RAM,
Flash memory programming can be fully customized (number of bytes to program, program locations, or selection serial communication interface
for downloading).
When using an STMicroelectronics or third-party
programming tool that supports ICP and the specific microcontroller device, the user needs only to
implement the ICP hardware interface on the application board (see Figure 9). For more details on
the pin locations, refer to the device pinout description.
4.6 IAP (IN-APPLICATION PROGRAMMING)
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 or
other type of serial 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 programming and ICC protocol, refer to the ST7 Flash Programming Refer-
ence Manual and to the ST7 ICC Protocol Reference Manual
.
4.8 REGISTER DESCRIPTION
FLASH CONTROL/STATUS REGISTER (FCSR)
Read/Write
Reset Value: 0000 0000 (00h)
70
00000000
This register is reserved for use by Programming
Tool software. It controls the Flash programming
and erasing operations.
16/139
Doc ID 6996 Rev 5
5 CENTRAL PROCESSING UNIT
ACCUMULATOR
X INDEX REGISTER
Y INDEX REGISTER
STACK POINTER
CONDITION CODE REGISTER
PROGRAM COUNTER
70
1C1I1HI0NZ
RESET VALUE = RESET VECTOR @ FFFEh-FFFFh
70
70
70
0
7
158
PCH
PCL
15
8
70
RESET VALUE = STACK HIGHER ADDRESS
RESET VALUE =
1X11X1XX
RESET VALUE = XXh
RESET VALUE = XXh
RESET VALUE = XXh
X = Undefined Value
ST7262xxx
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 10. CPU Registers
5.3 CPU REGISTERS
The 6 CPU registers shown in Figure 10 are not
present in the memory mapping and are accessed
by specific instructions.
Accumulator (A)
The Accumulator is an 8-bit general purpose register used to hold operands 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 temporary storage areas for data
manipulation. (The Cross-Assembler 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 Counter (PC)
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).
Doc ID 6996 Rev 5
17/139
ST7262xxx
CENTRAL PROCESSING UNIT (Cont’d)
Condition Code Register (CC)
Read/Write
Reset Value: 111x1xxx
70
11I1HI0NZ
C
The 8-bit Condition Code register contains the interrupt masks and 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 be-
tween bits 3 and 4 of the ALU during an ADD or
ADC instructions. It is reset by hardware during
the same instructions.
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 accessed by the JRMI and JRPL instructions.
Bit 1 = Z Zero.
This bit is set and cleared by hardware. This bit indicates 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 by 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 Management Bits
Bit 5,3 = I1, I0 Interrupt
The combination of the I1 and I0 bits gives the cur-
These two bits are set/cleared by 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.
Note: When the lower limit is exceeded, the Stack
Pointer wraps around to the stack upper limit, without indicating the stack overflow. The previously
stored information is then overwritten and therefore lost. The stack also wraps in case of an underflow.
The stack is used to save the return address during a subroutine call and the CPU context during
70
1SP6SP5SP4SP3SP2SP1SP0
an interrupt. The user may also directly manipulate
the stack by means of the PUSH and POP instructions. In the case of an interrupt, the PCL is stored
at the first location pointed to by the SP. Then the
other registers are stored in the next locations as
shown in Figure 11.
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 11).
Since the stack is 128 bytes deep, the 9 most significant bits are forced by hardware. Following an
– 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 locations in the stack area.
MCU Reset, or after a Reset Stack Pointer instruction (RSP), the Stack Pointer contains its reset value (the SP6 to SP0 bits are set) which is the stack
higher address.
The least significant byte of the Stack Pointer
(called S) can be directly accessed by a LD instruction.
ST7262xxx
Figure 11. Stack Manipulation Example
Doc ID 6996 Rev 5
19/139
ST7262xxx
OSCIN
OSCOUT
EXTERNAL
CLOCK
NC
OSCIN
OSCOUT
C
OSCIN
C
OSCOUT
6 CLOCKS AND RESET
6.1 CLOCK SYSTEM
6.1.1 General Description
The MCU accepts either a Crystal or Ceramic resonator, or an external clock signal to drive the internal oscillator. The internal clock (f
rived from the external oscillator frequency (f
CPU
) is de-
OSC
by dividing by 3 and multiplying by 2. By setting the
OSC12/6 bit in the option byte, a 12 MHz external
clock can be used giving an internal frequency of 8
MHz while maintaining a 6 MHz clock for USB (refer to Figure 14).
The internal clock signal (f
) consists of a
CPU
square wave with a duty cycle of 50%.
It is further divided by 1, 2, 4 or 8 depending on the
Slow Mode Selection bits in the Miscellaneous
register (SMS[1:0])
The internal oscillator is designed to operate with
an AT-cut parallel resonant quartz or ceramic resonator in the frequency range specified for f
osc
The circuit shown in Figure 13 is recommended
when using a crystal, and Table 4 lists the recommended capacitors. The crystal and associated
components should be mounted as close as possible to the input pins in order to minimize output
distortion and start-up stabilization time.
6.1.2 External Clock input
An external clock may be applied to the OSCIN input with the OSCOUT pin not connected, as
shown on Figure 12. The t
does not apply when using an external clock input.
),
specifications
OXOV
The equivalent specification of the external clock
source should be used instead of t
OXOV
trical Characteristics).
6.1.3 Clock Output Pin (MCO)
The internal clock (f
) can be output on Port B0
CPU
by setting the MCO bit in the Miscellaneous register.
Figure 12. External Clock Source Connections
.
(see Elec-
Table 4. Recommended Values for 12 MHz
Crystal Resonator
R
SMAX
C
OSCIN
C
OSCOUT
R
P
Note: R
crystal (see crystal specification).
SMAX
20 Ω25 Ω70 Ω
56pF47pF22pF
56pF47pF22pF
1-10 MΩ1-10 MΩ1-10 MΩ
is the equivalent serial resistor of the
Note: When a crystal is used, and to not overstress the crystal, ST recommends to add a serial
resistor on the OSCOUT pin to limit the drive level
in accordance with the crystal manufacturer’s
specification. Please also refer to Section 12.5.4.
20/139
Figure 13. Crystal/Ceramic Resonator
Doc ID 6996 Rev 5
Figure 14. Clock block diagram
to CPU and
f
CPU
8/4/2/1 MHz
6 MHz (USB)
12 or
peripherals
%2
0
1
OSC12/6
6 MHz
Crystal
x2
Slow
Mode
%
SMS[1:0]
1/2/4/8
%3
(or 4/2/1/0.5 MHz)
MCO pin
LOW VOLTAGE
V
DD
FROM
WATCHDOG
RESET
RESET
INTERNAL
RESET
RESET
6.2 RESET
ST7262xxx
The Reset procedure is used to provide an orderly
software start-up or to exit low power modes.
Three reset modes are provided: a low voltage reset, a watchdog reset and an external reset at the
RESET
pin.
A reset causes the reset vector to be fetched from
addresses FFFEh and FFFFh in order to be loaded
into the PC and with program execution starting
from this point.
An internal circuitry provides a 514 CPU clock cycle delay from the time that the oscillator becomes
active.
Caution: When the ST7 is unprogrammed or fully
erased, the Flash is blank and the RESET vector
is not programmed. For this reason, it is recommended to keep the RESET pin in low state until
programming mode is entered, in order to avoid
unwanted behaviour.
6.2.1 Low Voltage Reset
Low voltage reset circuitry generates a reset when
is:
V
DD
■ below V
■ below V
During low voltage reset, the RESET
when VDD is rising,
IT+
when VDD is falling.
IT-
pin is held low,
thus permitting the MCU to reset other devices.
Notes:
The Low Voltage Detector can be disabled by setting the LVD bit of the Option byte.
It is recommended to make sure that the V
voltage rises monotonously when the device is exiting from Reset, to ensure the application functions
properly.
6.2.2 Watchdog Reset
When a watchdog reset occurs, the RESET
pulled low permitting the MCU to reset other devices as when low voltage reset (Figure 15).
6.2.3 External Reset
The external reset is an active low input signal applied to the RESET
pin of the MCU.
As shown in Figure 18, the RESET
stay low for a minimum of one and a half CPU
clock cycles.
An internal Schmitt trigger at the RESET
vided to improve noise immunity.
Figure 15. Low Voltage Reset functional Diagram
Doc ID 6996 Rev 5
supply
DD
pin is
signal must
pin is pro-
21/139
ST7262xxx
RESET
V
DD
V
IT+
V
IT-
V
DD
Addresses
$FFFE
Temporization
V
IT+
(514 CPU clock cycles)
V
DD
OSCIN
f
CPU
FFFF
FFFE
PC
RESET
t
DDR
t
OXOV
514 CPU
CLOCK
CYCLES
DELAY
Figure 16. Low Voltage Reset Signal Output
Note: Typical hysteresis (V
IT+-VIT-
) of 250 mV is expected.
Figure 17. Temporization Timing Diagram after an internal Reset
Figure 18. Reset Timing Diagram
Note: Refer to Electrical Characteristics for values of t
22/139
Doc ID 6996 Rev 5
DDR
, t
OXOV
, V
IT+
and V
IT-.
ST7262xxx
RESET
R
ON
V
DD
WATCHDOG RESET
LVD RESET
INTERNAL
RESET
PULSE
GENERATOR
200ns
Filter
t
w(RSTL)out
+ 128 f
OSC
delay
Figure 19. Reset Block Diagram
Note: The output of the external reset circuit must have an open-drain output to drive the ST7 reset pad.
Otherwise the device can be damaged when the ST7 generates an internal reset (LVD or watchdog).
Doc ID 6996 Rev 5
23/139
ST7262xxx
“IRET”
RESTORE PC, X, A, CC
STACK PC, X, A, CC
LOAD I1:0 FROM INTERRUPT SW REG.
FETCH NEXT
RESET
TLI
PENDING
INSTRUCTION
I1:0
FROM STACK
LOAD PC FROM INTERRUPT VECTOR
Y
N
Y
N
Y
N
Interrupt has the same or a
lower software priority
THE INTERRUPT
STAYS PENDING
than current one
Interrupt has a higher
software priority
than current one
EXECUTE
INSTRUCTION
INTERRUPT
7 INTERRUPTS
7.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
– 3 non maskable events: RESET, TRAP, 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 controller guarantees full
upward compatibility with the standard (not nested) CPU interrupt controller.
7.2 MASKING AND PROCESSING 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 5). The processing flow is shown in Figure 20.
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
“Interrupt Mapping” 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 restored from the stack
and the program in the previous level will resume.
As several interrupts can be pending at the same
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 21 describes this decision process.
Figure 21. Priority Decision Process
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 previous
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, TLI, TRAP) and the maskable type (external 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 20). After stacking the PC, X, A and CC
registers (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.
■ 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 service routine.
■
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 20 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 vector sources can be serviced
if the corresponding interrupt is enabled and if its
own interrupt software priority (in ISPRx registers)
is higher than the one currently being serviced (I1
and I0 in CC register). If any of these two conditions is false, the interrupt is latched and thus remains pending.
■ External Interrupts
External interrupts allow the processor to exit from
HALT low power mode.
External interrupt sensitivity is software selectable
through the ITRFRE2 register.
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 group connected to the
same interrupt line are selected simultaneously,
these will be logically NANDed.
■ 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.
Doc ID 6996 Rev 5
25/139
ST7262xxx
MAIN
IT4
IT2
IT1
TLI
IT1
MAIN
IT0
I1
HARDWARE PRIORITY
SOFTWARE
3
3
3
3
3
3/0
3
11
11
11
11
11
11 / 10
11
RIM
IT2
IT1
IT4
TLI
IT3
IT0
IT3
I0
10
PRIORITY
LEVEL
USED STACK = 10 BYTES
MAIN
IT2
TLI
MAIN
IT0
IT2
IT1
IT4
TLI
IT3
IT0
HARDWARE PRIORITY
3
2
1
3
3
3/0
3
11
00
01
11
11
11
RIM
IT1
IT4
IT4
IT1
IT2
IT3
I1I0
11 / 10
10
SOFTWARE
PRIORITY
LEVEL
USED STACK = 20 BYTES
INTERRUPTS (Cont’d)
7.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 exit from HALT mode capability
and it is selected through the same decision process shown in Figure 21.
Note: If an interrupt, that is not able to Exit from
HALT mode, is pending with the highest priority
when exiting HALT mode, this interrupt is serviced
after the first one serviced.
Figure 22. Concurrent Interrupt Management
7.4 CONCURRENT & NESTED MANAGEMENT
The following Figure 22 and Figure 23 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 23. 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.
Figure 23. Nested Interrupt Management
26/139
Doc ID 6996 Rev 5
INTERRUPTS (Cont’d)
ST7262xxx
7.5 INTERRUPT REGISTER DESCRIPTION
INTERRUPT SOFTWARE PRIORITY REGISTERS (ISPRX)
CPU CC REGISTER INTERRUPT BITS
Read/Write
Reset Value: 111x 1010 (xAh)
70
11I1HI0NZC
Bit 5, 3 = I1, I0 Software Interrupt Priority
These two bits indicate the current interrupt soft-
These two bits are set/cleared by hardware when
entering in interrupt. The loaded value is given by
the corresponding bits in the interrupt software priority registers (ISPRx).
They can be also set/cleared by software with the
RIM, SIM, HALT, WFI, IRET and PUSH/POP instructions (see “Interrupt Dedicated Instruction
Set” table).
*Note: TLI, TRAP and RESET events can interrupt
a level 3 program.
Read/Write (bit 7:4 of ISPR3 are read only)
Reset Value: 1111 1111 (FFh)
70
ISPR0I1_3 I0_3 I1_2 I0_2 I1_1 I0_1 I1_0 I0_0
ISPR1I1_7 I0_7 I1_6 I0_6 I1_5 I0_5 I1_4 I0_4
ISPR2I1_11 I0_11 I1_10 I0_10 I1_9 I0_9 I1_8 I0_8
ISPR31111I1_13 I0_13 I1_12 I0_12
These four registers contain the interrupt software
priority of each interrupt vector.
– Each interrupt vector (except RESET and TRAP)
has corresponding bits in these registers where
its own software priority is stored. This correspondence is shown in the following table.
Vector addressISPRx bits
FFFBh-FFFAhI1_0 and I0_0 bits*
FFF9h-FFF8hI1_1 and I0_1 bits
......
FFE1h-FFE0hI1_13 and I0_13 bits
– Each I1_x and I0_x bit value in the ISPRx regis-
ters has the same meaning as the I1 and I0 bits
in the CC register.
– Level 0 can not be written (I1_x=1, I0_x=0). In
this case, the previously stored value is kept. (example: previous=CFh, write=64h, result=44h)
The RESET, TRAP and TLI vectors have no software priorities. When one is serviced, the I1 and I0
bits of the CC register are both set.
*Note: Bits in the ISPRx registers which correspond to the TLI can be read and written but they
are not significant in the interrupt process management.
Caution: If the I1_x and I0_x bits are modified
while the interrupt x is executed the following behaviour has to be considered: If the interrupt x is
still pending (new interrupt or flag not cleared) and
the new software priority is higher than the previous one, the interrupt x is re-entered. Otherwise,
the software priority stays unchanged up to the
next interrupt request (after the IRET of the interrupt x).
Bit 5:4 = CTL[1:0] IT[10:9]1nterrupt Sensitivity
These bits are set and cleared by software. They
are used to configure the edge and level sensitivity
of the IT10 and IT9 external interrupt pins (this
means that both must have the same sensitivity).
CTL1CTL0IT[10:9] Sensitivity
00Falling edge and low level
01Rising edge only
10Falling edge only
11Rising and falling edge
Bit 3:0 = ITiE Interrupt Enable
0: I/O pin free for general purpose I/O
1: ITi external interrupt enabled.
70
CTL3 CTL2 CTL1 CTL0 IT12E IT11E IT10E IT9E
Bit 7:6 = CTL[3:2] IT[12:11] Interrupt Sensitivity
These bits are set and cleared by software. They
are used to configure the edge and level sensitivity
of the IT12 and IT11 external interrupt pins (this
means that both must have the same sensitivity).
CTL3CTL2IT[12:11] Sensitivity
00Falling edge and low level
01Rising edge only
10Falling edge only
11Rising and falling edge
28/139
Doc ID 6996 Rev 5
INTERRUPTS (Cont’d)
Table 6. Interrupt Mapping
ST7262xxx
N°
0ICPFLASH Start programming NMI interruptYesFFFAh-FFFBh
1USBUSB End Suspend interruptUSBISTRYesFFF8h-FFF9h
2
3Port B external interrupts IT[8:5]ITRFRE1YesFFF4h-FFF5h
4Port C external interrupts IT[12:9]ITRFRE2YesFFF2h-FFF3h
5TBUTimebase Unit interruptTBUCSRNoFFF0h-FFF1h
6ARTART/PWM Timer interruptICCSRYesFFEEh-FFEFh
7SPISPI interrupt vectorSPISRYesFFECh-FFEDh
8SCISCI interrupt vectorSCISRNoFFEAh-FFEBh
9USBUSB interrupt vectorUSBISTRNoFFE8h-FFE9h
10ADCA/D End of conversion interruptADCCSRNoFFE6h-FFE7h
Source
Block
I/O Ports
Description
Reset
TRAP software interruptNoFFFCh-FFFDh
Port A external interrupts IT[4:1]ITRFRE1YesFFF6h-FFF7h
Reserved areaFFE0h-FFE5h
Register
Label
Priority
Order
Highest
Priority
Lowest
Priority
Exit
from
HALT
YesFFFEh-FFFFh
Address
Vector
Table 7. Nested Interrupts Register Map and Reset Values
Address
(Hex.)
Register
Label
76543210
0032h
0033h
0034h
0035h
Ext. Interrupt Port BExt. Interrupt Port AUSB END SUSPNot Used
ISPR0
Reset Value
ISPR1
Reset Value
ISPR2
Reset Value
ISPR3
Reset Value1111
I1_3
1
I1_7
1
Not UsedADCUSBSCI
I1_11
1
I0_3
1
SPIARTTBUExt. Interrupt Port C
I0_7
1
I0_11
1
I1_2
1
I1_6
1
I1_10
1
I0_2
1
I0_6
1
I0_10
1
I1_13
I1_1
1
I1_5
1
I1_9
1
Not UsedNot Used
1
I0_1
111
I0_5
1
I0_9
1
I0_13
1
I1_4
1
I1_8
1
I1_12
1
I0_4
1
I0_8
1
I0_12
1
Doc ID 6996 Rev 5
29/139
ST7262xxx
WFI INSTRUCTION
RESET
INTERRUPT
Y
N
N
Y
CPU CLOCK
OSCILLATOR
PERIPH. CLOCK
I-BIT
ON
ON
CLEARED
OFF
CPU CLOCK
OSCILLATOR
PERIPH. CLOCK
I-BIT
ON
ON
SET
ON
FETCH RESET VECTOR
OR SERVICE INTERRUPT
514 CPU CLOCK
CYCLES DELAY
IF RESET
Note: Before servicing an interrupt, the CC register is
pushed on the stack. The I-Bit is set during the interrupt routine and cleared when the CC register is
popped.
8 POWER SAVING MODES
8.1 INTRODUCTION
There are three Power Saving modes. Slow Mode
is selected by setting the SMS bits in the Miscellaneous register. Wait and Halt modes may be entered using the WFI and HALT instructions.
After a RESET the normal operating mode is selected by default (RUN mode). This mode drives
the device (CPU and embedded peripherals) by
means of a master clock which is based on the
main oscillator frequency divided by 3 and multiplied by 2 (f
CPU
).
From Run mode, the different power saving
modes may be selected by setting the relevant
register bits or by calling the specific ST7 software
instruction whose action depends on the oscillator
status.
8.1.1 Slow Mode
In Slow mode, the oscillator frequency can be divided by a value defined in the Miscellaneous
Register. The CPU and peripherals are clocked at
this lower frequency. Slow mode is used to reduce
power consumption, and enables the user to adapt
clock frequency to available supply voltage.
Figure 24. WAIT Mode Flow Chart
8.2 WAIT MODE
WAIT mode places the MCU in a low power consumption mode by stopping the CPU.
This power saving mode is selected by calling the
“WFI” ST7 software instruction.
All peripherals remain active. During WAIT mode,
the I bit of the CC register is forced to 0, to enable
all interrupts. All other registers and memory remain unchanged. The MCU remains in WAIT
mode until an interrupt or Reset occurs, whereupon the Program Counter branches to the starting
address of the interrupt or Reset service routine.
The MCU will remain in WAIT mode until a Reset
or an Interrupt occurs, causing it to wake up.
Refer to Figure 24.
30/139
Doc ID 6996 Rev 5
Loading...
+ 109 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.