XC2287M HOT

XC2287M HOT
Solution GPT12
Uses a timer triggered LED’s to toggle
Device: XC2287M-104F80
Compiler: Tasking Viper 2.4r1
Code Generator: DAvE 2.1
XC2287M HOT Exercise GPT12
Hardware Triggering of GPT12
Let’s
Let’s get
get started
started now!
now!
May 2008
Page 2
HOT Exercise GPT12
Interaction of Development Tools
IDE
Compiler
Compiler
Assembler
Assembler
Linker
Linker
Locator
Locator
DAvE
Programming
Tool
Debugger
int main(){
char a;
long b;
…
Target
Debugger/Emulator
SW
SW
May 2008
HW
HW
Page 3
HOT Exercise GPT12
Hardware Triggering of GPT
In this exercise you will:
„ Configure the XC2287M with DAvE
„ Configure the GPT timer T6
„ The GPT timer overflow would be used to interface
to CAPCOM2 in the later exercise.
May 2008
Page 4
HOT Exercise GPT12
Start DAvE
„ Start DAvE
† Click on the
„ Create a new project (Startup Dialog pop up automatically)
† Click on ‘Create a new project’ or select File -> New
† Select microcontroller: ‘XC2287M’
May 2008
Page 5
HOT Exercise GPT12
Select Device
1
2
3
May 2008
Page 6
HOT Exercise GPT12 - DAvE Configurations
Project Settings
„ Project Settings
„ Close the window
May 2008
Page 7
HOT Exercise GPT12 - DAvE Configurations
Save DAvE Project
„ Save your DAvE project
† Path:
C:\IFX_HOT\XC2287M\Examples\GPT12
† Project name:
GPT12\GPT12.dav
May 2008
Page 8
HOT Exercise GPT12 - DAvE Configurations
Save DAvE Project
„ Save your DAvE Project File
1
2
3
May 2008
4
Page 9
HOT Exercise GPT12 - DAvE Configurations
GPT Settings
„ Click on ‘GPT2’ module
May 2008
Page 10
HOT Exercise GPT12 - DAvE Configurations
GPT Settings (cont.)
„ Configure ‘GPT2’ module
† Enable module
† Set prescaler for the timer block 2 till 8
1
2
May 2008
Page 11
HOT Exercise GPT12 - DAvE Configurations
GPT Settings (cont.)
„ T6 Settings
1
6
5
2
7
3
4
May 2008
8
9
Page 12
HOT Exercise GPT12 - DAvE Configurations
GPT Settings (cont.)
„ Click on Capture/Reload tab
„ CAPREL reload value = 0x3FFF
1
2
May 2008
Page 13
HOT Exercise GPT12 - DAvE Configurations
GPT Settings (cont.)
„ Configure GPT2 – Interrupts
† Drag ‘GPT2 T6 INT ’ from Level 0 to Level 8, Group 0
1
2
3
May 2008
Page 14
HOT Exercise GPT12 - DAvE Configurations
GPT Settings (cont.)
„ Configure GPT2 – Functions
† Click on ‘GPT2_vInit’
† Click on ‘GPT2_vStartTmr’, ‘_vSetToggLatch’ ‘_vClrToggLatch’
† Click on
4
1
2
3
May 2008
Page 15
HOT Exercise GPT12 - DAvE Configurations
Port Settings
„ Click on ‘Port’
May 2008
Page 16
HOT Exercise GPT12 - DAvE Configurations
Port Settings (cont.)
„ Configure Ports – Ports
† Click on ‘Configure Port 10’
May 2008
Page 17
HOT Exercise GPT12 - DAvE Configurations
Port Settings (cont.)
„ Configure Ports – Port 10
† Functionality - click on ‘P10.0( to P10.7) as general IO’
† Direction – click on ‘Out’
† Output Value – click ‘high’
† Click on
4
1
May 2008
3
2
Page 18
HOT Exercise GPT12 - DAvE Configurations
Port Settings (cont.)
„ Configure Ports – Functions
† Initialization Function - click on ‘IO_vInit’, ‘IO_vTogglepin’
† Click on
3
1
2
May 2008
Page 19
HOT Exercise GPT12 - DAvE Configurations
Save DAvE Project
„ Save your DAvE Project File
† Go to File Æ Save (or Save As) or click on
† Filename entered previously:
“c:\IFX_HOT\XC2287M\Examples\GPT12\GPT12.dav”
May 2008
Page 20
HOT Exercise GPT12 - DAvE Configurations
Code Generation
„ Let DAvE Generate Code for You
† Go to File Æ generate Code or click on
† DAvE generated code files are
¬ MAIN.C,
MAIN.H
¬ GPT2.C,
GPT2.H
¬ IO.C,
IO.H
¬ SCS.C,
SCS.H
¬ XC22XXREGS.H
May 2008
Page 21
HOT Exercise GPT12 – Tasking VX Toolset
„ Open Project Work Space
† Click on
† Filename: browse to “c:\IFX_HOT\XC2287M\Examples”
† Click ‘OK’
1
2
May 2008
Page 22
HOT Exercise GPT12 – Tasking VX Toolset
„ Create New Project
† Click on Workbench (if not already there…)
May 2008
Page 23
HOT Exercise GPT12 – Tasking VX Toolset
„ Import DAVE Project
1
† Click on File -> Import
† Select Tasking VX-toolset for C166…
† Click ‘OK’
2
May 2008
Page 24
HOT Exercise GPT12 – Tasking VX Toolset
„ Import DAVE Project
† Click `Infineon DAvE C166 Project´
† Click ‘Next’
CAN_1
1
2
May 2008
Page 25
HOT Exercise GPT12 – Tasking VX Toolset
„ Import DAvE Project
† Add Dave Project ‘GPT12´
† Click `Finish´
2
1
3
May 2008
Page 26
HOT Exercise GPT12 – Tasking VX Toolset
„ Configure Target Board
1
† Select the project in the navigator
† Select ‘Project/Target Board
Configuration’
2
† Select ‘Infineon XC2000/XE166
Easykit Board’
† Choose `XC2287M-104F´
† Click `Finish´
3
4
May 2008
Page 27
HOT Exercise GPT12 – Tasking VX Toolset
„ Software Hint
† DAvE doesn’t change code that is inserted in the ‘USER
CODE’ sections if you let DAvE regenerate the code.
Therefore, whenever adding code to the generated code,
write it into a ‘USER CODE’ section.
The code you really have to add looks like this:
while(1)
{
// USER CODE BEGIN (Main,4)
BlinkLED();
// USER CODE END
}
May 2008
Page 28
HOT Exercise GPT12 – Tasking VX Toolset
Add User Code – GPT2.C (ISR)
// USER CODE BEGIN (Tmr6,1)
// USER CODE END
_interrupt(T6INT) void GPT2_viTmr6(void)
{
// USER CODE BEGIN (Tmr6,2)
IO_vTogglePin(IO_P10_0);
IO_vTogglePin(IO_P10_1);
IO_vTogglePin(IO_P10_2);
IO_vTogglePin(IO_P10_3);
// USER CODE END
} // End of function GPT2_viTmr6
// USER CODE BEGIN (GPT2_General,10)
// USER CODE END
May 2008
Page 29
HOT Exercise GPT12 – Tasking VX Toolset
Build Project
„ Click on ‘Build Project GPT12’
May 2008
Page 30
HOT Exercise GPT12 - Device Access Server
Check for the latest DAS version
Note: It is recommended to use the latest DAS version.
Download the latest version at www.infineon.com\DAS
May 2008
Page 31
HOT Exercise GPT12 - Device Access Server
1.) Checking USB connections
This gets identified only
when COM port is used
•Via the USB interface
on the Easykit with FTDI
chip
The DAS JTAG
composite device gets
identified
•When miniWiggler is
connected
•When USB Wiggler Box
is connected
•Via the USB interface
on the Easykits with
FTDI chip
May 2008
Page 32
HOT Exercise GPT12 - Device Access Server
2.) Check DAS status
1. Start DAS device scanner
2. Start DAS Server Control panel
3. If DAS device scanner does not show any device, start the
appropriate DAS server
Incase you are connected via the USB Wiggler box,
then start „JTAG over USB Box“
Incase you are connected via the FTDI chip or mini wiggler,
then start „UDAS“
May 2008
Page 33
HOT Exercise GPT12 - Device Access Server
3.) Starting the servers manually
4. Incase „UDAS“ server is started and XC2000 easykit is
connected via on-chip FTDI or via separate miniWiggler,
following status changes could be noted
5. Incase „JTAG over USB Box“ server is started and XC2000
starter kit is connected via Wiggler box, following status
changes could be noted
May 2008
Page 34
HOT Exercise GPT12 – Tasking EDE
Connect XC2287M Easy Kit
„ Connect XC2287M Board to PC
„ Check the DIP Switch Settings on S102:
Ö OFF-OFF-OFF-OFF-OFF (Start from Internal Flash)
„ Reset The Board (Press The Reset Button)
S102
Standard Internal
Start configuration
ON
1 2 3 4
DIP
5
USB
Reset button
May 2008
Page 35
HOT Exercise GPT12 – Tasking VX Toolset
Run Debugger
1
„ Click on
2
„ Click on ‘Resume’ and start program
May 2008
Page 36
HOT Exercise GPT12 – Tasking VX Toolset
Run Debugger
„ See Results
† LED’s toggle when the GPT2 interrupt takes place.
May 2008
Page 37
HOT Exercise GPT12 – Tasking VX Toolset
Run Debugger
„ Verifications
† Click on ‘Suspend’
† Click on ‘Restart’
† LEDs change ON/OFF States
† Click on ‘Resume’
May 2008
Page 38
May 2008
Page 39