Upload
others
View
1
Download
0
Embed Size (px)
Citation preview
SAFE ST7EVALUATION BOARD
(ST7FOPTIONS-EVAL)
USER MANUAL
June 2002
DOC- ST7FOPTIONS-EVAL
1
USE IN LIFE SUPPORT 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 EXPRESS WRITTEN APPROVAL OF STMicroelectronics. As used herein:
1. Life support devices or systems are thosewhich (a) are intended for surgical implant intothe body, or (b) support or sustain life, andwhose failure to perform, when properly used inaccordance with instructions for use providedwith the product, can be reasonably expectedto result in significant injury to the user.
2. A critical component is any component of a lifesupport device or system whose failure toperform can reasonably be expected to causethe failure of the life support device or system,or to affect its safety or effectiveness.
1
ST72F26x MCU FAMILY
SAFE ST7 EVALUATION BOARD USER MANUAL
1 INTRODUCTION
The objective of the Safe ST7 Evaluation 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 andhow 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 erraticor 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 clock sourcefails (using the AVD and CSS options). Prove it works by resuming the application exactlywhere 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 RCoscillator, external clock signal. The advantages of the internal RC: less cost, lesscomponents, less power consumption!
■ Check out the safe operation of the MCU in varying supply voltage conditions. You changethe voltage using a trimmer. The voltage level is displayed on a 3-digit display. The LVD willautomatically hold the MCU in reset state while the voltage is below the safe threshold. Noneed 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-ApplicationProgramming (IAP)
■ Use Nested interrupts to let you interrupt an interrupt routine, service a higher priorityinterrupt and resume the one previously being serviced.
This evaluation board incorporates basic input sources such as push-buttons, analog trimmeror output sources (LEDs, 7-segment displays, buzzer) and a wire-wrap area so you can easilydevelop 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 salesoffice.
June 2002 1/28
1
Table of Contents
2/28
1
28
1 INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
2 SAFE ST7 EVALUATION BOARD DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.1 OVERVIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 BOARD FEATURES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.3 POWER SUPPLY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.4 OSCILLATION SYSTEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.5 ICP (IN-CIRCUIT PROGRAMMING) CONNECTOR . . . . . . . . . . . . . . . . . . . . . . 7
2.6 I²C SERIAL COMMUNICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.7 SPI SERIAL COMMUNICATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.8 I/O PORT FUNCTIONALITY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.8.1 Port A . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.8.2 Port B . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92.8.3 Port C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.9 JUMPER DESCRIPTIONS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.1 W2 - Variable voltage enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.2 W3 - Board reference voltage selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.3 TP4 and TP5 - GND and VDD pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.4 W6 - MCU power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.5 W4 and W5 - Source clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.6 W8 and W9 - External interrupts enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . 102.9.7 W10 - Buzzer enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.8 TP1, TP2 and TP3 - Port connectors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.9 W15 - LEDs enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.10W13 and W14 - Analog inputs enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.11W12 - High Sink I/O test enable/disable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.12W16, W17 and W18 - 7 seg Displays enable/disable . . . . . . . . . . . . . . . . . . . . . . . 112.9.13W1 - ICP Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.14W7 - I²C connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112.9.15JP11 - SPI Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
3 SOFTWARE DESCRIPTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.1 OPTION BYTE CONFIGURATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.2 MAIN MCU INITIALIZATION ROUTINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 COUNTERS AND USE OF TIMING RESOURCES . . . . . . . . . . . . . . . . . . . . . . 13
3.4 INTERRUPT SERVICE ROUTINES . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Introduction
3.5 MAIN PROGRAM ROUTINE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.6 OPERATING THE DEMOS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153.6.1 Running the LVD Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.6.1.1LVD Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183.6.2 Running the AVD Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.6.2.1AVD Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193.6.3 Running the CSS Demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3.6.3.1CSS Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 213.6.4 Running the High I/O current demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.6.4.1High Sink Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223.6.5 Running the IAP demo . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.6.5.1IAP Demo Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233.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
3/28
Safe ST7 Evaluation Board DESCRIPTION
2 SAFE ST7 EVALUATION BOARD DESCRIPTION
The Safe ST7 Evaluation Board is designed to support any of the SDIP32 package devicesfrom the ST72F264 family (ST72F264, 262, 260).
2.1 OVERVIEW
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 needevaluate the ST72F264 in other packages. Additional hardware functions can be implementedby 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 PushButtons
ResetButton
Buzzer
Three7-segmentsLEDs
VoltageTrimmer
ICP Connector
PA, PB & PC Ports
Connector SPI
Connector I²C
Output LEDs
MCU +Clock system
4/28
1
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
5/28
Safe ST7 Evaluation Board DESCRIPTION
2.3 POWER SUPPLY
This board is supplied with a PP3 9-volt battery demonstrating the board’s low power con-sumption. A complementary DC power supply input (ref. J1) is provided to supply the boardby external ( 9 to 13 Volt) power. When using this 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 EvaluationBoard 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, bymoving 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 thatpower 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 Voltage5 regulated VoltsW3
VDD Board
Variable Voltage5 regulated VoltsW3
5 regulated Volts selected Variable Voltage selected
RV1
6/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 entire 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 connectcable provided with the ST Programming Tool to the ICP connector "W2" and then power onthe board.Figure 4. How to use the ICP Connector
Crystal Resonator Internal RC oscillator External Clock
C4
C5W5
W4
C4
C5W5
W4C4
C5 W5
W4
XT1 XT1 XT1
12
910
Cable to ST Programming Tool
12
910
ICCDATAICCCLKRESETVPP
ICP Connector Pin assignment
OSC_CLK
W2 W2
ICP ICP
7/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 ofthe ST7 socket as shown in the following figure. The serial EEPROM may also be discon-nected and the I²C bus used for other communications.Figure 5. How to 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 pinsof 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.
SCLISDAI
U4
M24
C08
ST7 I²Cpins
W7
SCLISDAI I2
C
U4
M24
C08
ST7 I²CpinsI2
C
Install all the jumpers on the SPI connector. Remove the jumpers and use left connector side.
Using the On-board SPI EEPROM Using the SPI Bus
W 11
MISOSCK
SP
I
U5
M95
040
ST7 I²Cpins
MOSIPB3
W 11
MISOSCK
SP
I
U5
M95
040
ST7 I²Cpins
MOSIPB3
8/28
Safe ST7 Evaluation Board DESCRIPTION
2.8 I/O PORT FUNCTIONALITY
All I/O port pins are accessible through external connectors ( TP1 for port A, TP2 for port Band 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 ICCDATA.
The PA2 and PA3 pins are used to enable the U6 and U7 7-segment LED displays (useful formultiplexing).
The PA5 pin can be used to generate an external interrupt (ei0). It is connected to the groundvia the SW2 push-button switch .
The PA4 and PA6 pins alternate functions (SCLI and SDAI) are used for connecting an I²Ccommunication with the external I²C EEPROM.
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 canbe 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 SW3 push-button in order to generate anexternal interrupt (ei1).
PA0 ICCCLK In Circuit Communication ClockPA1 ICCDATA In Circuit Communication DataPA2PA3PA4 SCLI I²C ClockPA5 RDI SCI outputPA6 SDAI I²C DataPA7 TDO SCI input
PB0 ICAP1_A Timer A Input Capture 1 PB1 OCMP1_A Timer A Output Compare 1PB2 ICAP2_A Timer A Input Capture 2PB3 OCMP2_A Timer A Output Compare 2PB4 MOSI SPI Master Out Slave In DataPB5 MISO SPI Master In Slave Out DataPB6 SCK SPI Serial ClockPB7 SS SPI Slave Select
9/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 thelogic states programmed by port B to be output on the 8 LEDs.
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 thevoltage level of R13.
The PC5/AIN5 pin can be used through the W13 jumper as in analog input to measure theVREF 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 reference voltage selection
Refer to Section 2.3 POWER 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 componentsin the wire-wrap area.
2.9.4 W6 - MCU power consumption
This jumper is only for connecting to the MCU power supply. Its main purpose is to allow youto 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 PA5and PC0 pins respectively.
PC0 ICAP1_B / AIN0 Timer B Input Capture 1 Analog Input 0PC1 OCMP1_B / AIN1 Timer B Output Compare 1 Analog Input 1PC2 CLKOUT / AIN2 CPU Clock Out Analog Input 2PC3 ICAP2_B / AIN3 Timer B Input Capture 1 Analog Input 3PC4 OCMP2_B / AIN4 Timer B Output Compare 1 Analog Input 4PC5 EXTCLK_A / AIN5 Timer A External Clock Analog Input 5
10/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 ground through the resistor network. 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 jumpers are for measuring the Vref analog voltage and the voltage through R13. Re-moving them will disable those two features (The measurement of the VDD voltage value andthe 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-Circuit 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.
11/28
SOFTWARE DESCRIPTION
3 SOFTWARE DESCRIPTION
This part gives a short description of the whole program as a main routine that uses manyother 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 toolsuch 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 CSSOSC
TYPE1
OSC
TYPE0OSC
RNGE2OSC
RNGE1OSC
RNGE0PLL
OFF
1 0 0 0 0 1 1 1
WDGHALT WDG SW VD1 VD0 SEC1 SEC0 FMP R FMP W
0 1 0 1 1 1 0 0
12/28
SOFTWARE DESCRIPTION
3.2 MAIN MCU INITIALIZATION 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 High efficiency 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 inputs, 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 program includes the initialization code and an endless loop that processes thepushbutton inputs. In fact, after initialization and enabling interrupts, the main program willcontinue running in an infinite loop and wait for an external interrupt to switch to one of thedemo routines: (LVD, AVD/CSS, High Current I/O, IAP, Concurrent/ Nested Interrupts).
By default the program is in Halt mode (to reducing power consumption).
Warning: Disconnect the battery from its socket when the Safe ST7 EvaluationBoard is not in use.
13/28
SOFTWARE DESCRIPTION
Figure 7. Main program flowchart
Begin
Disable all Interrupts
MCU Initialization
I²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 DemoTest “MODE”
variable
: Program path/ PGM interrupt
Concurrent IT Demo
High Current Demo
Enter Halt Mode
This function is used for the AVD interrupt
14/28
SOFTWARE DESCRIPTION
3.6 OPERATING THE 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
Display “START “ Light-on LED 0
Display the VDD voltage
Display a counter 000..999 Light-on LED2
Display " LVD " Light-on LED 1
End
MCU in a HALT state
Push The PGM button
No
Push The PGM button
Yes
HALT Mode
Push The PGM button
Push the DEMO button
Yes
Push The PGM button
No
Push The PGM button
Display "AVD CSS " Light-on LED 2
No
Yes
button
Yes
No
Yes
No
No
Push The PGM button
No
No
Push The PGM button
YesYes
No
Yes
To next figure
Light-on LED1
LoL fLow Voltage Detector Demo
AVD and CSS Demo
Push the DEMO
15/28
SOFTWARE DESCRIPTION
Figure 9. Operations Flowchart (2)
Display "HIO" Light-on LED 3
Display the current inside the High Efficiency LED Light-on LED 3
Light-on the high efficiency Led
Display "IAP" Light-on LED 4
Push the MODE Button
Push the DEMO button
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²PROM Receive & Re-program
Score0 from the SPI E²PROM
Test XFlash memory
Display "TRANSFER" Light-on LED 4
Display "SCORE 0" Light-on LED 4
Score 1Score 0
First Time
Push The PGM button
To next Figure
Yes
No
Yes
High I/O Current Demo
In-Application Programming Demo
16/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 button
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 PGM 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 DEMO button
No
Display a lighting Sequence on LEDs
Yes
Yes
Yes
Concurrent Interrupts Demo
message
Yes
No
IT1
IT0
Nested Interrupts Demo
17/28
SOFTWARE DESCRIPTION
3.6.1 Running the LVD Demo
In LVD Demo state (see Figure 11), the user can switch between the two positions of W3 asdescribed in Section 2.3.
If the power goes below the LVD level, the microcontroller enters RESET state. At power-on,the program enters LVD demo mode (because an LVD reset was detected) and displays theVDD 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, doessome arithmetic to convert the digital value it has read to a voltage level and finally displaysthe 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 variable power supply. If the RV1trimmer is turned completely clockwise, the board is powered by 5.6 Volts. If the trimmer isturned 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 3FFX
-----------×=
press to reset
Battery
ST72F264
Potentiometer
LED1
move the jumper to right
onoff
SAFE ST7
Push to run the Demo
press until LED1 lights-on
EVALUATION BOARD
18/28
SOFTWARE DESCRIPTION
In power-on, if the trimmer is turned clockwise, the device will leave reset state and we cansee the VIT+ threshold on the display.
Note: the VIT- reference value for a voltage drop is lower than the VIT+ reference value forpower-on in order to avoid parasitic reset when the microcontroller starts running and sinkscurrent 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-segdisplay shows a counter that increments from 000 to 999.
To test the AVD capability:
– Disconnect the battery or decrease the VDD voltage 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 LVD feature, the Safe ST7 EvaluationBoard has an auxiliary voltage detector (AVD) with interrupt capability. In case of a drop involtage, 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 functionsonly if the LVD is enabled through option byte (see “Option byte configuration” on page 12).
19/28
SOFTWARE DESCRIPTION
Figure 12. AVD Demo Overview
In case of power drop, and before going into reset state, the AVD interrupt will save the lastdisplayed value in the external EEPROM (M24C08) using the I²C protocol. On power-on, thesoftware 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 countingas normal.
To cause a voltage drop, we can choose between two solutions as shown in the Figure 12.Thefirst method consists of moving the W3 jumper to the right, then decreasing the main voltageby turning the RV1 trimmer counter-clockwise. The second method consists of moving the W3jumper 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 AVDDemo” 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
onoff
press to reset
Battery
ST72F264
LED2
move the jumper to left
Disconnect the battery
press until LED2lights-on Push to
run the Demo
press until LED2 lights-on Push to
run the Demo
SAFE ST7EVALUATION BOARD
SAFE ST7EVALUATION BOARD
20/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 clock. To allow you to integrate secu-rity features in your application, it performs clock filter control and generates an interrupt incase of clock problems, while switching to an internal safe oscillator to allow the software tokeep running at a reduced speed. The safe oscillator of the CSS block is a low frequencyback-up clock source (around 3 Mhz). Figure 13. CSS Demo Overview
If the clock signal disappears, which you can provoke by disconnecting the two jumpers asshown in Figure 13, the safe oscillator delivers a low frequency clock signal (around 3MHz) fora safe oscillator period which allows the ST7 to save any critical data or perform any kind ofemergency operations while the CPU is still running.
The ST7 clock source switches back from the safe oscillator automatically if the original clocksource recovers. You can simulate this by replacing the clock jumpers. For more details referto 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 3Volts.
The program measures the value of the current in the LED using ADC analog input channel 4and 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 ST7EVALUATION BOARD
21/28
SOFTWARE DESCRIPTION
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 Sink Demo Description
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 sinkand sources a maximum (absolute rating) output current of 25mA, most ST7s include Highsink I/Os that can sink a current (absolute rating) output of up to 50mA. This allows you todrive 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 SPIcommunication 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 thedemo. It programs 16 bytes at a time.
For more details about XFLASH In-Application Programming refer to the ST7 FLASH Pro-gramming Reference manual.
As shown in Figure 15, you enter the IAP demo by pushing down the PGM button until LED4lights-up and the “IAP” message appears. Then you must push the DEMO button. During thistime 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
LED3
move the jumper to left
- + Push to run the Demo
SAFE ST7EVALUATION BOARD
22/28
SOFTWARE DESCRIPTION
Note: If you don’t want to enter 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 orderto listen to the music and verify that the data has been changed by IAP, you have to run thenested & concurrent interrupts demos.Figure 15. IAP Demo Overview
3.6.5.1 IAP Demo Description
The ST72F26x microcontroller family has a single voltage extended Flash (XFLASH) area thatcan be electrically erased and programmed either on a byte-by-byte basis or up to 32 bytes inparallel. In-Application Programming (IAP) allows you to update program memory contentswhen the device is already plugged on the application board, at minimum cost in terms ofadded components and board area impact.
This programming mode uses an IAP driver program which has been previously programmedin sector 0. This method is fully controlled by user software. This allows it to be adapted to theuser application (user-defined strategy for entering programming mode, 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 LED4lights-on
Push to run the Demo
SAFE ST7EVALUATION BOARD
23/28
SOFTWARE DESCRIPTION
0xB2 to 0xCE: IAP_driver storage area, (used only while the demo is running)
Sector1 Mapping (Reprogrammable Area)
0xE000 to 0xE00F: 16 spare bytes for testing
0xE010 to 0xE04F: (64 bytes) Music score1 (Software reprogrammable bytes)
0xE050 to 0xE08F: (64 bytes) Music score 2
0xE090 to 0xE14F: All other constantsFigure 16. IAP Demo flowchart
3.6.6 Running the Nested & Concurrent Interrupts demo
Most ST7 microcontrollers have two different interrupt management modes. The first is calledconcurrent mode and does not allow an interrupt to be interrupted, unlike the nested modewhere a software priority is given to each interrupt.
Begin
Test 0xE000 content
Display "TRANSFER"
First time the chip is plugged in
Init SPI
Send Score1&2 to M95040
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")
24/28
SOFTWARE DESCRIPTION
3.6.6.1 Nested & Concurrent Interrupts Demo DescriptionFigure 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 and IT1 interrupt service routines are assigned to external interrupt vectors ei0 andei1. You can trigger the interrupts directly by pressing the two push-buttons shown in Figure17:
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 theinterrupt 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 pushingthe DEMO button, IT0 won’t interrupt the IT1 routine and you have to wait for the end of musicbefore 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 youpush the PGM button, it will trigger the IT1 interrupt routine (music output). Before the end ofthe music you have to push the DEMO button in order abort the IT1 routine and service the IT0routine. When the program returns from IT0, it resumes playing the music from the pointwhere 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 ST7EVALUATION BOARD
SAFE ST7EVALUATION BOARD
25/28
Appendix 1: Safe ST7 Evaluation Board SCHEMATIC
4 APPENDIX 1: SAFE ST7 EVALUATION BOARD SCHEMATIC
CD1
100nF
C1
100µF
1 3
2
V V
GNDIN OUT
U1L7805D1
1N4004
D21N4004
RV110k
R4
1k
R54.7k
T12N2222
VCC
R24.7kC2
100µFCD2100nF
LD1
POWER
Z2
5V6
VCC
12
J1
BT1
R1470
Z12V4
123
W3
POWER SELECT
3
21
84
U2A
TS912
VREF
W2
PA0PA1PA2PA3PA4PA5PA6PA7
PB0PB1PB2PB3PB4PB5PB6PB7
PC0PC1PC2PC3PC4
12345678
TP1
12345678
TP2
12
TP4
VCC
12
TP5
GND
VCC
123456
TP3
PC5
26/28
Appendix 1: Safe ST7 Evaluation Board SCHEMATIC
R64.7k
SW1RESET
VCC
CD3100nF
XT1
4MhzC522pF
C422pF
R1027k
R927k
R11
100R12
100
VCC
VCC
VCC
CD7100pF
CD8100pF
PB6
PB4
PB5
12345678910
W1
ICP
VCCR310k
RESET
LD3
LD4
LD5
LD6
LD7
LD8
LD9
LD10
PB0
PB1
PB2
PB3
PB4
PB5
PB6
PB7
PB0PB1PB2PB3PB4PB5PB6PB7
PB0PB1PB2PB3PB4PB5PB6PB7
T3BC547
VCCCD4
100nFR74.7k
SW2DEMO
VCC
CD5100nF
R84.7k
SW3PGM CD6
100nF
EI0 EI1
R1310
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) 20PB0/ICAP1_A13
PB1/OCMP1_A12
PB2/ICAP2_A11
PB6/SCK5
PB4/MOSI7
PB5/MISO6
PB3/OCMP2_A10
PB7/ SS4
AIN1/OCMP1_B/PC1 18
AIN2/MCO/PC2 17PC3/ICAP2_B/AIN316
PC4/OCMP2_B/AIN415
PC5/EXTCLK_A/AIN514
OSC12
OSC23
RESET1
VPP/TEST 30
VDD 32
NC8
NC9
VSS 31
AIN0/ICAP1_B/PC0 19
NC 24
NC 25
U3
ST72F264
123
W5
123
W4
R161k
W16 R15
4.7kPA2
W15
Leds enable
R14
4.7kPC2
T4BC547
R181k
W17 R17
4.7kPA3
VCC
W14
W13VREF
BZ1
Buzzer
W10
W6 IDDVCC
W9
W8
SS1
D5
Q2
W 3
HOLD 7
C6
VC
C8
VSS
4
U5
M95040
PC2
E0 1
E1 2
E2 3
SDA5
SCLK6
WC 7
VC
C8
VSS
4
U4
M24C08
VPP
ICCCLK
ICCDATA
VPP
ICCDATA
PA3
PA2
ICCCLK
W12
23456789
1
RS1
1k
1 23 4
W7
I2C
76421
1095
3 8
U8
PB0PB1PB2PB3PB4PB5PB6PB7
76421
1095
3 8
U6
76421
1095
3 8
U7
T5BC547
R201k
W18 R19
4.7kPC3
PB7
PB6
PB5
PB4
PB3
PB2
PB1
PB0
PC3
PC5
PC4
PC3 PC2
PC1
PC0
PA7
PA6
PA5
PA4
PA3
PA2
1 23 45 67 8
W11
SPI
PB3
C3
100pF
PA0
PA1
PA4
PA6
PA1
PA0
RV2
I/O Test
27/28
Appendix 1: Safe ST7 Evaluation Board SCHEMATIC
THE SOFTWARE INCLUDED IN THIS NOTE IS FOR GUIDANCE 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 and reliable. However, STMicroelectronics assumes no responsibility for the consequencesof use of such information nor for any infringement of patents or other rights of third parties which may result from its use. No license is grantedby implication or otherwise under any patent or patent rights of STMicroelectronics. Specifications mentioned in this publication are subjectto change without notice. This publication supersedes and replaces all information previously supplied. STMicroelectronics products are notauthorized for use as critical components in life support devices or systems without 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 conveys a license under the Philips I2C Patent. Rights to use these components in an I2C system is granted provided that the system conforms to the I2C Standard Specification as defined by Philips.
STMicroelectronics Group of CompaniesAustralia - Brazil - 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
28/28