Infineon XE164 Microcontroller Application Note
જાહેરાત
જાહેરાત
A p p l i c a t i o n N o t e , V 2 . 0 , M a y 2 0 0 8
AP16137
X E 1 6 4
U C o n n e c t - C A N X E 1 6 4 " C o o k e r y B o o k " f o r a h e l l o w o r l d a p p l i c a t i o n u s i n g t h e K E I L t o o l c h a i n ( y o u c a n d o t h e h e l l o w o r l d e x a m p l e i n t h i s d o c u m e n t w i t h t h e e v a l u a t i o n v e r s i o n o f t h e K E I L t o o l c h a i n )
M i c r o c o n t r o l l e r s
Edition 2008-07-16
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.
UConnect-CAN XE164 "Cookery Book"
AP08048
Revision History: 2008-05
Previous Version:
Page none
Subjects (major changes since last revision)
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:
AP16137
V2.0
Application Note 3 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Table of Contents Page
Note: Table of Contents see page 9 .
Introduction:
This “Appnote” is a Hands-On-Training / Cookery Book / step-by-step book.
It will help inexperienced users to get an UConnect-CAN XE164 up and running.
With this step-by-step book you should be able to get your first useful program in less than 2 hours.
The purpose of this document is to gain know-how of the microcontroller and the tool-chain.
Additionally, the "hello-world-example" can easily be expanded to suit your needs.
You can connect either a part of - or your entire application to the UConnect-CAN XE164.
You are also able to benchmark any of your algorithms to find out if the selected microcontroller fulfils all the required functions within the time frame needed.
Note:
The style used in this document focuses on working through this material as fast and easily as possible. That means there are full screenshots instead of dialog-window-screenshots; extensive use of colours and page breaks; and listed source-code is not formatted to ease copy & paste.
Have fun and enjoy the UConnect-CAN XE164!
Application Note 4 V2.0, 2008-05
Application Note 5
AP16137
UConnect-CAN XE164 "Cookery Book" s
V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Block Diagram (Source: XE164 UConnect Manual)
Application Note 6 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
SAFXE167 F-96F66L Block Diagram (Source: Product Marketing)
SAFXE164 F-96F66L Block Diagram (Source: Product Brief)
Note:
The XE164 microcontroller is a derivative of the XE167 microcontroller!
Application Note 7 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
SAFXE164 F-96F66L Block Diagram
(Source: DAvE)
XE16x Block Diagram (Source: User’s Manual)
Note:
Just by comparing the different sources of block diagrams, you should be able to get a complete picture of the microcontroller and to answer some of your initial questions.
Application Note 8 V2.0, 2008-05
Your
program:
AP16137
UConnect-CAN XE164 "Cookery Book"
“Cookery book“
For your first programming example for the UConnect-CAN XE164:
Chapter/
Step
1.)
*** Recipes ***
DAS Installation + Connecting the UConnect-CAN XE164
2.)
3.)
4.)
5.)
DAvE (program generator)
DAvE Installation (mothersystem) + DAvE Update Installation (XE16xx_Series.dip) for XE164
Using DAvE
Microcontroller initialization for your programming example
Using the KEIL Development Tools (C-Compiler)
Programming of your application (XE164) with the KEIL tool chain (µVision3)
Running your first programming example
Feedback
6.)
Feedback
Application Note 9 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
1.) DAS Installation + Connecting the UConnect-CAN XE164:
s
Application Note 10 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Screenshot of the UConnect-CAN XE164 Homepage: http://www.infineon.com/cms/en/product/channel.html?channel=db3a3043183a955501183c3446e1
006f
Note:
For further information, please refer to the XE164 UConnect Manual, V.1.0
.
For further information, please refer to the XE164 UConnect Manual, V.1.1
.
Application Note 11 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Install the Infineon DAS ( D e v i c e A c c e s s S e r v e r) Server:
Go to www.infineon.com/DAS :
Note:
The DAS Server must be installed on your host computer!
The goal of the DAS software is to provide one single interface for all types of tools.
The USB Device driver communicates with the UConnect-CAN XE164 when connected to the host computer.
The USB Device driver for the UConnect-CAN XE164 USB interface is included in the DAS software.
A virtual COM port driver is also included.
Application Note 12 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Download “The latest release version for download: DAS Edition v2.6.4”:
Unzip das_edition_v264.zip
and
Application Note 13 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
execute “ DAS_v264_setup.exe
” to install the DAS Server.
Application Note 14 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Click Finish
Application Note 15 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Connect the UConnect-CAN XE164 to the host computer:
USB Connection:
.) used for: UART communication (the USIC0_CH0/UART/RS232/serial interface is available via
USB as a virtual COM port of the second USB channel of the FTDI FT2232 Dual USB to
UART/JTAG interface).
.) used for: On-Chip-Flash-Programming and Debugging (first USB channel of the FTDI FT2232
Dual USB to UART/JTAG interface).
.) the USB connection works also as the power supply.
Note:
A USB driver is installed the first time while connecting the UConnect-CAN XE164 via USB to your host computer.
Note:
A default virtual COM Port is generated.
Application Note 16 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Using a Windows 2000 operating system, we are now going to search for the virtual COM Port which was generated after connecting our UConnect-CAN XE164:
Start – Settings – Control Panel
Application Note 17 V2.0, 2008-05
Double click: Administrative Tools
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 18 V2.0, 2008-05
Double click: Computer Management
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 19 V2.0, 2008-05
Click: Device Manager
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 20 V2.0, 2008-05
Expand: Ports (COM & LPT):
Expand: Universal Serial Bus controllers:
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
As we can see: our virtual COM Port for
UART/RS232 communication with the
UConnect-CAN XE164 via USB is
COM5 !
COM5
Application Note 21 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
2.) DAvE – Installation for XE16x microcontrollers
:
Install DAvE (mothersystem):
Download the DAvE-mothersystem setup.exe
@ http://www.infineon.com/DAvE and execute setup.exe
to install DAvE .
Note:
Abort the installation of Acrobat Reader.
Application Note 22 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Install the XE164 microcontroller support/update (XE16xx_Series.dip):
1.)
Download the DAvE-update-file ( .DIP
) for the required microcontroller
@ http://www.infineon.com/DAvE
Unzip the zip-file “ XE16xx_Series_v2[1].0.zip
” and save “ XE16xx_Series.dip
“
@ e.g
. C:\DAvE\XE16x-2008-05-29\ XE16xx_Series.dip
.
Application Note 23 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
2.)
Start DAvE - ( click )
3.)
View
Setup Wizard
Default:
• Installation
Forward>
Select:
•
I want to install products from the DAvE’s web site
Forward>
Select: C:\DAvE\XE16x-2008-05-29
Forward>
Select: Available Products click D XE16xx_Series
Forward>
Install
End
4.) DAvE is now ready to generate code for the XE16x microcontrollers.
Application Note 24 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
3.) DAvE - Microcontroller Initialization after Power-On:
Start the program generator DAvE and select the XE164 microcontroller:
File
New
16-Bit Microcontrollers
Select XE164F
Create
Application Note 25 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Choose the Project Settings as you can see in the following screenshots:
General: Controller Type: Type: check/select XE164F-96F66
General: Compiler Settings: Compiler: check/choose Keil
Note:
You can change file names (e.g. MAIN.C, MAIN.H) anytime.
Application Note 26 V2.0, 2008-05
System Clock: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Note (Source: DAvE):
Configuration of the System Clock:
- VCO clock used, input clock is connected
- input frequency is 8,00 MHz (XTAL1)
- configured system frequency is 66,00 MHz
- system clock is 66.00 MHz
Application Note 27 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Additional information: Clock System (Source: User’s Manual):
Clock Generation Unit (CGU) Block Diagram:
Note:
The CGU can convert a low-frequency external clock to a high-speed internal clock, or can create a high-speed internal clock without external input.
The system clock
f
SYS
is generated out of four selectable clocks:
• PLL clock f
PLL
• Wake-Up clock f
WU
• The Direct Clock f
OSC
, from pin XTAL1
• Input DIRIN as Direct Clock Input f
DIR
Application Note 28 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Global Settings: (do nothing. Do not change configuration)
Application Note 29 V2.0, 2008-05
CPUCON1/VECSEG: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
We should not change the pipeline behaviour.
Application Note
Prefetch
Fetch
Decode
Address
Memory
Execute
Write Back
I n
I n-1
I
I n+1
I n n-1
CPU clock cycle
Prefetch Pipeline
I n+2
I n+1
I
I n+3 n+2
I n+3
Execution Pipeline
I n
I n-1
I n+1
I n
I n-1
I n+2
I n+1
I n
I n-1
I n+3
I n+2
I n+1
I n
I n-1
I n+3
I n+2
I n+1
I n
I n+3
I n+2
I n+1
30 V2.0, 2008-05
Additional information: Start from program memory (Source: User’s Manual):
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 31 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Notes: If you wish, you can insert your comments here.
Exit and Save this dialog now by clicking the close button:
Application Note 32 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Configuration of the serial interface “ASC0” / UART / USIC0_CH0 / U0C0:
The configuration window/dialog can be opened by clicking the specific block/module (USIC0).
Application Note 33 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Protocol: USIC0 Channel 0 Protocol Selection: USIC Protocol for U0C0: select ASC
Exit and Save this dialog now by clicking the close button.
Application Note 34 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Configuration of the serial interface USIC0_CH0 / U0C0:
The configuration window/dialog can be opened by clicking the specific block/module (CH 0).
Application Note 35 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
ASC General: Module Enable U0C0: click ; Enable module kernel clock and module functionality
ASC General: Pin Selection: Transmit (TxD): select P7.3
ASC General: Pin Selection: Receive (RxD): select P7.4
ASC General: Baud Rate: Required baud rate [kbaud]: insert 9,600 < ENTER >
*1
Note (*1):
Validate each alphanumeric entry by pressing <ENTER> .
Application Note 36 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Additional information: RS232 serial interface:
Note:
The RS232 serial interface (USIC_0_Channel_0 pins P7.3 and P7.4) is available via the USB port which converts the TTL-UART-signals to USB-signals (using a virtual COM port of the second
USB channel of the FTDI FT2232 Dual USB to UART/JTAG interface).
USB port
Application Note 37 V2.0, 2008-05
Additional information: Standard UART Pins (Source: User’s Manual):
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 38 V2.0, 2008-05
Control: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 39 V2.0, 2008-05
FIFO: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 40 V2.0, 2008-05
Interrupts: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Group Priority 0 Î Group Priority 1 Î Group Priority 2 Î GroupPriority 3 Î
Note:
For the serial communication with a terminal program (e.g. Docklight, www.docklight.de) running on your host computer the myprintf function is used. The myprintf function uses Software-Polling-
Mode therefore we do not need to configure any interrupts.
Application Note 41 V2.0, 2008-05
Int. Extension: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Î Group Priority 4 Î Group Priority 5 Î Group Priority 6 Î GroupPriority 7
Application Note 42 V2.0, 2008-05
Bank Select: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
For our hello world program the 2 local register banks are not needed.
Application Note 43
DPRAM
local reg bank local reg bank
CP
R15
R15
R14
GPRs
R1
R1
R1
R0
RF
global reg bank
R15
R14
GPRs
R1
R0
V2.0, 2008-05
PEC: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
For our hello world program the 8 PEC
Channels are not needed.
Application Note 44 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Functions: Initialization Function: click ; U0C0_ASC_vInit
Functions: Function Library (Part 1): click ; U0C0_ASC_vSendData
Functions: Function Library (Part 1): click ; U0C0_ASC_uwGetData
Functions: Function Library (Part 1): click ; U0C0_ASC_ubTxDataReady
Functions: Function Library (Part 1): click ; U0C0_ASC_ubTxBufFree
Functions: Function Library (Part 1): click ; U0C0_ASC_ubRxDataReady
Note:
You can change function names (e.g. U0C0_ASC_vInit) and file names (e.g. U0C0.C, U0C0.H) anytime.
Application Note 45 V2.0, 2008-05
Notes: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
Notes : If you wish, you can insert your comments here.
Exit and Save this dialog now by clicking the close button.
Application Note 46 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Configure Timer T7 in the CAPCOM 2 module:
The configuration window/dialog can be opened by clicking the specific block/module
(CAPCOM2).
Note:
The LED on IO_Port_2.7
will be blinking (if selected in the main menu) with a frequency of about 1 second (done in the Timer_7-Interrupt-Service-Routine).
Therefore we have to configure Timer_7.
Application Note 47 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Module Clock: CAPCOM2 Enable Module: click ~ Enable module
Application Note 48 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Control: Port Lock Control: click ~ The contents of the port register is not changed by the CAPCOM2 unit
Application Note 49 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Timer 7/8: Timer 7 Start Control: click 9 Start T7 after initialization (T7R)
Timer 7/8: Interrupt Control: click 9 Enable T7 interrupt (IE)
Timer 7/8: Timer 7 Input Selection (T7I): Prescaler: choose Module Clock/1024
Timer 7/8: Timer 7 Registers: Overflow [s]: insert 1 < ENTER >
Application Note 50 V2.0, 2008-05
Channels: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 51 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Interrupts: drag and drop the CC2 T7 INT to Interrupt Level 7, Group 0
Int. Extension: (do nothing)
Bank Select: (do nothing)
PEC: (do nothing)
Application Note 52 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Functions: Initialization Function: click/check ; CC2_vInit
Interrupt of Timer 7 is enabled
Parameters: (do nothing)
Notes: If you wish, you can insert your comments here.
Exit and Save this dialog now by clicking the close button.
Application Note 53 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Configure Port 2 Pin 7 to Output :
The configuration window/dialog can be opened by clicking the specific block/module (Port).
Note:
The LED is connected to IO_Port_2.7
Application Note 54 V2.0, 2008-05
Ports: click “Configure Port 2”
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 55 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Port 2: Functionality: click ; Use P2.7 as general IO Direction: click ~ Out
Application Note 56 V2.0, 2008-05
Input Characteristic: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 57 V2.0, 2008-05
Output Characteristic: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 58 V2.0, 2008-05
Parameters: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
We will use the name IO_P2_7 in application programming.
Notes: If you wish, you can insert your comments here.
Exit and Save this dialog now by clicking the close button:
Application Note 59 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Functions: Initialization Functions: click/check ; IO_vInit
Functions: Function Library (Part 1): click ; IO_ubReadPin
Functions: Function Library (Part 1): click ; IO_vSetPin
Functions: Function Library (Part 1): click ; IO_vResetPin
Functions: Function Library (Part 1): click ; IO_vTogglePin
Application Note 60 V2.0, 2008-05
Parameters: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Notes : If you wish, you can insert your comments here.
Exit and Save this dialog now by clicking the close button.
Application Note 61 V2.0, 2008-05
Save the project:
File
Save
Save project: Save in C:\XE164 (create new directory
File name: XE164
AP16137
UConnect-CAN XE164 "Cookery Book"
)
Save
Application Note 62 V2.0, 2008-05
Generate Code:
File
Generate Code
DAvE will show you all the files he has generated
(File Viewer opens automatically): or click
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 63 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
File Exit
Save changes?
Click:
Yes
Application Note 64
Generated files
V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
4.) Using the KEIL - µVision 3 Development Tools:
Install the tool chain: You can download the Keil Development Tools @ http://www.keil.com :
Download and Execute C166V611.EXE
( - or any higher version ) and install the Keil tool chain.
Application Note 65 V2.0, 2008-05
Start Keil µVision3 and open the DAvE Project:
If you see an open project – close it: Project Close Project
Project Open Project
Select Project File: Look in: choose C:\XE167 (1)
Select Project File: Files of type: select Dave Project Files (2)
Click XE167.dpt (3)
AP16137
UConnect-CAN XE164 "Cookery Book"
Click Open
Application Note 66 V2.0, 2008-05
Generate „make“- file:
Project – Rebuild all target files or
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
This step generates a makefile and shows the include files.
Application Note 67 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Configure :
Compiler, Assembler, Linker, Locater, Hex-Converter, Build – Control, Simulator, Debugger,
Listings and Utilities (e.g. OnChip Flash Programming): mouse position:
( Project Workspace , Files): Target1 click right mouse button click Options for Target ´Target1‘ or click
Project Workspace , Files
Application Note 68 V2.0, 2008-05
Device: check XE164F-96F
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 69 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Target: Clock(MHz): check 8.0
Target: tick/check
;
Use On-chip ROM
Target: tick/check
;
Use On-chip ROM
Target: tick/check
;
Use On-chip XRAM
Target: tick/check
;
Use On-chip XRAM
Note (Source: DAvE):
Configuration of the System Clock:
- VCO clock used, input clock is connected
- input frequency is 8,00 MHz
- configured system frequency is 66,00 MHz
- system clock is 66.00 MHz
Application Note 70 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Additional information: Memory Map (Source: User’s Manual):
Application Note 71 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Additional information: Memory Map (Source: User’s Manual):
Application Note 72
!
V2.0, 2008-05
Output: click ; Create HEX File
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
The HEX File could be used while working with the program
MEMTOOL for OnChip-Flash-Programming via RS232-interface [Bootstrap Loader (BSL) Mode via UART/USIC0_CH0].
Application Note 73 V2.0, 2008-05
Listing: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 74 V2.0, 2008-05
User: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 75 V2.0, 2008-05
C166: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 76 V2.0, 2008-05
EC++: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 77 V2.0, 2008-05
A166: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 78 V2.0, 2008-05
L166 Locate: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 79 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
L166 Misc: Interrupt Vector Table Address: insert 0x0C00000
Note:
The On Chip Flash starts here.
Application Note 80 V2.0, 2008-05
Debug: (do nothing)
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 81 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Utilities: Configure Flash Menu Command: check
~ Use Target Driver for Flash Programming
Utilities: Configure Flash Menu Command: select Infineon DAS Client for XC16x
Application Note 82 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Utilities: Configure Flash Menu Command: click Settings
Application Note 83 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Flash Download Options: Download Function: check: ; Erase
Flash Download Options: Download Function: check: ; Program
Flash Download Options: Download Function: check: ; Verify
Flash Download Options: Download Function: check: ; Reset and Run
Application Note 84 V2.0, 2008-05
Click Add
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 85 V2.0, 2008-05
Select: XE16x-96F On-chip Flash
AP16137
UConnect-CAN XE164 "Cookery Book"
Click Add
Application Note 86 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
OK
OK
Application Note 87 V2.0, 2008-05
Insert your application specific program:
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
DAvE doesn’t change code which is inserted between ‘// USER CODE BEGIN’ and ‘//
USER CODE END’. Therefore, whenever adding code to DAvE’s generated code, write it between ‘// USER CODE BEGIN’ and ‘// USER CODE END’.
If you wish to change DAvE´s generated code or add code outside these ‘USER CODE’ sections you will have to insert/modify your changes each time after letting DAvE regenerate code!
Application Note 88 V2.0, 2008-05
Double click MAIN.C
and insert Global Variables: const char menu[] =
"\n\n\n"
"1 ... LED IO_Port_2.7 ON\n"
"2 ... LED IO_Port_2.7 OFF\n"
"3 ... LED IO_Port_2.7 blinking\n"
"\n"; volatile int RS232_wait=2; volatile bit blinking=ON; char select=' ';
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 89 V2.0, 2008-05
Double click MAIN.C
and insert the function input() : char input (void)
{
char in=' ';
do
{
myprintf("your choice: ");
in = (char)U0C0_ASC_uwGetData();
}while (in!='1' && in!= '2' && in != '3');
return in;
}
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 90 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Double click MAIN.C
and insert the following code in the main function:
while(RS232_wait);
Application Note 91 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Double click MAIN.C
and insert the following code in the main function into the while(1) loop:
myprintf(menu);
select=input();
switch (select)
{
case '1': blinking=OFF, IO_vResetPin(IO_P2_7), myprintf("\n*** LED IO_Port_2.7 ON
***\n"); break;
case '2': blinking=OFF, IO_vSetPin(IO_P2_7), myprintf("\n*** LED IO_Port_2.7 OFF
***\n"); break;
case '3': blinking=ON, myprintf("\n*** LED IO_Port_2.7 BLINKING ***\n"); break;
}
Application Note 92 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 93 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Additional information: Port Output Modification Register (Source: User’s Manual):
Application Note 94 V2.0, 2008-05
Double click Main.h
and insert the following Defines:
#define OFF 0
#define ON 1
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 95 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Double click Main.h
and insert extern declarations “Global Variables”: extern volatile int RS232_wait; extern volatile bit blinking;
Application Note 96 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Double click Main.h
and insert extern declarations “Global Functions”: extern void myprintf(const char *p);
Application Note 97 V2.0, 2008-05
Double click Main.h
and insert include files:
#include <stdio.h> // for sprintf (for myprintf)
#include <ctype.h>
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 98 V2.0, 2008-05
File – New
AP16137
UConnect-CAN XE164 "Cookery Book"
Insert :
#include "main.h" void myprintf(const char *p)
{
while(*p)
{
U0C0_ASC_vSendData(*p++);
}
}
/*
// Example 1 (use of myprintf):
// ============================ void main(void)
{
myprintf("Hello World!\r\n");
}
// Example 2 (use of myprintf):
// ============================ char mb[200]; // message buffer for sprintf() void main(void)
{
int dummy;
sprintf(mb,"Variable dummy = %d",dummy); // Write formatted data to string mb
myprintf(mb);
}
*/
Application Note 99 V2.0, 2008-05
File – Save As…
Insert: myprintf.c
AP16137
UConnect-CAN XE164 "Cookery Book"
Save
Application Note 100 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Mouse position: Project Window , User Files: click right mouse button click Add Files to Group ‘User Files’
Application Note 101 V2.0, 2008-05
Click myprintf.c
AP16137
UConnect-CAN XE164 "Cookery Book"
Add
Close
Application Note 102 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 103 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Double click CC2.C
insert Code (CAPCOM 2 Timer 7 Interrupt Service Routine):
if(RS232_wait)
RS232_wait--;
if (blinking)
{
IO_vTogglePin(IO_P2_7);
}
Application Note 104 V2.0, 2008-05
Generate your application program:
Project – Rebuild all target files or
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 105 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
Programming is now complete.
Unfortunately it is not possible to test your program with the Keil Simulator because this feature is currently not supported.
Therefore we are going to load (On Chip Flash Programming) and run your program on the
UConnect-CAN XE164 in the next chapter.
Application Note 106 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
5.) Running your first programming example:
Make sure that the UConnect-CAN XE164 is still connected to the host computer:
USB Connection:
.) used for: UART communication (the USIC0_CH0/UART/RS232/serial interface is available via
USB as a virtual COM port of the second USB channel of the FTDI FT2232 Dual USB to
UART/JTAG interface).
.) used for: On-Chip-Flash-Programming and Debugging (first USB channel of the FTDI FT2232
Dual USB to UART/JTAG interface).
.) the USB connection works also as the power supply.
Application Note 107 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
Now we need a terminal program which is able to handle a virtual COM port (COM5)!
As an example of “any terminal program” we are going to use Docklight.
Docklight can be downloaded @ http://www.docklight.de
:
Application Note 108 V2.0, 2008-05
Now, start Docklight:
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 109 V2.0, 2008-05
Click : Project Settings
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 110 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Project Settings:
Communication: Communication Mode: click ~ Send/Receive
Project Settings:
Communication: Communication Mode: Send/Receive on comm. channel: select COM5
Project Settings: Communication: COM Port Settings: Baud Rate: select 9600
Project Settings: Communication: COM Port Settings: Parity: select None
Project Settings: Communication: COM Port Settings: Parity Error Char.: select (ignore)
Project Settings: Communication: COM Port Settings: Data Bits: select 8
Project Settings: Communication: COM Port Settings: Stop Bits: select 1
Application Note 111 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Project Settings: Flow Control: Flow Control Support: click ~ Off
Application Note 112 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Project Settings:
Communication Filter: Contents Filter: click ~ Show all original communication data
OK
Application Note 113 V2.0, 2008-05
Click :
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 114 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Note:
Docklight is now ready for serial communication!
Application Note 115 V2.0, 2008-05
Go to µVision:
1.) click: 2.) click:
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 116 V2.0, 2008-05
Go to Docklight and see the result:
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 117 V2.0, 2008-05
Double click inside the red box:
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 118 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Edit Send Sequence: Sequence Definition : 1- Name : insert: 1 ... LED IO_Port_2.7 ON
Edit Send Sequence: Sequence Definition : 2- Sequence : insert: 1
OK
Application Note 119 V2.0, 2008-05
Double click inside the red box:
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 120 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Edit Send Sequence: Sequence Definition : 1- Name : insert: 2 ... LED IO_Port_2.7 OFF
Edit Send Sequence: Sequence Definition : 2- Sequence : insert: 2
OK
Application Note 121 V2.0, 2008-05
Double click inside the red box:
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 122 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Edit Send Sequence: Sequence Definition : 1- Name : insert: 3 ... LED IO_Port_2.7 blinking
Edit Send Sequence: Sequence Definition : 2- Sequence : insert: 3
OK
Application Note 123 V2.0, 2008-05
Click
Click
Click
1 ... LED IO_Port_2.7 ON or
2 ... LED IO_Port_2.7 OFF or
3 ... LED IO_Port_2.7 blinking
AP16137
UConnect-CAN XE164 "Cookery Book"
and check the results on your UConnect-CAN XE164:
Application Note 124 V2.0, 2008-05
Now we close our project and µVision 3:
Project - Close Project
File
Exit
AP16137
UConnect-CAN XE164 "Cookery Book"
Application Note 125 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
Conclusion:
In this step-by-step book you have learned how to use the UConnect-CAN XE164 together with the
Keil tool chain.
Now you can easily expand your ”hello world” program to suit your needs!
You can connect either a part of - or your entire application to the UConnect-CAN XE164.
You are also able to benchmark any of your algorithms to find out if the selected microcontroller fulfils all the required functions within the time frame needed.
Have fun and enjoy working with XE16x microcontrollers!
Note:
There are step-by-step books for 8 bit microcontrollers (e.g. XC866 and XC888), 16 bit microcontrollers (e.g. C16x, XC16x and XE16x/XC2xxx) and 32 bit microcontrollers (e.g. TC1796 and TC1130).
All these step-by-step books use the same microcontroller resources and the same example code.
This means: configuration steps, function names and variable names are identical.
This should give you a good opportunity to get in touch with another Infineon microcontroller family or tool chain!
There are even more programming examples using the same style available [e.g. ADC-examples,
CAPCOM6-examples (e.g. BLDC-Motor, playing music), Simulator-examples, C++ examples] based on these step-by-step books.
Application Note 126 V2.0, 2008-05
AP16137
UConnect-CAN XE164 "Cookery Book"
6.) Feedback (UConnect-CAN XE164, Keil tools):
Your opinion, suggestions and/or criticisms
Contact Details
(this section may remain blank should you wish to offer feedback anonymously):
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
If you have any suggestions please send this sheet back to:
email:
FAX:
+43 (0) 4242 3020 5783
Your suggestions:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
Application Note 127 V2.0, 2008-05
h t tp : / / w w w. in f in eo n . co m
Published by Infineon Technologies AG
ડાઉનલોડ કરો
જાહેરાત