SAFE ST7
EVALUATION BOARD
(ST7FOPTIONS-EVAL)
USER MANUAL
June 2002
DOC- ST7FOPTIONS-EVAL
1
USE IN LIFE SUP PORT DEVICES OR SYSTEMS MUST BE EXPRESSLY AUTHORIZED.
STMicroelectronics PRODUCTS ARE NOT AUTHORIZED FOR USE AS CRITICAL COMPONENTS IN
LIFE SUPPORT DEVICES OR SYSTEMS WITHOUT THE E XPRESS WRITTEN APPROVAL OF
STMicr oel ectr oni cs. As used herei n:
1. Life support devices or systems are those
which ( a) are intende d for surgi cal implan t into
the body, or (b) support or sustain life, and
whose failure to perform, when properly used in
accordance with instructions for use provided
with the product, can be reasonably expected
to result in significant injury to the user.
2. A critical component is any component of a life
support device or system whose failure to
perform can reasonably be expected to cause
the failure of t he life s upport d evice or system,
or to affect its safety or effectiveness.
1
June 20 02 1/28
ST72F26x MCU FAMILY
SAFE ST7 EVALUATION BOARD USER MANUAL
1 INTRODUCTION
The objective of the Safe ST7 E valuation Board is to allow you to try out all the special fea-
tures embedded in the ST72F26x MCU family. You can learn how each feature works and
how to use them the best way by playing with the user controls and jumper settings. For ex-
ample, you can check out what happens to your application when the voltage becomes erratic
or the clock signal suddenly fails.
Examples of what you can do:
Save application data in E2PROM when a power cut occurs and/or the main cl ock source
fails (using the AVD and CSS options). Pr ove it works by resuming the app lication exactly
where it left off after restoring the data saved by the AVD interrupt routine.
Drive LEDs directly (using the MCU’s high sink current I/O ports)
Experiment with different clock sources: external crystal or ceramic resonator, internal RC
oscillator, external clock signal. The advantages of the internal RC: less cost, less
components, less power consumption!
Check out the safe operation of the MCU in varying supply voltage conditions. You change
the voltage using a trimmer. The voltage level is dis played on a 3-digit display. The LVD will
automatically hold the MCU in reset state while the voltage is below th e safe threshold. No
need for an external reset circuit so more savings in board space and components.
Select different power sources, on-board 9V battery or external power supply
Change E2PROM data or Flash program memory on-the-fly using In-Application
Programming (IAP)
Use Nested interrupts to let you interrupt an interrupt routine, service a higher priority
interrupt and resume the one previously being serviced.
This evaluation board incorporates basic input sources such as push-buttons, analog trimmer
or output sources (LEDs, 7-segment displays, buzzer) and a wire-wrap area so you can easily
develop your own application.
The following development tools can be ordered separately: assembler, linker, C compiler,
source level debugger, hardware emulator, programming boards and gang programmer.
For ordering information, see our website at http://mcu.st.com or contact your local sales
office.
1
2/28
Table of Contents
28
1
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 SAFE ST7 EVALUATION BOARD DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 OVERV IEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 BOARD FEATURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 POWER SUPPLY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 OSCILLATION SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 ICP (IN-CIRCUIT PROGRA MMING) CONNECTOR . . . . . . . . . . . . . . . . . . . . . . 7
2.6 I²C SERIAL COMMUNICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 SPI SERIA L COMMUNICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.8 I/O PORT FUNCTIONALITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.8.1 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.8.2 Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.8.3 Port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.9 JUMPER D ESCRIPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.1 W2 - Variable voltage enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.2 W3 - Board reference voltage selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.3 TP4 and TP5 - GND and VDD pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.4 W6 - MCU power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.5 W4 and W5 - Source clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.6 W8 and W9 - External interrupts enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.9.7 W10 - Buzzer enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.8 TP1, TP2 and TP3 - Port connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.9 W15 - LEDs enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.10W13 and W14 - Analog inputs enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.11W12 - High Sink I/O test enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.12W16, W17 and W18 - 7 seg Displays enable/disable . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.13W1 - ICP Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.14W7 - I²C connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
2.9.15JP11 - SPI Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3 SOFTWARE DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1 OPTION BYTE CONFIGURATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 MAIN MCU INITIALIZATION ROUTINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 COUNT ERS AND USE OF TIMING RESOURCES . . . . . . . . . . . . . . . . . . . . . . 13
3.4 INTERRUPT SER VICE ROUTINES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3/28
Introduction
3.5 MAIN PRO GRAM ROUTINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 OPERATING THE DEMOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3.6.1 Running the LVD Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.6.1.1LVD Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.6.2 Running the AVD Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.6.2.1AVD Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.6.3 Running the CSS Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.6.3.1CSS Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6.4 Running the High I/O current demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6.4.1High Sink Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6.5 Running the IAP demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6.5.1IAP Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
3.6.6 Running the Nested & Concurrent Interrupts demo . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.6.6.1Nested & Concurrent Interrupts Demo Description . . . . . . . . . . . . . . . . . . . . 25
4 APPENDIX 1: SAFE ST7 EVALUATION BOARD SCHEMATIC . . . . . . . . . . . . . . . . 26
4/28
Safe ST7 Evaluation Board DESCRIPTION
2 SAFE ST7 EVALUATION BOARD DESCRIPTION
The Saf e ST7 Eva luation B oard is des igned to support any of the S DIP32 p ackage de vices
from the ST72F264 family (ST72F264, 262, 260).
2.1 OVERVIE W
This board is supplied ready-to-use, to let you try out all the functions described in this manual.
The board is delivered with a SDIP32 socket. You will have to build an adapter if you need
evaluate the ST72F264 in other packages. Additional hardware functions can be implemented
by installing components in the wire-wrap area as shown in Figure 1 below.
Figure 1. Safe ST7 Evaluation Board layout
For more details, please refer to the schematic drawing in the appendix.
Battery
Wire-Wrap
Area
Two Push
Buttons
Reset
Button
Buzzer
Three
7-segments
LEDs
Voltage
Trimmer
ICP Connector
PA, PB &
PC Ports
Connector
SPI
Connector
I²C
Output
LEDs
MCU +
Clock system
1
5/28
Safe ST7 Evaluation Board DESCRIPTION
The main Safe ST7 Evaluation Board components are:
- Socketed ST72F264
- 16MHz crystal
- Reset pushbutton
- ICP connector
- Socketed I²C 8K byte EEPROM (M24C08)
- Socketed SPI 4K byte EEPROM (M95040)
- 2 pushbuttons for external interrupts
- 22 pins for expansion ports
- Row of 8 LEDs for displaying binary values
- Three 7-segment LEDs
- High efficiency LED
- Potentiometer for main voltage variation
- Potentiometer for I/O current variation
- 9-volt battery
- Buzzer
- Wire-Wrap area
2.2 BOARD FEATURES
- Low voltage detector (3 levels programmable by option bytes)
- Auxiliary voltage detector
- Multi-Oscillator and Clock Security System
- High Sink/source current
- Nested/ Concurrent Interrupts
- In-Application Programming
- In-Circuit Programming
- I²C & SPI communications interfaces
- 10-bit ADC
6/28
Safe ST7 Evaluation Board DESCRIPTION
2.3 POWER SUPPLY
This board is supplied with a P P3 9-volt battery demo nstrating the board’s low power con-
sumption. A complementary DC power supply input (ref. J1) is provided to supply the board
by external ( 9 to 13 Volt) pow er. When using t his power supply, take care to respect the po-
larities marked next to the two-pole connector.
Warning: Disconnect the battery from its socket when the Safe ST7 Evaluation
Board is not in use.
The reference voltage on board (VDD) is selected through the W3 jumper. You can choose be-
tween two reference voltages, either a regulated 5 volts and or a voltage that varies, by
moving the R5 trimmer position, from 0 to 5.6 Volts as shown in Figure 2.
Figure 2. How to Change the Board Voltage Reference
The 1N4004 diodes provide for polarity protection and the LD1 LED provides an indication that
power is being supplied to the board.
2.4 OSCILLATION SYSTEM
The board is designed to be used with an on-board 16-MHz crystal. This allows you to con-
figure the CPU frequency up to 8 MHz.
The oscillator system is designed to fit a range of application needs, and you can choose be-
tween three different sources using the W4 and W5 jumpers as shown in Figure 3.
VDD Board
Variable Volta ge5 regulated Vol ts W3
VDD
Board
Variable Voltage5 regulated Volts W3
5 regulated Volts select ed Variable Voltage selected
RV1
7/28
Safe ST7 Evaluation Board DESCRIPTION
Figure 3. How to Change the Oscillator Frequency Source
2.5 ICP (IN-CIRCUIT PROGRAMMING) CONNECTOR
You can use In Circuit Programming (ICP) to update the en tire contents of the Flash memory
(including option bytes) using the ICC protocol. Figure 4 shows the connector pin assignment.
If you are connecting an ST Programming Tool to Safe ST7 Evaluation Board just connect
cable provided with the ST Programming Tool to the ICP connector "W2" and then power on
the board.
Figure 4. How t o use the ICP Connector
Crystal Resonator Internal RC oscillator External Clock
C4
C5 W5
W4
C4
C5 W5
W4 C4
C5 W5
W4
XT1 XT1 XT1
1
29
10
Cable to ST Programming Tool
1
29
10
ICCDATA
ICCCLK
RESET
VPP
ICP Connector Pin assignment
OSC_CLK
W2 W2
ICP ICP
8/28
Safe ST7 Evaluation Board DESCRIPTION
2.6 I²C SERIAL COMMUNICATION
An external 8 Kb EEPROM memory with an I²C serial interface is connected to the I²C pins of
the ST7 socket as shown in the following figur e. The serial EEPROM may also be discon-
nected and the I²C bus used for other communications.
Figure 5. How t o use the I²C Connection
2.7 SPI SERIAL COMMUNICATION
An external 4 Kb EEPROM memory with an SPI serial interface is connected to the SPI pins
of the ST7 socket as shown in the following figure. The serial EEPROM may also be discon-
nected and the SPI bus used for other communications.
Figure 6. How to use the SPI Connection
Using the On-board I²C EEPROM Using the I²C BUS
W7
Install all the jumpers on the I²C connector. Remove the jumpers and use left connector side.
SCLI
SDAI
U4
M24C08
ST7 I²C
pins
W7
SCLI
SDAI
I2C
U4
M24C08
ST7 I²C
pins
I2C
Install all the jumper s on the SPI connector. Remove the jumpers and use left connector side.
Using the On-board SPI EEPROM Using the SPI Bus
W 11
MISO
SCK
SPI
U5
M95040
ST7 I²C
pins
MOSI
PB3
W 11
MISO
SCK
SPI
U5
M95040
ST7 I²C
pins
MOSI
PB3
9/28
Safe ST7 Evaluation Board DESCRIPTION
2.8 I/O PORT FUNCTIONA L ITY
All I/O port pins are accessible through external connectors ( TP1 for port A, TP2 for port B
and TP3 for port C ).
2.8.1 Port A
The PA0 and PA1 pins are connected to the ICP connector using their alternate functions, IC-
CCLK and ICC DATA.
The PA2 and PA3 pins are used to enable the U6 and U7 7-segment LED displays (useful for
multiplexing).
The PA5 pin can be used to generate an external interrupt (ei0). It is connected to the ground
via the SW2 push-button switch .
The PA4 a nd PA6 pin s alternate f unctions (SCL I and SD AI) are used fo r connecting an I²C
communication with the external I²C EEPR OM.
PA7 is used to exercise the high sink I/O current capability through the High efficiency LED.
Table 1. Port A Alternate Functions
2.8.2 Port B
This port is connected simultaneously to 8 LEDs and to the three 7-segment displays. It can
be used to display 8 bits of binary data.
Table 2. Port B Alternate Functions
2.8.3 Port C
The PC0 pin can be connected to ground via the SW 3 push-button in order to generate an
external interrupt (ei1).
PA0 ICCCLK In Circuit Communicati on Clock
PA1 ICCDATA In Circuit Communication Data
PA2
PA3
PA4 SCLI I²C Clock
PA5 RDI SCI output
PA6 SDAI I²C Data
PA7 TDO SCI input
PB0 ICAP1_A Timer A Input Capture 1
PB1 OCMP1_A Timer A Output Compare 1
PB2 ICAP2_A Timer A Input Capture 2
PB3 OCMP2_A Timer A Output Compare 2
PB4 MOSI SPI Master Out Slave In Data
PB5 MISO SPI Master In Slave Out Data
PB6 SCK SPI Serial Clock
PB7 SS SPI Slave Select
10/28
Safe ST7 Evaluation Board DESCRIPTION
The PC1/OCMP1_B pin can be connected to a buzzer through the W10 jumper .
The PC2 pin is used to enable the output signal to the LEDs. A high level on PC2 enables the
logic states programmed by port B to be output on the 8 LE Ds.
The PC3 pin is used to enable the U8 7-segment LEDs display (useful for multiplexing).
The PC4/AIN4 pin can be used through the W14 jumper as in analog input to measure the
voltage level of R13.
The PC5/AIN5 pin can be used through the W13 jumper as in analog input to measure the
VREF voltage.
Table 3. Port C Alternate Functions
2.9 JUMPER DESCRIPTIONS
2.9.1 W2 - Variable voltage enable/disable
This jumper allows you to disable the variable voltage and thus reduce the total power con-
sumption of the board and extend battery life.
2.9.2 W3 - Board ref erence voltage selection
Refer to Section 2.3 POW ER SUPPLY.
2.9.3 TP4 and TP5 - GND and VDD pins
These spare ground and VDD pins are for test purposes or for providing power to components
in the wire-wrap area.
2.9.4 W6 - MCU power co nsumption
This jumper is only for connecting to the MCU power supply. Its ma in purpose is to allow you
to measure the current consumption of the µC by connecting a DC-ammeter in series.
2.9.5 W4 and W5 - Source clock selection
Please refer to Section 2.4 Oscillation system.
2.9.6 W8 and W9 - External interrupts enable/disable
Those two jumpers allow you to disconnect the two push-buttons SW2 and SW3 from the PA5
and PC0 pins respectively.
PC0 ICAP1_B / AIN0 Timer B Input Capture 1 Analog Input 0
PC1 OCMP1_B / AIN1 Timer B Output Compare 1 Analog Input 1
PC2 CLKOUT / AIN2 CPU Clock Out Analog Input 2
PC3 ICAP2_B / AIN3 Timer B Input Capture 1 Analog Input 3
PC4 OCMP2_B / AIN4 Timer B Output Compare 1 Analog Input 4
PC5 EXTCLK_A / AIN5 Timer A External Clock Analog Input 5
11/28
Safe ST7 Evaluation Board DESCRIPTION
2.9.7 W10 - Buzzer enable/disable
This jumper allows you to use the buzzer by connecting it to the PC1 pin.
2.9.8 TP1, TP2 and TP3 - Port connectors
These jumpers allow you to access all I/O ports.
2.9.9 W15 - LEDs enable/disable
This jumper is used to connect the LEDs to groun d through the resistor netw ork. It is recom-
mended to remove the jumper from the board if this feature is not used.
2.9.10 W13 and W14 - Analog inputs enable/disable
These jum pers are for me asuring the Vr ef analog volt age and the vo ltage through R13. Re-
moving them will disable those two features (The measurement of the VDD voltage value and
the measurement of the current driven through the high efficiency LED).
2.9.11 W12 - High Sink I/O test enable/disable
This jumper lets you enable or disable the High efficiency LED.
2.9.12 W16, W17 and W18 - 7 seg Displays enable/disable
These jumpers allow you to enable/disable the three 7-seg displays (useful for multiplexing).
2.9.13 W1 - ICP Connector
Please refer to Section 2.5 ICP (In-C i rcuit Programming) connector.
2.9.14 W7 - I²C connector
Please refer to Section 2.6 I²C serial communication.
2.9.15 JP11 - SPI Connector
Please refer to Section 2.7 SPI serial communication.
12/28
SOFTWARE DESCRIPTIO N
3 SOFTWARE DESCRIPTION
This part gives a short description of the whole program as a main routine that uses many
other functions and several drivers. The configuration of the microcontroller and also the con-
figuration of option bytes is described first, followed by an overview of the main program struc-
ture. Finally, we will provide a detailed description of how to use the board’s features.
3.1 OPTION BYTE CONFIGURATION
Option bytes are only accessed using In-Circuit Programming or an ST programming tool
such as an EPB. In this case, the option bytes are configured as described below.
– Watchdog is configured to be enabled by software and to allow the MCU to enter Halt Mode
(no reset on Halt).
– The LVD threshold is fixed to the medium value.
– Sector 0 size is 4 Kbytes.
– No program memory protection.
– Port C external interrupt mapping is configured as ei1.
– The clock security system is always on.
– Oscillator type is resonator oscillator.
– Oscillator range is between 8 and 16 MHz.
Table 4. Option byte configuration
EXTIT CSS OSC
TYPE1 OSC
TYPE0 OSC
RNGE2 OSC
RNGE1 OSC
RNGE0 PLL
OFF
10000111
WDGHALT WDG SW VD1 VD0 SEC1 SEC0 FMP R FMP W
01011100
13/28
SOFTWARE DESCRIPTION
3.2 MAIN MCU IN ITIALIZATION ROUTINE
This routine initializes the MCU as follows:
– MISCR (miscellaneous register): external interrupts trigger on falling edge, no slow mode
and fCPU=8 MHz.
– Port A: PA7 (Driving the H i gh efficie n cy LED) is an open drain output, PA6 & PA4 used by
I²C as input without interrupt, PA5 (Push-button) used as floating input with interrupt, PA2 &
PA3 (multiplexing 7-seg displays) as push-pull outputs.
– Port B: used as push pull output to display data.
– Port C: PC5 & PC4 as ADC alternate inp uts, PC3 as push-pull output (multiplexing 7-seg
displays), PC2 to select the LED bank (push-pull output), PC1 to drive the buzzer and PC0
as an input with interrupt (push-button).
3.3 COUNTERS AND USE OF TIMING RESOURCES
– Timer A is used as a real time clock that provides a precise time base for all program rou-
tines. Timer A interrupt is enabled.
– Timer B is mainly used to drive the buzzer using PWM mode without interrupts.
3.4 INTERRUPT SERVICE ROUTINES
Timer A interrupt: increment (circular buffer) several global counters used as time counters
when the free running counter reaches the calculated value.
AVD interrupt: saves the current mode when the power drops and, if we are in AVD mode,
the last displayed digits are saved in the external I²C EEPROM using the I²C driver.
ei1 Interrupt: this interrupt is used to wake-up the microcontroller from idle mode (HALT)
and also it increments a circular variable used by the main program to enter the correspond-
ing test.
ei0 Interrupt: this interrupt is used to test concurrent and nested interrupts.
3.5 MAIN PROGRAM ROUTINE
The main p rogram inc ludes the initial ization code and an endless lo op that proces ses the
pushbutton inputs. In fact, after initialization and enabling interrupts, the main program w ill
continue running in an infinite loop and wait for an external interrupt to switch to one of the
demo routines: (LVD, AVD/CSS, High Current I/O, IAP, Concurrent/ N e sted Interrupts).
By default the program is in Halt mode (to reducing power consumption).
Warning: Disconnect the battery from its socket when the Safe ST7 Evaluation
Board is not in use.
14/28
SOFTWARE DESCRIPTIO N
Figure 7. Main program flowchart
Begin
Disable all Interrupts
MCU Initia lization
C Initialization
Safety procedure
Init Timer A
Disable RASS Keys
Enable all interrupts
“START” message “FINISH” message
LVD Demo
AVD Demo
IAP Demo
Nested IT Demo
Test “MODE”
variable
: Program path/ PGM interrupt
Concurrent IT Demo
High Current Demo
Enter Halt Mode
This functio n is used for the AVD interrupt
15/28
SOFTWARE DESCRIPTION
3.6 OPERATING T HE DEMOS
The flowcharts below provide a full description of all the tests and demos that you can run.
Figure 8. Operations Flowchart (1)
Power-on the board / RESET
Disp lay
START
Light-on LED 0
Display the
V
DD
voltage
Display a counter 000..99 9
L ight-on LED2
Display "
LVD
"
Light-on LED 1
End
MCU in a HALT state
Push The PGM
bu tton
No
Push The PGM
b u tton
Yes
HALT Mode
Push The PGM
button
Push the DEMO
b u tton
Yes
Push The PGM
b u tton
No
Push The PGM
button
Display "
AVD CSS
"
L ight-on LED 2
No
Yes
button
Yes
No
Yes
No
No
Push The PGM
button
No
No
Push The PGM
b u tton
Yes
Yes
No
Yes
T o next figure
Light-on LED1
LoL f
Low V oltage Detector Demo
AVD and CSS Demo
Push the DEMO
16/28
SOFTWARE DESCRIPTIO N
Figure 9. Operations Flowchart (2)
Display "
HIO
"
Light-on LED 3
Display the cu rrent inside the High Efficiency LED
Ligh t-on LED 3
Light-on the high efficienc y Led
D isplay "
IAP
"
Light-on LED 4
P ush the MODE
Button
Push the DEMO
b u tton
Push The PGM
button
No
No
Yes
Push The PGM
button
No
Yes
Yes
From previous Figure
Push The PGM
button
No
No
Display "
SCORE 1
"
Light-on LED 4
Display "
DONE
"
Light-on LED 4
Receive & Re-program
Score1
from the SPI E²PROM
Send
Score0
&
Score1
to the SPI E²PR O M
Receive & Re-program
Score0
from t he SPI E²PROM
Test XFlash
memory
Display "
TRANSFER
"
Lig ht-on LED 4 Display "
SCORE 0
"
Light-on LED 4
Score 1
Score 0
First Time
Push The PGM
button
To next Figure
Yes
No
Yes
High I/O C u rrent Demo
In-Applicat ion Prog ram mi ng Dem o
17/28
SOFTWARE DESCRIPTION
Figure 10. Operations Flowchart (3)
Display " CONCURRENT IT "
Light-on LED 5
Wait End of score
Light-on LED 5
Display " FINISH "
Light-on LED 7
End
From previous Figure
End of the
message
Push The PGM
butto n No
No
Light-on LED 5
Yes
Push The PGM
button
Play music Score
Light-on LED 5
End of The Score
Push The DEMO
button
Yes
Display " NESTED IT "
Light-on LED 6
Yes
No
No
Display a lighting Sequence on LEDs
Yes
Push The P G M
button
End of the
Light-on LED 6
Push The PGM
button
No
Play music Score
Light-on LED 6
End of The Score
Push The DEM O
button
No
Display a lighting Sequence on LEDs
Yes
Yes
Yes
Concurrent Interrupts Demo
message
Yes
No
IT1
IT0
Nested Interrupts Demo
18/28
SOFTWARE DESCRIPTIO N
3.6.1 Running the LVD Demo
In LVD Demo state (see Figure 11), the user can switch between the two positions of W3 as
described in Section 2.3.
If the power goes below the LVD level, the microcontroller enters R ESET state. At power-on,
the program enters LVD demo mode (because an LVD reset was detected) and displays the
VDD voltage on the 7-seg display.
3.6.1.1 LVD Demo Description
The program reads in a fixed 2.4V reference voltage (VREF) via the 10-bit ADC channel, does
some arithmetic to con vert the digital value it has rea d to a voltage level and fin ally displays
the main voltage of the board (VDD) in Volts on the three 7-segment LEDs.
Note: X is the converted digital value of VREF (2.4 Volts) and 3FF is the digital value of VDD,
So:
Figure 11. LVD Demo Overview
The W3 jumper must be moved to the right to select the va riable power supply. If the RV1
trimmer is turned completely clockwise, the board is powered by 5.6 Volts. If the trimmer is
turned counter-clockwise the VDD value will decrease until we reach the LVD threshold (VIT-),
at which point the microcontroller enters reset mode.
VDD 2.4 3FF
X
-----------
×=
press to reset
Battery
ST72F264
Potentiometer
LED1
move the jumper
to right
on
off
SAFE ST7
Push to run
the Demo
press until LED1
lights-on
EVALUATION BOARD
19/28
SOFTWARE DESCRIPTION
In power-on, if the trimmer is turned clockwise, the device will leave reset state and we can
see the VIT+ threshold on the display.
Note: the VIT- reference value for a voltage drop is lower than the VIT+ reference value for
power-on in order to avoi d parasitic reset when the microcontroller starts running and sinks
current on the supply (hysteresis).
3.6.2 Running the AVD Demo
In Auxiliary Voltage Detector & Clock Security System Demo state (see Figure 12), the 7-seg
display shows a counter that increments from 000 to 999.
To test the AVD capability:
– Disconnect the battery or decrease the VDD vol tage using the power trimmer until the MCU
enters RESET state.
– Then, supply the board with the right voltage.
– You will see that the counter does not restart at 000, but resumes counting from the last dis-
played value before shut-down.
3.6.2.1 AVD Demo Description
For system integrity management, in addition to the L VD feature, the Safe ST7 Evaluation
Board has an auxiliary voltage detector (AVD) with interrupt capability. In case of a drop in
voltage, the AVD interrupt acts as an early warning, allowing software to shut down safely be-
fore the LVD resets the microcontroller. The AVD works closely with the LVD and functions
only if the LVD is enabled through option byte (see “Option byte configuration” on page 12).
20/28
SOFTWARE DESCRIPTIO N
Figure 12. AVD Demo Overview
In case of powe r drop, and befor e going into reset state , the AVD inter rupt will save the last
displayed value in the external EEPROM (M24C08) using the I²C protocol. On power-on, the
software checks if the last reset was made by the LVD, if this is the case, it downloads the pre-
viously saved value from the external EEPROM to RAM memory in order to resume counting
as normal.
To cause a voltage drop, we can choose between two solutions as shown in the Figure 12.The
first method consists of moving the W3 jumper to the right, then decreasing the main voltage
by turning the RV1 trimmer counter-clockwise. The second method consists of moving the W3
jumper to the left so that we will have a 5-Volt reference value, and then disconnecting the bat-
tery.
3.6.3 Running the CSS Demo
To run this demo, we have to be in the same state as in the AVD demo see “Running the AVD
Demo” on page 19.
Once the main program runs at 8 MHz, Timer A is configured to manage the counting opera-
tion displayed on the three 7-segments LEDs.
To test the CSS capability:
– Disconnect the oscillator by removing the W4 and W5 jumpers.
– You will see the frequency decreases significantly but that the counter still working.
press to reset
Battery
ST72F264
Potentiometer
LED2
move the jumper
to right
on
off
press to reset
Battery
ST72F264
LED2
move the jumper
to left
Disconnect the battery
pres s until LED2
lights-on Push to
run the Demo
press until LED2
lights-on Push to
run the Demo
SAFE ST7
EVALUATION BOARD SAFE ST 7
EVALUATION BOARD
21/28
SOFTWARE DESCRIPTION
3.6.3.1 CSS Demo Description
The clock security system (CSS) embedded in the ST72F264 family of microcontrollers, pro-
tects the device against problems occurring to the main cloc k. To allow you to integrate secu-
rity features in your application, it performs clock filter control and generates an interrupt in
case of clock problem s, while switch ing to an internal safe oscillator to allow the software to
keep runn ing at a redu ced speed. Th e safe oscillato r of the C SS block is a low frequency
back-up clock source (around 3 Mhz).
Figure 13. CSS De mo Overview
If the clock signal disappears, which you can provoke by disconnecting the two jumpers as
shown in Figure 13, the safe oscillator delivers a low frequency clock signal (around 3MHz) for
a safe oscillator period which allows the ST7 to save any critical data or perform any kind of
emergency operations while the CPU is still running.
The ST7 clock source switches back from the safe oscillator automatically if the original clock
source recovers. You can simulate this by replacing the clock jumpers. For more details refer
to Section 2.4 Oscillation system.
3.6.4 Running the High I/O current demo
This demo uses the example of a high efficiency LED to provide a visible result: its relative lu-
minosity increases linearly with the forward current, which reaches more than 50mA at only 3
Volts.
The program measures the value of the current in the LED using ADC analog input channel 4
and at the same time it displays the result on three 7-segment LEDs (units in mA).
press until LED2
lights-on
press to reset
Battery
ST72F264
LED2
move the jumper
to left
Disconnect the
two clock jumpers
Push to
run the Demo
SAFE ST7
EVALUATION BOARD
22/28
SOFTWARE DESCRIPTIO N
To vary the forward current, we have to move the RV2 trimmer position as shown in Figure 14
You can verify the current value for yourself by connecting a serial ammeter to W12.
Figure 14. High Sink I/O Demo Overview
3.6.4.1 High Sin k Demo Desc ription
This demo shows how the high sink outputs can be used and how to measure the current de-
livered by any of the high sink outputs on Port A. In addition to standard I/O ports which sink
and sources a maximum (absolute rating) output current of 25mA, most ST7s include High
sink I/Os that can sink a current (absolute rating) output of up to 50mA. This allows you to
drive any type of high power device directly without needing expensive external circuitry.
3.6.5 Running the IAP demo
This demo consists of re-programming XFLASH sector 1 using the In-Application Program-
ming. To show this, it reprograms one piece of music (64 Bytes) by another one using the SPI
communication protocol with the external M95040 4Kb SPI EEPROM memory.
The demo software includes an IAP_driver that will be copied to the RAM area to execute the
demo. It programs 16 bytes at a time.
For more details about XFL ASH In-Application Progr amming refer to the ST7 FLASH P ro-
gramming Reference manual.
As shown in Figure 15, you enter the IAP demo by pushing down the PGM button until LED4
lights-up and the “IAP” message appears. Then you must push the DEMO button. During this
time the device will be updated and when this is finished a “DONE” message will appear.
press until LED3
lights-on
press to reset
Battery
ST72F264
LED 3
move the jumper
to left
-+
Push to
run the Demo
SAFE ST7
EVALUATION BOARD
23/28
SOFTWARE DESCRIPTION
Note: If you don’t want to ente r this mode, you must push the PGM button again to jump di-
rectly to the next demo.
Note: This demo only runs the software that downloads the musical sequence from the ex-
ternal EEPROM to the XFLASH device. This music data can be output on the buzzer. In order
to listen to the music and ver ify that th e data h as been cha nged by IAP , you have to run the
nested & concurrent interrupts demos.
Figure 15. IAP Demo Overview
3.6.5.1 IAP Demo D escription
The ST72F26x microcontroller family has a single voltage extended Flash (XFLASH) area that
can be electrically erased and programmed either on a byte-by-byte basis or up to 32 bytes in
parallel. In-Application Programming (IAP) allows you to update program memory contents
when the device is alread y plugged on the application bo ard, at minimum cos t in terms of
added components and board area impact.
This programming mode uses an IAP driver program which has been previously programmed
in sector 0. This method is fully controlled by us er software. This allows it to be adapted to the
user application ( user-defined stra tegy for enteri ng programming mod e, choice of communi-
cations protocol used to fetch the data to be stored).
RAM Mapping
0xA0 to 0xA1: XFLASH start address (2 bytes)
0xA2 to 0xB2: 16-byte RAM buffer.
press to reset
Battery
ST72F264
LED4
keep the jumper
to left
press until LED4
lights-on Push to run the Demo
SAFE ST7
EVALUATION BOARD
24/28
SOFTWARE DESCRIPTIO N
0xB2 to 0xCE: IAP_driver storage ar ea, (used only while the demo is running)
Sector1 Mapping (Reprogramm a ble Area)
0xE000 to 0xE00F: 16 spare bytes for testing
0xE010 to 0xE04F: (64 bytes) Music score1 (Softw are reprogrammable bytes)
0xE050 to 0xE08F: (64 bytes) Music score 2
0xE090 to 0xE14F: All other constants
Figure 16. IAP De mo flowchart
3.6.6 Running the Nested & Concurrent Interr upts demo
Most ST7 microcontrollers have two di fferent interrupt management modes. The first i s cal led
concurrent mode and does not allow an interrupt to be interrupted, unlike the nested mode
where a software priority is given to each interrupt.
Begin
Test 0xE000
content
Display "TRANSFER"
First time the chip is plugged in
Init SPI
Send Score 1& 2 to M9 50 40
SPI Disable
Using IAP write "1" to 0xE000
End
Init SPI
Receive next 16 bytes of Score1 (2) from M95040
SPI Disable
Using IAP write "2" (1) to 0xE000
Else 0xE010..0xE04F contents Score0 (or 1)
Repeat 4 times
Program 16 bytes of Score1 (2) to the right addresses
Display "SCORE0" (or "SCORE1")
25/28
SOFTWARE DESCRIPTION
3.6.6.1 Nested & Concurrent Interrupts Demo Description
Figure 17. Interrupts Demo Overview
As shown in Figure 17 this demo is divided into two parts: The first one runs concurrent inter-
rupts while the second uses nested interrupts.
The IT0 an d IT1 inter rupt service r outines ar e assigned to ext ernal inte rrupt vector s ei0 and
ei1. You can trigger the interrupts directly by pressing the tw o push-buttons shown in Figure
17:
IT1: outputs a piece of music (previously downloaded in the IAP demo) on the buzzer.
IT0: displays a lighting sequence on LEDs.
In the first demo (Concurrent Interrupts), all the interrupts have the same priority level, so the
interrupt with the highest hardware priority will be serviced (in this case it is ei0).
In this demo, you have to push the PGM button in order to trigger the IT1 routine, then pushing
the DEMO button, IT0 won’t interrupt the IT1 routine and you have to wait for the end of music
before the LEDs light up in sequence.
To run the nested interrupt demo the board must be in the state shown in Figure 17, then if you
push the PGM button, it will trigge r the IT1 interrupt r outine (music output). B efore the end of
the music you have to push the DEMO button in order abort the IT1 routine and service the IT0
routine. When the program returns from IT0, it resumes playing the music from the point
where it was interrupted.
press to reset
Battery
ST72F264
LED5
keep the jumper
to left
(1) Press to run IT1
(2) Press to run IT0
Buzzer
press to reset
Battery
ST72F264
LED6
keep the jumper
to left
(1) Press to run IT1
(2) Press to run IT0
Buzzer
Nested Interrupt DemoConcurrent Interrupt Demo
SAFE ST7
EVALUATION BOARD SAFE ST7
EVALUATION BOARD
26/28
Appendix 1: Safe ST7 Evaluation B oard SCHEMATIC
4 APPE NDIX 1: SAFE ST7 EVALUATION BOARD SCHEMATIC
CD1
100nF
C1
100µF
1 3
2
VV
GND
IN OUT
U1
L7805
D1
1N4004
D2
1N4004
RV1
10k
R4
1k
R5
4.7k
T1
2N2222
VCC
R2
4.7k
C2
100µF
CD2
100nF
LD1
POWER
Z2
5V6
VCC
1
2
J1
BT1
R1
470
Z1
2V4
1
2
3
W3
POWER SELECT
3
21
84
U2A
TS912
VREF
W2
PA0
PA1
PA2
PA3
PA4
PA5
PA6
PA7
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
PC0
PC1
PC2
PC3
PC4
1
2
3
4
5
6
7
8
TP1
1
2
3
4
5
6
7
8
TP2
1
2
TP4
VCC
1
2
TP5
GND
VCC
1
2
3
4
5
6
TP3
PC5
27/28
Appendix 1: Safe ST7 Evaluation B oard SCHEMATIC
R6
4.7k
SW1
RESET
VCC
CD3
100nF
XT1
4Mhz C5
22pF
C4
22pF
R10
27k
R9
27k
R11
100
R12
100
VCC
VCC
VCC
CD7
100pF
CD8
100pF
PB6
PB4
PB5
12 34 56 78 910
W1
ICP
VCC
R3
10k
RESET
LD3
LD4
LD5
LD6
LD7
LD8
LD9
LD10
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
T3
BC547
VCC
CD4
100nF R7
4.7k
SW2
DEMO
VCC
CD5
100nF
R8
4.7k
SW3
PGM CD6
100nF
EI0 EI1
R13
10
LD2
VPP
OSC1
T2
BC547
ICCCLK/PA0 29
ICCDATA/PA1 28
PA2 27
PA3 26
SCLI/PA4 23
RDI/PA5 22
SDAI/PA6 21
TDO/PA7(HS) 20
PB0/ICAP1_A
13
PB1/OCMP1_A
12
PB2/ICAP2_A
11
PB6/SCK
5
PB4/MOSI
7
PB5/MISO
6
PB3/OCMP2_A
10
PB7/ SS
4
AIN1/OCMP1_B/PC1 18
AIN2/MCO/PC2 17
PC3/ICAP2_B/AIN3
16
PC4/OCMP2_B/AIN4
15
PC5/EXTCLK_A/AIN5
14
OSC1
2
OSC2
3
RESET
1
VPP/TEST 30
VDD 32
NC
8
NC
9
VSS 31
AIN0/ICAP1_B/PC0 19
NC 24
NC 25
U3
ST72F264
1
2
3
W5
1
2
3
W4
R16
1k
W16 R15
4.7k
PA2
W15
Leds enable
R14
4.7k
PC2
T4
BC547
R18
1k
W17 R17
4.7k
PA3
VCC
W14
W13
VREF
BZ1
Buzzer
W10
W6 IDD VCC
W9
W8
SS
1
D
5
Q
2
W3
HOLD 7
C
6
VCC 8
VSS
4
U5
M95040
PC2
E0 1
E1 2
E2 3
SDA
5
SCLK
6
WC 7
VCC 8
VSS
4
U4
M24C08
VPP
ICCCLK
ICCDATA
VPP
ICCDATA
PA3
PA2
ICCCLK
W12
2
3
4
5
6
7
8
9
1
RS1
1k
1 2
3 4
W7
I2C
7
6
4
2
1
10
9
5
3
8
U8
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
7
6
4
2
1
10
9
5
3
8
U6
7
6
4
2
1
10
9
5
3
8
U7
T5
BC547
R20
1k
W18 R19
4.7k
PC3
PB7
PB6
PB5
PB4
PB3
PB2
PB1
PB0
PC3
PC5
PC4
PC3 PC2
PC1
PC0
PA7
PA6
PA5
PA4
PA3
PA2
1 2
3 4
5 6
7 8
W11
SPI
PB3
C3
100pF
PA0
PA1
PA4
PA6
PA1
PA0
RV2
I/O Test
28/28
Appendix 1: Safe ST7 Evaluation B oard SCHEMATIC
THE SOFTWARE INCLUDED IN THIS N OTE IS FOR GUIDANC E ONLY.
STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR
CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM USE OF
THE SOFTWARE.
Information furnished is believed to be accurate an d reliable. However, STMicroelectronics assumes no respo nsibility for the consequences
of use of such inf ormation nor for any infri ngement of patents or othe r rights of th ird parties which may result fr om its use. No license is granted
by implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are s ubject
to change without notice. T his publicat ion supersedes and replaces all information previously supplied. STMicroelectronics products are not
authorized for use as c ritical components in life su pport devices or systems witho ut the express written approval of STMicroelectronics.
The ST logo is a registered trademark of STMicroelectronics
ã2002 STMicroelectronics - All Rights Reserved.
Purchase of I2C Components by STMicroelectronics conv eys a license under th e Philips I2C Patent. Rights to use these components in an
I2C system is granted provided that the system conforms to the I2C Standard Specificat ion as defined by Philips.
STMicroelectronics Group of Compan ies
Australia - Br azil - Canada - China - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan
Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - U.S.A.
http://www.st.com
Mouser Electronics
Authorized Distributor
Click to View Pricing, Inventory, Delivery & Lifecycle Information:
STMicroelectronics:
ST7FOPTIONS-EVAL