ST AN1754 Application note

AN1754

APPLICATION NOTE

DATA LOGGING PROGRAM FOR TESTING

ST7 APPLICATIONS VIA ICC

by Microcontroller Division Application Team

INTRODUCTION

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 on the ICC protocol1).

Over a specified time period, the data logging system records each and every value of a particular variable or register used by the application. The 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 provided with this application note. The PC software uses the STVP72) DLLs for communicating via the ICC Protocol between a PC-based data logging system and the user application. It can be used for ST7 devices supported by the STICK, i.e. ST7 devices supporting ICC protocol except the USB 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.

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 (ST7 EPB’s and ST7 STICK). For more information on ST7 Development Tools refer to http://mcu.st.com.

Rev. 1.0

AN1754/1103

1/19

DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC

1 SYSTEM HARDWARE AND SOFTWARE REQUIREMENTS

The hardware interface between the parallel port and the ICC (HE10) connector is the ST7 STICK. A block diagram of the set-up is shown in Figure 1.

Figure 1. Data Logging hardware setup

PC COMPUTER

 

 

 

STVP7 DLL

 

 

 

 

ST7 STICK

ICC(HE10)

ST7

PARALLEL PORT

APPLICATION

 

(ICC ADAPTER)

INTERFACE

BOARD

 

 

 

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 compilers. The software has been tested with the A/D converter application on the ST72F264 and ST72F521. The ICC monitor embedded in the ST72F264 is the advanced variant (it has additional commands), the ICC monitor embedded in ST72F521 is the basic variant. The software example works with both variants.

The process of data logging developed in this application takes advantage of the fact that even when the ST7 is in ICC mode, it can execute the user code programmed in Flash memory as well as the ICC commands embedded in BootROM/Sysmem.

2/19

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 STVP7 software. It can handle all the ST7 devices supporting ICC protocol, except the 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 application 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 note that this package is compatible with STVP7 1.9.0 and uses the system 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 STVP7 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

OVERWRITE PC AT BOTTOM

OF ST7 STACK WITH

APPLICATION START ADDRESS

EXECUTE ICC GO COMMAND

RECEIVE A BYTE OF DATA

FROM ST7 AND STORE IN FILE

 

 

 

 

USER

No

HIT ANY

 

 

KEY?

 

Yes

STOP

After entering ICC mode, the PC software modifies the ST7 stack so that the position corresponding to the Program Counter contains the address of the user application. Hence, the execution 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 send 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 medium 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

ST AN1754 Application note

DATA LOGGING PROGRAM FOR TESTING ST7 APPLICATIONS VIA ICC

Figure 3. ST7 Software Execution

 

Basic ICC Monitor Variant

Medium/Advanced ICC Monitor Variant

 

ICC Mode Entry

ICC Mode Entry

 

Basic ICC Monitor

Medium/Advanced

 

 

Go

 

ICC Monitor

 

Go

 

 

 

ST7 Application

ICC SendByte

 

 

Routine

 

Return

Call

Call

Return

 

 

 

ICC SendByte

ST7 Application

 

Routine

 

= 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 software is synchronized with the external controller using the ICC 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