Data logging is the process of recording data. It is required during the course of application development in order to test application robustness and reliability.
The purpose of this application note is to show how to implement a data logging system based
1)
on the ICC protocol
Over a specified time period, the data logging system records each and every value of a par-
ticular variable or register used by the application. T he advantage of using this ICC-based
data logging package is that your application runs on the ST7 in its target environment, with
the same hardware configuration and settings and with minimal added software.
An ST7 application software example and the PC side executable are pr ovided with thi s application note. The PC software uses the STVP7
between a PC-based data logging system and the user applic ation. It can be used for ST 7 devices supported by the STICK, i.e. ST7 devices supporting ICC protocol except the U SB family
devices.The ST7 software provided is an example which can be modified and used, or a completely new software may be developed by the user.
.
2)
DLLs for communicating via the ICC Protocol
1)
The ICC protocol (In-Circuit Communication) is used to connect ST7 micro controllers with
an external controller such as a flash programmer or in-circuit debugger. It is described in detail in the ST7 ICC Protocol Reference Manual.
2)
STVP7 (ST7 Visual Programmer) is the Windows software interface for ST7 Flash Programming Tools (S T7 EP B’s a nd ST7 S TIC K). Fo r mo r e inf orma ti on on S T7 Developm ent T ools
refer tohttp://mcu.st.com.
Rev. 1.0
AN1754/11031/19
1
DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC
1 SYSTEM HARDWARE AND SOFTWARE REQUIREMENTS
The hardware interfa ce betwe en the para llel port and th e ICC (H E10) co nnector i s the ST7
STICK. A block diagram of the set-up is shown in Figure 1.
Figure 1. Data Loggi ng hardware setup
PC COMPUTER
STVP7 DLL
ST7
APPLICATION
BOARD
PARALLEL PORT
ST7 STICK
(ICC ADAPTER)
ICC(HE10)
INTERFACE
The PC software has been developed using the Microsoft Visual C++ 6.0 environment and the
ST7 software example is compatible with both Cosmic and Metrowerks C c ompilers. The s oftware has been tested with the A/D converterapplicationon the ST7 2F264 a nd ST72 F52 1.
The ICC monitor embedded in the ST72F 264 is the ad vanced variant (it has add itional commands), the ICC monitor em bedded in ST72F521 is the basic variant. The software ex am ple
works with both variants.
The process of data logging developed in this application takes advantage of the fact that
even when th e ST7 is in ICC m ode, it can exec ute the user co de program med in Flash
memory as well as the ICC commands embedded in BootROM/Sysmem.
2/19
2
DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC
2 PC SOFTWARE
The software on the PC side has been created in Microsoft Visual C++ 6.0 re-using DLLs from
the STVP 7 soft ware. It can ha ndle all the ST7 d evice s suppo rting IC C prot ocol, e xcept t he
USB family devices. Prior to running the PC software, you must install STVP7 on your PC and
program your device with your application code and the option bytes. The executable for the
PC software has been provided. When you execute this file, you will be prompted for certain
parameters.Section 4 of this applic ation note describes these parameters, two of which determine whether the data logging process is to be performed with the option bytes enabled or disabled. Make sure that the ST7 is driven by the clock source corresponding to this selection.
Please not e that this packag e is comp atible w ith STVP7 1.9.0 an d uses the syste m drivers
corresponding to this version. In case the version of STVP7 installed on your system is a different one, please replace the dll files with the corresponding ones from the STV P7
folder(..\stm\st7toolchain\stvp7).
The PC software flowchart is given in Figure 2.
3/19
DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC
Figure 2. PC software flowchart
GET USER OPTION BYTE
MODE SELECTION
INITIALIZE PARALLEL PORT
OVERWRIT E PC AT BOTTOM
OF ST7 STACK WITH
APPLICATION START ADDRESS
EXECUTE ICC GO C OMMAND
RECEIVE A BYTE OF DATA
FROM ST7 AND STOR E IN FILE
USER
No
HIT ANY
KEY?
Yes
STOP
After entering ICC mode, the PC softw are mo difies the ST 7 stack s o th at the position c orresponding to the Program Counter contains the address of the user application. Hence, the ex ecution of the Go command has the effect of jumping to the user application and executing it.
The external controller software then loops to receive bytes till the keyboard is hit. The bytes
received are stored in the file “Datafile.doc” in the PC_application folder.
4/19
DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC
3 ST7 SOFTWARE
The PC application performs the initialization and starts execution of the ST7 application. At
this point, your ST7 application has to s end the data bytes to the PC. The method you use depends on the variant of the ICC monitor in the ST7 device because some ICC commands are
available only in the medium or extended variant and not in the basic variant. Please refer to
theST7 ICC Protocol Reference manual for the table listing ST7 devices with the ICC monitor
variant embedded in each type.
If the device chosen has a m edium or advanced variant ICC monitor, you can just call the
ICC_Send_Byte routine at the address provided in the ICC Protocol Reference manual. If the
device has a basic ICC monitor, the send byte routine needs to be coded as part of your application. The sample program provided with this application note includes a send byte routine
which you can use.
The software provided can be configured to support devices with any ICC monitor variant.
The ST7 software execution is given in Figure 3.
5/19
DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC
Figure 3. ST7 Software Execution
Basic ICC Monitor Variant
ICC Mode Entry
Basic ICC Monitor
Go
ST7 Application
Call
ICC SendByte
Routine
Return
Medium/Advanced IC C Monitor Variant
ICC Mode Entry
Medium/Advanced
ICC Monitor
Go
ICC SendByte
Routine
Call
Return
ST7 Application
= ST7 System Memory
Basically, you can run an ST7 application and call the Send byte routine whenever you want
to “note” a particular variable/register. The PC receives the data and stores it in a file named
Datafile.doc whose size is only limited by the amount of PC memory. This method can be used
to store data over long periods of time to be examined and analysed later.
Essentially, the ST7 sof tware i s synchroni zed w ith the ex ternal control ler using th e IC C protocol. Once the user stops the external controller, the device stops sending bytes since it does
not get the desired response from the external controller.
6/19
Loading...
+ 13 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.