Basic On System Test Code Controlled Via Hyper Terminal/MTTTY - description

Application Note, V1.0, Oct. 2008
AP16151
XC2000/XE166
Basic on System Test Code Controlled Via
Hyper Terminal/MTTTY
Microcontrollers
Edition 2008-11-20
Published by
Infineon Technologies AG
81726 München, Germany
© Infineon Technologies AG 2008.
All Rights Reserved.
LEGAL DISCLAIMER
THE INFORMATION GIVEN IN THIS APPLICATION NOTE IS GIVEN AS A HINT FOR THE
IMPLEMENTATION OF THE INFINEON TECHNOLOGIES COMPONENT ONLY AND SHALL NOT BE
REGARDED AS ANY DESCRIPTION OR WARRANTY OF A CERTAIN FUNCTIONALITY, CONDITION OR
QUALITY OF THE INFINEON TECHNOLOGIES COMPONENT. THE RECIPIENT OF THIS APPLICATION
NOTE MUST VERIFY ANY FUNCTION DESCRIBED HEREIN IN THE REAL APPLICATION. INFINEON
TECHNOLOGIES HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND LIABILITIES OF ANY KIND
(INCLUDING WITHOUT LIMITATION WARRANTIES OF NON-INFRINGEMENT OF INTELLECTUAL
PROPERTY RIGHTS OF ANY THIRD PARTY) WITH RESPECT TO ANY AND ALL INFORMATION GIVEN
IN THIS APPLICATION NOTE.
Information
For further information on technology, delivery terms and conditions and prices please contact your nearest
Infineon Technologies Office (www.infineon.com).
Warnings
Due to technical requirements components may contain dangerous substances. For information on the types
in question please contact your nearest Infineon Technologies Office.
Infineon Technologies Components may only be used in life-support devices or systems with the express
written approval of Infineon Technologies, if a failure of such components can reasonably be expected to
cause the failure of that life-support device or system, or to affect the safety or effectiveness of that device or
system. Life support devices or systems are intended to be implanted in the human body, or to support
and/or maintain and sustain and/or protect human life. If they fail, it is reasonable to assume that the health
of the user or other persons may be endangered.
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
AP16151
Revision History:
Previous Version:
Page
2008-10
none
Subjects (major changes since last revision)
V1.0
We Listen to Your Comments
Any information within this document that you feel is wrong, unclear or missing at all?
Your feedback will help us to continuously improve the quality of this document.
Please send your proposal (including a reference to this document) to:
[email protected]
Application Note
3
V1.0, 2008-10
AP1615116151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Table of Contents
Page
1
1.1
1.2
Introduction ...................................................................................................................................5
Purpose ...........................................................................................................................................5
Scope ..............................................................................................................................................5
2
2.1
2.2
2.3
Hardware Setup.............................................................................................................................6
System Requirements For Target Board ........................................................................................7
Start Up ...........................................................................................................................................7
Initial Condition Of The Test Code..................................................................................................7
3
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
Usage..............................................................................................................................................8
Output Command............................................................................................................................8
IO Config Command .......................................................................................................................8
Read Input Command .....................................................................................................................8
Toggle Output Command................................................................................................................8
ADC Read Command .....................................................................................................................8
Measure Frequency ........................................................................................................................9
Read The Memory Location / SFR .................................................................................................9
Write To The Memory Location / SFR ............................................................................................9
External Xtal ....................................................................................................................................9
Help .................................................................................................................................................9
4
Script Files ...................................................................................................................................10
5
Glossary .......................................................................................................................................12
6
Appendix ......................................................................................................................................13
Application Note
4
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Introduction
1
Introduction
This application note describes how to setup and use the XC2000/XE166 test code. This test code is useful
for new HW prototype especially when actual code is not available. It is benefit for the system engineer or
hardware engineer to verify basic microcontroller functionality and continuity tests of their board. The code is
controlled via Hyperterminal or MTTTY. The test code is able to:
•
•
•
•
•
•
•
•
•
Configure the Port Pins to Input or Output
Set any Port Pin to High or low
Read any Port Pin
Toggle any Port Pin to certain frequencies
Read all the ADC channels
Measure frequency
Read 16 bits data from any address (full Memory Map)
Write 16 bits data to any address (full Memory Map)
Enable the external crystal oscillation
As different projects would have different Pin configuration, a script loading method is provided to load and
initialize the pins to Input or Output and set the initial Output value.
1.1
Purpose
The purpose of this note is to introduce the features, setup and use of the test code.
1.2
Scope
This note addresses the following requirement and features
• Hardware System setup
• Communication Protocol and requirement
• Initial condition of the system
• System Requirement
• Start up
• Usage of the commands
• Script loading
This note is applicable for 100pins and 144pins package of XC22xx, XC23xx, XC27xx and XE16x family
which include:
• xxx-XC2x6x-xxFxxL-xx, xxx-XC2x8x-xxFxxL-xx,
• xxx-XC226xM-xxFxxL-xx, xxx-XC228xM-xxFxxL-xx
• xxx-XC236xA-xxFxxL-xx, xxx-XC238xA-xxFxxL-xx
• xxx-XC2765X-xxFxxL-xx, xxx-XC2785X-xxFxxL-xx
• SAF-XE167x-xxFxxL-xx, SAF-XE167xM-xxFxxL-xx
• SAF-XE164x-xxFxxL-xx, SAF-XE164xM-xxFxxL-xx
Application Note
5
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Hardware Setup
2
Hardware Setup
The test code makes use of the ASC protocol to perform the testing. USIC0 channel 0 is assigned for
communication. The test code supports LIN or RS232. However, the protocol has to be in ASC. The protocol
setup is as follows: UART / ASC, 19200bps, No parity, 8 bits, 1 stop bit., No HW/software flow control. If the
design already has a LIN transceiver then LIN can be used for communication with a LIN to RS232
transceiver .If not, ASC to RS232 transceiver is recommended. See Appendix for recommended schematics
of these.
Figure 1
Test Setup Using ASC
Figure 2
Test Setup Using LIN
Application Note
6
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Hardware Setup
2.1
System Requirements for Target Board
The Target board shall support the ASC Boot mode (USIC0 channel 0, P7.3/P7.4)
A) Bootstrap loader Startup Configuration for –xxx-XC2xxx-xxFxxL-xx and SAF-XE16xx-xxFxxL-xx.
P10.0 = 0, P10.1 = P10.2 = 1, P10.3 /TRST = X
B) Bootstrap loader Startup Configuration for –xxx-XC22xxM-xxFxxL-xx,
–xxx-XC23xxA-xxFxxL-xx, –xxx-XC27x5X-xxFxxL-xx and SAF-XE16xxM-xxFxxL-xx.
P10.0 = 0, P10.1 = P10.2 = 1, TRST = 1
2.2
Start Up
Use the MEMTools to load the test software. For details, please refer to the XC2000/XE166 Easy Kit User
Manual, or use the debugger through JTAG to load the test software.
The system clock of test software is initially running at 10 MHz from PLL locking on the internal clock source
OSC_LP (5MHz). The “X” command is to switch the clock source from OSC_LP to the external crystal Osc.
After configure and connection to the Hyper Terminal or MTTTY with test software, the following message
should be sent out from the board under test.
Figure 3
Hyper Terminal Screen.
2.3
Initial Condition of the Test Code
•
•
•
•
All IO is set as Input (the same as the HW reset settings)
All ADC channels are enabled
The system clock is running at 10MHz from PLL locking on the internal clock OSC_LP (5MHz)
P7.3 and P7.4 are configured for ASC protocol for 100pin and 144pin package
Application Note
7
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Usage
3
Usage
3.1
Output Command
O Port Pin State
Port - Port number
Pin - Pin number
State 1: High , 0: Low
E.g. O 10 0 1 Set port 10 Pin 0 to High
3.2
IO Config Command
C Port Pin 0/1
Port - Port number
Pin - Pin number
0/1 - 1 – Input, 0 – Output
E.g. C 10 0 0 Configure port 10 Pin 0 to Output
3.3
Read Input Command
I Port Pin
Port - Port number
Pin - Pin number
E.g. I 10 0 Read the Port 10 Pin 0 state
3.4
Toggle Output Command
T Port Pin time multiply by 5ms
Port - Port number
Pin - Pin number
Time – time for toggle
E.g. T 10 0 10 Toggle the Port 10 Pin 0 at every 50ms
3.5
ADC Read Command
A Module Channel
Module – Module 0, or 1
Channel - Channel number
E.g. A 0 15 Read the ADC value of Module 0, Channel 15
Module 0, channel 0, adc 0x02b2 (3369 mV)
Application Note
8
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Usage
3.6
Measure Frequency
F Port Pin
Port - Port number
Pin - Pin number
E.g. F 0 1 Read the Duty, Freq, Period of the selected Pin
Duty Cycle 49.99(percent), Period 99988.53(us), Freq 10.00(Hz)
Remark: As the measurement method is using polling, the accuracy of high frequencies may not be good.
This just provides a rough estimation.
3.7
Read the Memory Location / SFR
R address
Address – Full range of Memory map
E.g. R C00000 Read the Flash location 0xC00000
E.g. R E820
Read P1 IOCR register
3.8
Write to the Memory Location / SFR
W address value
Address – Full range of Memory map
Value – 16bit data
E.g. W E940 0080
Write P10_IOCR00 register with 0x80
Remark: 1) The Flash area is not able to be written
3.9
External Crystal
X - Switch the system clock source to the external crystal Osc. (May use the Oscilloscope to probe the
XTAL1 and XTAL2 pins to verify)
3.10
Help
H – Display the Menu
Application Note
9
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Script Files
4
Script Files
Script files are used to set pin configurations for different designs. Here is an example to configure P10.0 to
P10.7 as outputs, set port pins to 1 and toggle alternate pins in 500msec and 1000msec via ASC or LIN.
Remark: ADC Read “A” and Measure Freq “F” commands are not supported in Script Files
Here is the script example to toggle P10.0 to P10.7
# Start
c 10 0 0
c 10 1 0
c 10 2 0
c 10 3 0
c 10 4 0
c 10 5 0
c 10 6 0
c 10 7 0
O 10 0 1
O 10 1 1
O 10 2 1
O 10 3 1
O 10 4 1
O 10 5 1
O 10 6 1
O 10 7 1
t 10 0 100
t 10 1 200
t 10 2 100
t 10 3 200
t 10 4 100
t 10 5 200
t 10 6 100
t 10 7 200
! End
Application Note
10
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Script Files
Scripts can be loaded using Hyperterminal or MTTTY.
Figure 4
Loading Scripts with Hyper Terminal.
Figure 5
Loading Scripts with MTTTY.
Application Note
11
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Glossary
Figure 6
Success of loading Scripts with MTTTY.
5
Glossary
SFR
ADC
ASC
USIC
RS232
UART
LIN
Application Note
Special Function Register
Analog to Digital Converter
Asynchronous Serial Channel
Universal Serial Interface Channel
Recommended Standard 232
Universal Asynchronous Receiver/Transmitter
Local Interconnect Network
12
V1.0, 2008-10
AP16151
Basic on System Test Code Controlled Via Hyper Terminal/MTTTY
Appendix
6
Appendix
Figure 7
LIN to RS232 Transceiver Schematic.
Figure 8
ASC to RS232 Transceiver Modified From LIN to RS232 Transceiver
Application Note
13
V1.0, 2008-10
http://www.infineon.com
Published by Infineon Technologies AG
Similar pages