UM0307 User manual
STE12PS I2C controller GUI
Introduction
The STE12PS controller GUI software (referred to as the GUI) allows the operator to read and write all Ste4ps or STE12PS registers via their I2C bus. The main functions of the GUI are:
reads and writes all registers of the device processes basic script files containing only read and write register commands processes advanced script files that allow loops and conditional execution
November 2006
Rev 1
1/19
www.st.com
Contents
UM0307
Contents
1 2 3 Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Hardware configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 GUI overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3. 1 3.2 Status summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 GUI tab pages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 Star t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Measures configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 A/D converters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 REG 00-3F...REG C0-FC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
4
Script files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4. 1 4. 2 Basic script files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Advanced script files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
5
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
2/19
UM0307
Installation
1
Installation
The GUI software runs on Windows 98 and later Microsoft operating systems. However, prior to running the GUI executable, the PC must be prepared by installing Microsoft .NET Framework Version 1.1 Redistributable Package. This is a single file (dotnetfx.exe) that can be downloaded from the following Microsoft website:
http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157034D1E7CF3A3&displaylang=en
Once .NET support is installed, the STE12PS.exe executable file can be copied to a directory on a PC with the files dlportio.dll and ScriptingHelp.rtf. (The dlportio.dll is required to allow control over the LPT1 parallel port. The required driver to support dlportio.dll can be installed by executing port95nt.exe, which is available from http://www.driverlinx.com/DownLoad/DlPortIO.htm.) It can be run either by selecting it from Windows Explorer or by creating a desktop link to the executable and clicking on the link icon.
3/19
Hardware configuration
UM0307
2
Hardware configuration
The GUI communicates to the test device through the parallel port on a PC. The parallel port is assumed to be connected to the target device with four control or data lines and ground. The control lines are as follows.
SCL: parallel port data register bit 2 (pin 4) connected to device SCL signal SDA IN: parallel port data register bit 1 (pin 3) connected to device SDA In signal SDA OUT: parallel port status register bit 5 (pin 12) connected to device SDA Out signal INTn: parallel port status register bit 4 (pin 13) connected to device INTn signal Ground: parallel port pins 18-25 connected to development board ground
Figure 1 describes the parallel port pinouts.
Figure 1. Parallel port pinouts
The parallel port address for LPT1 on most PCs is 0x0378. However, you can determine the parallel port base address on your PC in Windows 2000 by using Settings > Control Panel > System > Hardware > Device Manager > Ports (COM & LPT) > Printer Port(LPT1) > Resources. The parallel port can be set via the GUI parallel port base address field.
4/19
UM0307 Figure 2. Start TAB page
Hardware configuration
If the PC is communicating with board the start window and the status window appear. If any communication error appends, the error window appears. Figure 3. Error window
In this case please verify the parallel cable. Sometime it is possible to get the board communication tray with a different value of the parallel delay value.
5/19
GUI overview
UM0307
3
3.1
GUI overview
Status summary
Figure 4. Status summary window
A status display option is available to show a status summary of all channels, plus battery voltage, thermal level, and power consumption. The status of all channels is displayed with colored LED images in a separate window from the main GUI window. Status is updated at approximately 250 msec intervals unless updates have been paused with the Pause button. Different colored LEDs indicate the following:
ared LED indicates a warning a green LED indicates nominal operation a white LED indicates either that no operation is underway or that status is unknown a yellow LED indicates any other status
3.2
GUI tab pages
The GUI is organized into multiple tab pages as shown in the following figures. Related registers are assigned to the same tab page. The pages are as follows.
3.2.1
Start
Allows the operator to execute script files, perform basic register I/O, and specifiy the parallel port address and I2C device address. See Figure 2: Start TAB page on page 5.
6/19
UM0307
GUI overview
3.2.2
Configuration
Breaks out the bit fields associated with the global configuration registers, device address, and soft reset register. Figure 5. Configure tab
7/19
GUI overview
UM0307
3.2.3
Channels
Shows all bit fields associated with a specific device channel. The operator can select a different channel using the buttons along the top of the page. Figure 6. Channel tab
8/19
UM0307
GUI overview
3.2.4
Interrupts
Shows all bit fields associated with the interrupt registers. Figure 7. Interrupts tab
9/19
GUI overview
UM0307
3.2.5
Measures configuration
Shows all bit fields associated with a measures configuration. Figure 8. Measure configuration tab
10/19
UM0307
GUI overview
3.2.6
A/D converters
Shows all bit fields associated with the A/D converters. Figure 9. A/D converters tab
11/19
GUI overview
UM0307
3.2.7
REG 00-3F...REG C0-FC
Shows registers 00 through 3F as a hexadecimal byte value. The value can be read by clicking the R button next to each register, and written by pressing enter in the byte value text field. Figure 10. REG C0-FC TAB
The other REG XX-XX contains the register values for the remaining registers.
12/19
UM0307
Script files
4
4.1
Script files
Basic script files
Script files can be executed using the run script button on the GUI. Basic script files are very simple and allow only three commands. Advanced script files allow more complex commands. The allowed commands in a basic script file are as follows:
w RR DD # Write hex data DD to hex register number RR r RR # Read hex register number RR delay N # Delay the specified number of milliseconds (N is a decimal value) # Comments can be entered in this format
For example:
# Read register 0x1C r 1c # Delay 200 msecs delay 200 # Write register 0x35 with data 0xAB w 35 AB
4.2
Advanced script files
Advanced script files support procedures, loops, and if constructs. These script files run in their own thread of execution, allowing the operator to perform other GUI operations while a script is executing. The STE12PSController software recognizes a script as an advanced script file if it contains a ! character as the first character in the file: ! Advanced script files must start with an exclamation point Global variables are declared and initialized outside of proc (procedure) blocks. An initialization value is optional. All variables are stored internally as 32-bit integers. Comments start with a # character and can be placed at the end of a line of code:
var reading # Default initialization value is 0 var constantValue = 0x123 # This is an example of a hex value var SCALER = 37 # This is an example of a decimal value
Procedures start with proc and end with endproc. They can accept numeric input parameters, but cannot return results. The user can use global variables if necessary to return values to the caller. Parameters act as local variables inside the procedure, but additional local variables can be defined with var statements, similar to global variables.
Note:
All operators and variables need to be surrounded by white space (var x=3 is incorrect, use var x = 3).
# Three values are passed to this procedure: proc SampleProc parm1 parm2 parm3 var xxx
13/19
Script files var yyy = 2 xxx = parm3 parm3 = yyy endproc When the script is executed, the main procedure is invoked. There must be a main procedure in each script file: # A procedure called "Main" must always be defined proc Main ... endproc
UM0307
Procedures can be called using the call command. Either variables or constants can be passed as parameters to the procedure: call SampleProc 12 0x0123 value Loops are supported with loop ... while statements. A condition must be of the form X operator Y, where X and Y can be variables or constants, and operator can be any of the following: ==, !=, <, >, <=, >=, or any of the arithmetic and logical operators +, -, *, /, %, &, |, ^, <<, >>. Any non-zero value resulting from an arithmetic or logical operation will be considered TRUE, and a zero value will be considered False: var quit var value loop read 0x33 value if value & 0x02 quit = 1 endif while quit == 0 # Or "while value & 0x02", etc.
if statements use the same format as loop statements. For example: if value1 < value2 ... endif Arithmetic operations must be very simple. All variables and operators need white space on their left and right. Only one operation is allowed per line of code. If the operator needs to do x = ( y + 3 ) * 7 then the following can be used: var x var y = 5 ... x=y+3
14/19
UM0307 x = x * 0x07
Script files
Messages can be output to the user in one of two ways: printf writes to the GUI message box, and messagebox opens a dialog box that prompts the user for a response. The format of both of these commands is the same. Up to six parameters can be entered. The format specification for a value is "{index,fieldwidth:base}": printf "Reg#{0,2:D} = {1,2:X}" reg value
messagebox "Value not read after {0,2:D} tries" count Register read and write are done with read and write : read reg value write 0x33 0x20 readinterrupt value read|write # Read "value" from register "reg" # Write 0x20 to register 0x33 # Get interrupt status from most recent
Time delays can be specified in milliseconds using the following command: delay 500 # Delay for 500 msecs
The program can be aborted using the exit statement. A quoted comment is optional: exit Comment
Figure 11 and Figure 12 provide an example of an advanced script file.
15/19
Script files Figure 11. Advanced script file 1
! Advanced script files must start with an exclamation point # Create and initialize all global variables. If no initialization # value is specified, the variable will be initialized = 0. var var var var TRUE = 1 FALSE = 0 CONTROLREG1 = 0x03 CONTROLREG2 = 0x04
UM0307
# # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ##### # DisplayReg -- This procedure reads a register and displays the # value in the GUI's message box. # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ##### proc DisplayReg reg var value read reg value printf "Reg#{0,2:D} = {1,2:X}" reg value endproc # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ##### # WaitForReady -- This procedure waits for a bit to change in a # register. # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ##### proc WaitForReady var value var quit = FALSE var cnt loop # Read the control register until ready bit is set
read CONTROLREG1 value if value & 0x20 quit = TRUE endif printf "Waiting for ready status ..." delay 500 cnt = cnt + 1 if cnt > 5 quit = TRUE endif while quit == FALSE # If not ready after 5 tries, stop and prompt the operator value = value & 0x20 if value == 0x00 messagebox "Ready failed after 5 tries" endif endproc
16/19
UM0307 Figure 12. Advanced script file 2
# # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ##### # Main -- This procedure is the first procedure executed in the # script file. It demonstrates many of the scripting capabilities. # # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ## # ##### proc Main # Define and initialize local variables var value var reg = 0 var shift = 2 call WaitForReady # Demonstrate some arithmetic and logical functions value = 0x01 << 12 printf "Demo Value1 (0x1000) = {0,4:X}" value value = value >> shift printf "Demo Value2 (0x0400) = {0,4:X}" value value = value * 3 # Display some register values call DisplayReg 0x03 call DisplayReg CONTROLREG2 loop # Display the first 5 registers, slowly call DisplayReg reg delay 200 reg = reg + 1 while reg < 5 if reg == 5 messagebox "End -- Pause and wait for operator to continue" endif endproc
Script files
17/19
Revision history
UM0307
5
Revision history
Table 1.
Date 24-Nov-2006
Document revision history
Revision 1 Initial release. Changes
18/19
UM0307
Please Read Carefully:
Information in this document is provided solely in connection with ST products. STMicroelectronics NV and its subsidiaries ("ST") reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described herein at any time, without notice. All ST products are sold pursuant to ST's terms and conditions of sale. Purchasers are solely responsible for the choice, selection and use of the ST products and services described herein, and ST assumes no liability whatsoever relating to the choice, selection or use of the ST products and services described herein. No license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. If any part of this document refers to any third party products or services it shall not be deemed a license grant by ST for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoever of such third party products or services or any intellectual property contained therein.
UNLESS OTHERWISE SET FORTH IN ST'S TERMS AND CONDITIONS OF SALE ST DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY WITH RESPECT TO THE USE AND/OR SALE OF ST PRODUCTS INCLUDING WITHOUT LIMITATION IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE (AND THEIR EQUIVALENTS UNDER THE LAWS OF ANY JURISDICTION), OR INFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT. UNLESS EXPRESSLY APPROVED IN WRITING BY AN AUTHORIZED ST REPRESENTATIVE, ST PRODUCTS ARE NOT RECOMMENDED, AUTHORIZED OR WARRANTED FOR USE IN MILITARY, AIR CRAFT, SPACE, LIFE SAVING, OR LIFE SUSTAINING APPLICATIONS, NOR IN PRODUCTS OR SYSTEMS WHERE FAILURE OR MALFUNCTION MAY RESULT IN PERSONAL INJURY, DEATH, OR SEVERE PROPERTY OR ENVIRONMENTAL DAMAGE. ST PRODUCTS WHICH ARE NOT SPECIFIED AS "AUTOMOTIVE GRADE" MAY ONLY BE USED IN AUTOMOTIVE APPLICATIONS AT USER'S OWN RISK.
Resale of ST products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by ST for the ST product or service described herein and shall not create or extend in any manner whatsoever, any liability of ST.
ST and the ST logo are trademarks or registered trademarks of ST in various countries. Information in this document supersedes and replaces all information previously supplied. The ST logo is a registered trademark of STMicroelectronics. All other names are the property of their respective owners.
2006 STMicroelectronics - All rights reserved STMicroelectronics group of companies Australia - Belgium - Brazil - Canada - China - Czech Republic - Finland - France - Germany - Hong Kong - India - Israel - Italy - Japan Malaysia - Malta - Morocco - Singapore - Spain - Sweden - Switzerland - United Kingdom - United States of America www.st.com
19/19
|