AP16050 SAB C161V/K/O. Emulating an asynchronous serial interface (ASC) via software routines. Microcontrollers. Application Note, V 1.0, Feb.

Similar documents
Emulating an asynchronous serial interface (ASC0) via software routines

AP16051 SAB C161K/V/O. Emulating an asynchronous serial interface (ASC) via the on-chip synchronous serial interface (SSC) Microcontrollers

Emulating an asynchronous serial interface (USART) via software routines

Emulating an asynchronous serial interface (USART) via the on-chip synchronous serial interface (SSC)

Application Note, V1.0, Jul AP XC16x. Interfacing the XC16x Microcontroller to a Serial SPI EEPROM. Microcontrollers

Application Note, V1.0, November AP XC2000/XE166 family. ADC Result Handling on XC2000/XE166 family of Microcontrollers.

Application Note, V1.0, Jul AP08049 XC886/888CLM. Migration of Flash to ROM Device: Memory Protection Configurations.

Application Note, V 1.1, Apr AP08006 C868. Interfacing SPI/I2C Serial EEPROM with C868 Microcontroller. Microcontrollers. Never stop thinking.

Application Note, V1.0, Aug AP08064 XC866/886/888. Safeguarding the Microcontroller under Out-of-Spec Noise Conditions.

XE166 Family AP Application Note. Microcontrollers. X E D r i v e C a r d H a r d w a r e D e s c r i p t i o n Board REV.

XC2000 Family AP Application Note. Microcontrollers. XC2236N Drive Card Description V1.0,

Application Note, V3.0, June 2006 AP TC179x. TC179x Examples Collection. Microcontrollers

XE166 Family AP Application Note. Microcontrollers. UConnect XE162N Hardware Description V1.0,

Application Note, V 1.1, Feb AP DAP Connector. Microcontrollers

Easy Kit Board Manual

XE164 UConnect Manual, V.1.1, February XE164 UConnect. Board REV. 2007/40. Microcontrollers. Never stop thinking.

Application Note, V1.3, September 2008 AP XC2000/XE166 Family. Microcontrollers

XC82x/XC83x. DMX512 Receiving Device with XC836. Application Note. Microcontrollers AP08131 V1.1,

CRC Computation using PCP

NovalithIC H-Bridge Demo Board

Queued SSC V

AP XC2000 & XE166 Families. Design Guidelines for XC2000 & XE166 Microcontroller Board Layout. Microcontrollers

ASCLIN Asynchronous Synchronous Interface

Application Note No. 097

Application Note, V 1.0, April 2005 AP32086 EMC. Design Guideline for TC1796 Microcontroller Board Layout. Microcontrollers. Never stop thinking.

Industrial PROFET. Universal Application Board User s Manual

Application Note, V1.0, Feb AP LIN Application for XC164CM Using DAvE LIN Configuration tool. Microcontrollers

XC800 Family AP Application Note. Microcontrollers. Capacitive-Touch Color Wheel Implementation V1.0,

SPI Protocol of the TLE941xy family

XC800 Family AP Application Note. Microcontrollers. Programming the BMI value in the XC82x and XC83x products V1.0,

Design Guideline for TC1782 Microcontroller Board Layout

Serial I-O for Dinesh K. Sharma Electrical Engineering Department I.I.T. Bombay Mumbai (version 14/10/07)

MCS-51 Serial Port A T 8 9 C 5 2 1

Scope: SW Installation: Start the Package PROG-KIT. Current. Page 1

Infineon C167CR microcontroller, 256 kb external. RAM and 256 kb external (Flash) EEPROM. - Small single-board computer (SBC) with an

Documentation Addendum, V1.2, Aug TC Bit Single-Chip Microcontroller Delta BC-to-BE Step. Microcontrollers

8051 Serial Communication

Chip Card & Security ICs SLE Intelligent 1024 Byte EEPROM with Write Protection and Programmable Security Code

Operating temperature T a

CoE3DJ4 Digital Systems Design. Chapter 5: Serial Port Operation

Chip Card & Security ICs SLE Intelligent 256-Byte EEPROM with Write Protection function and Programmable Security Code

Design Guideline for TC1791 Microcontroller Board Layout

e-pg Pathshala Subject : Computer Science Paper: Embedded System Module: 8051 Architecture Module No: CS/ES/5 Quadrant 1 e-text

Design Guideline for TC1798 Microcontroller Board Layout

Maxim > Design Support > Technical Documents > Application Notes > Microcontrollers > APP 4465

8051 Timers and Serial Port

Smart High-Side Power Switch BSP742RI PG-DSO8. AEC qualified Green product (RoHS compliant)

8051 Microcontroller

Application Note No. 100

XMC LED current control explorer kit

Siemens' C161 - Enter the 16-bit family of Microcontrollers with revolutionary price/performance ratio

Serial communication

PROFET TM + Demoboard. Automotive Power. Smart High-Side Power Switch - Demoboard Description. Rev. 1.4,

DatasheetDirect.com. Visit to get your free datasheets. This datasheet has been downloaded by

TLS202B1. Demonstration Board Manual. Automotive Power. Demonstration Board Manual. Rev. 1.0,

AN10955 Full-duplex software UART for LPC111x and LPC13xx

Using the Z8051 MCU s USI Peripheral as an SPI Interface

In the HEW, open a new project by selecting New workspace from the main menu.

Smart High-Side Power Switch for Industrial Applications One channel: 1 x 1 Ω

Fig.12.5 Serial Data Line during Serial Communication

Migrating from the 8XC251Sx to the 8XC251Tx

USER GUIDE EDBG. Description

Application Note AN V1.3 August Module with adapted driver electronics

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

XC2000 series Board Manual, V.1.0, June XC2000 Easy Kit. Board REV. V1.0. Microcontrollers. Never stop thinking.

AN2430 Application note

Boot Loader for the Z51F6412 MCU

Power Management & Drives. Application Note. February AN-EVAL 2x8-ISO1H815G-1

APPLICATION NOTE. Atmel AVR057: Internal RC Oscillator Calibration for ATtiny4/5/9/10/20/40. 8-bit Atmel Microcontrollers. Features.

ToolStick-EK TOOLSTICK USER S GUIDE. 1. Kit Contents. 2. ToolStick Overview. Green and Red LEDs. C8051F321 provides USB debug interface.

AN2781 Application note

EDBG. Description. Programmers and Debuggers USER GUIDE

Application Note TLE9252V. About this document. Application Note. Safety Recommendations Z8F

Standard EEPROM ICs. Interfacing SLx 24Cxx I 2 C-Bus Serial EEPROMs to 8051 Controller Family, especially to the Siemens C500 Controller Family

USB Debug Adapter. Power USB DEBUG ADAPTER. Silicon Laboratories. Stop. Run. Figure 1. Hardware Setup using a USB Debug Adapter

AP XC16x. How to generate a successful ROM mask for XC16x microcontrollers. Microcontrollers. Application Note, V 0.1, Sep.

MICROPROCESSOR BASED SYSTEM DESIGN

M68HC08 Microcontroller The MC68HC908GP32. General Description. MCU Block Diagram CPU08 1

Relaisdriving with HITFETs and SPIDERs

AN10210 Using the Philips 87LPC76x microcontroller as a remote control transmitter

ESD5V3U4RRS. Type Package Configuration Marking ESD5V3U4RRS SOT363 6 pins, uni-directional E8s

UM0792 User manual. Demonstration firmware for the DMX-512 communication protocol transmitter based on the STM32F103Zx.

PMA71xx/ PMA51xx. Application Whitepaper. Wireless Control. SmartLEWIS TM MCU

Security & Chip Card ICs SLE 55R04. Intelligent 770 Byte EEPROM with Contactless Interface complying to ISO/IEC Type A and Security Logic

S3 Flash In-System Programmer

Zilog Real-Time Kernel

3. (a) Explain the steps involved in the Interfacing of an I/O device (b) Explain various methods of interfacing of I/O devices.

AP-468 APPLICATION BRIEF. Serial Port Mode 0 RICHARD N EVANS APPLICATIONS ENGINEER. February Order Number

Demo 17 - Receiving data from Host through Serial Port. Introduction:

Absolute Pressure Sensor

AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Features. Introduction. AVR 8-bit Microcontrollers APPLICATION NOTE

8051 Microcontroller

COMP2121: Microprocessors and Interfacing

Software Serial Port Implemented with the PCA

TxD GND V CC. RxD WAKE V IO SCLK MISO. (Top-side x-ray view) SCLK INH

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 4 The 8051 Architecture

MICROPROCESSORS AND MICROCONTROLLERS MATERIAL. Features of 8051:

AP Bit CMOS Microcontroller Product. Interrupt Response Time of the XC16x Family. Microcontrollers. Application Note, V 1.0, Aug.

AN5123 Application note

Serial Communication Prof. James L. Frankel Harvard University. Version of 2:30 PM 6-Oct-2015 Copyright 2015 James L. Frankel. All rights reserved.

Transcription:

Application Note, V 1.0, Feb. 2004 SAB C161V/K/O Emulating an asynchronous serial interface (ASC) via software routines. AP16050 Microcontrollers Never stop thinking.

TriCore Revision History: 2004-02 V 1.0 Previous Version: - Page Subjects (major changes since last revision) All Updated Layout to Infineon Corporate Design, updated release to 1.0, Content unchanged! Controller Area Network (CAN): License of Robert Bosch GmbH 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: mcdocu.comments@infineon.com

Edition 2004-02 Published by Infineon Technologies AG 81726 München, Germany Infineon Technologies AG 2006. 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.

Table of Contents Table of Contents Page 1 Introduction... 2 2 General Operation and Hardware Environment... 2 2.1 Supported Features... 2 2.2 Required Resources... 2 2.3 External Routing... 2 2.4 Principles of Emulation... 2 2.4.1 ASC Write... 2 2.4.2 ASC READ... 2 3 ASC Emulation Software Description... 2 3.1 Software Structure... 2 3.2 Main Program... 2 3.3 Emulation Subroutines... 2 3.4 Baud Rate Calculation... 2 3.5 Load Measurement... 2 3.6 Performance Limitations... 2 3.7 Debugging Support Pins... 2 3.8 Make File... 2 3.9 Support of KitCON161 Evaluation Board... 2 Application Note 3 V 1.0, 2004-02

1 Introduction AP16050 Introduction The C16x microcontroller family provides only one on-chip asynchronous serial communication channel (ASC). If a second ASC is required, an emulation of the missing interface may help to avoid an external hardware solution with additional electronic components. The solution presented in this paper and in the attached source files emulates the most important ASC functions by using performance and resource balanced SW routines up to 38,4 KBaud in full duplex mode with an overhead less than 40% or up to 100 KBaud in half duplex mode with an overhead less than 55% at SAB C161O with 16 MHz. All files are available for Keil and Tasking C Cross Compiler. Due to the implementation in C this performance is not the limit of the chip. A pure implementation in assembler will result in a reduction of the CPU load and therefore increase the maximum speed of the interface. Speaking about performance, it is strongly advised to have a close look at the assembler code generated by the different compilers. Moreover, at C16x architecture the speed of executing code strongly depends on the area where code and data are fetched from (external memory 16 bit data access, external memory 8 bit data access, Internal RAM, on-chip Flash,...). In addition, only a pin compatible solution is provided. The internal register based programming interface is replaced by a set of subroutine calls. The attached source files also contain a test shell, which demonstrates how to exchange information between an on-chip HW-ASC and the emulated SW-ASC via three external wires in different operation modes. It is based on the SAB C161O (Siemens 16 bit microcontroller). A table with load measurements is presented to give an indication for the fraction of CPU performance required by software for emulating the ASC. Application Note 4 V 1.0, 2004-02

General Operation and Hardware Environment 2 General Operation and Hardware Environment 2.1 Supported Features The following enumeration summarizes all features of the on-chip HW-ASC to be emulated by software routines: full and half duplex communication, baud rates up to 38.4 KBaud in full duplex and 100 KBaud in half duplex mode @ SAB C161O with 16 MHz crystal 7 bit asynchronous data frames with variable baud rate, even/odd parity and one or two stop bits, 8 bit asynchronous data frames with variable baud rate and one ore two stop bits, 8 bit asynchronous data frames with variable baud rate, even/odd parity and one ore two stop bits, 9 bit asynchronous data frames with variable baud rate and one ore two stop bits,. bit stream receive capability. The following enumeration lists all functions of a SAB C16x on-chip ASC0, which could not be cloned due to technical limitations or performance restrictions: 8 bit synchronous operation, 8 bit data frames plus wake up bit, framing check, loop back mode, bit stream write capability. 2.2 Required Resources To emulate the ASC interface by a set of software routines requires some resources, which are listed in the following table: Table 1 Resource Requirements Resource Emulated ASC Number of required I/O pins 2 Number of interrupt pins 1 Interrupt Priority very high Timer T2 and T4 Program Memory (Emulation routines only) 820 Words Data Memory (Emulation routines only) 20 Words Application Note 5 V 1.0, 2004-02

General Operation and Hardware Environment 2.3 External Routing An external wire connecting the SW-ASC data input with the External1 Interrupt pin is required to activate the SW-ASC via a Start Bit transmitted by the external communication partner. On test boards with C16X processor the on-chip HW-ASC may also be used as external party. EX1 P2.15 (optional) C16x SW ASC RXD TXD TXD RXD HW ASC Figure 1 External Routing of Transmission Lines 2.4 Principles of Emulation The algorithms required for emulating the data transmission depend on the transfer direction. Application Note 6 V 1.0, 2004-02

General Operation and Hardware Environment 2.4.1 ASC Write SW TXD 1 1 MSB Stop Bit Stop Bit Parity Bit Data Bits Start Bit LSB Pin Figure 2 Schematic Diagram of Emulating an ASC Write Operation using a Timer ISR An ASC Write is prepared by loading the information to be transmitted into a temporary buffer. After inserting parity, stop and start bits the whole buffer is shifted out within an interrupt service routine for a timer loaded with 1.0 bit time of the selected baud rate. Application Note 7 V 1.0, 2004-02

General Operation and Hardware Environment 2.4.2 ASC READ Data Frame HW ASC Ext. Interrupt Start Bit Stop Bit Timer ISR sampling data in Figure 3 Schematic Diagram of Emulating an ASC Read Operation using a Timer ISR An ASC READ is initiated by an ASC Start Bit arriving at the SW-RXD input pin, which is externally connected to an External Interrupt pin. The correlated interrupt service routine starts a timer loaded with 1.5 bit time of the required baud rate. At the beginning of the related interrupt service routine the timer is reloaded with 1.0 bit time and the logic state of the SW-RXD pin is sampled in. The final ASC Stop Bit provided by the external transmitter is completely ignored to gain some time for preparing reception of the next byte of a continuous input data stream. Application Note 8 V 1.0, 2004-02

3 ASC Emulation Software Description ASC Emulation Software Description 3.1 Software Structure The emulation software is written in C and is split into 3 files: usa_emul.c contains all low level software drivers (subroutines and interrupt services) to emulate the ASC by SW routines. This file may be directly added to the user s application software directory and may be included in his make file. usa_test.c demonstrates how to start, control and finish the emulation. The complete file (test shell) may be used to check the low level software drivers in a real application. Afterwards, the user may copy the required statements for calling the individual ASC functions into his own application code segments. usa_defi.h holds all definitions and declarations related to the emulation software (usa_test.c, usa_emul.c). 3.2 Main Program The main program (usa_test.c) is implemented as a state machine and handles several test cases (Figure 4). Application Note 9 V 1.0, 2004-02

ASC Emulation Software Description USART_INIT EMULATED ASC_READ USART_FINISH EMULATED ASC_WRITE usart_sw_flag read_ready == OFF USART_HW ASC_WRITE OUT usart_sw_flag read_ready == ON & usart_sw_rec_word_number == USART_RECEIVE BUFFER_LENGTH usart_sw_flag read_ready == ON & usart_sw_rec_word_number < USART_RECEIVE BUFFER_LENGTH USART_WHILE SW_ASC READS_IN USART_WHILE SW_ASC WRITES_OUT usart_sw_flag write_ready == ON & usart_sw_tran_word_number < USART_TRANSMIT BUFFER_LENGTH ussart_sw_flag write_ready == ON & usart_sw_tran_word_number == USART_TRANSMIT BUFFER_LENGTH usart sw_flag write ready == OFF SART_PARITY_ ERROR error == ON USART_INPUT_ usart_sw_receive PARITY word_number-- > 0 _CHECK USART_SW ASC_WRITE OUT usart_sw_receive word_number-- > 0 & error == OFF USART_FINISH EMULATED ASC_READ USART_INIT EMULATED ASC_WRITE Figure 4 State Machine Diagram for test program usa_test.c Application Note 10 V 1.0, 2004-02

ASC Emulation Software Description The first test case verifies the emulated ASC by a data reception from an external source: In the first state USART_INIT_EMULATED_ASC_READ the emulated ASC interface is initialized with the baud rate to be supported (100 KBaud half duplex). As communication partner serves the on-chip HW-ASC which is set up in same baud rate. The second state USART_HW_ASC_WRITE_OUT starts the on-chip HW-ASC. In the third state USART_WHILE_SW_ASC_READS_IN a flag is polled indicating the end of data reception via the SW-ASC. User application code to be executed during the SW-ASC read in operation may be included here instead of wasting 8 or 9 bit times only for running a polling loop. After finishing the transmission of a whole message containing a programmable number of words the state machine proceeds to the next state. The state USART_INPUT_PARITY_CHECK analyzes the message string received by SW-ASC. If a difference between received and calculated parity bit is detected the state machine goes to the error state USART_PARITY_ERROR and stops. The last state USART_FINISH_EMULATED_ASC_READ disables all hardware modules required for data transmission. In the second test case the communication is started with an altered transmission direction. The SW-ASC operates as data source and provides the on-chip HW-ASC with a message string. 3.3 Emulation Subroutines The file usa_emul.c contains all subroutines and interrupt services required for controlling the ASC emulation: usart_init_sw_asc () initializes all required auxiliary hardware modules like timers, External Interrupt and the related port pins by programming their control registers. The variable usart_temp_sw_control_register_word has to be handled in the same way like the C16x hardware special function register (SFR) S0CON. This register contains all control bits which configure the ASC. In addition the variable usart_temp_sw_baudrate sets one bit time of the bitrate which is desired. usart_start_sw_write() prepares a data transmission via the SW-ASC by - copying the information to be transmitted into a temporary word, - inserting a 0 as Start Bit at LSB position. - filling up this word buffer with leading 1 s (partly used as Stop Bits), - calculating and inserting a parity bit (if required), Afterwards, the WRITE timer is enabled and started. Application Note 11 V 1.0, 2004-02

ASC Emulation Software Description usart_parity_bit_calculation() calculates the parity bit in respect to odd or even parity mode and 8 or 9 bit data frame length. usart_analyse_input_word() compares the transmitted parity bit with the calculated parity bit of a received information. usart_disable_sw_asc() disables all required auxiliary hardware modules like timers and interrupts by setting their control registers respectively. usart_int1_interrupt_service() is started by a Low level at the SW-ASC-RXD pin, which is externally wired to the interrupt1 pin. The Low level is interpreted as an ASC Start Bit announcing the arrival of further data bits. Therefore a timer is started to activate a SW-ASC read operation after an 1.5 bit time interval. Finally the interrupt1 service is disabled to avoid undesired reactions to incoming 0 data bits. usart_read_timer_interrupt_service() starts with a self compensating timer reload. The Timer Interrupt Flag is set when the timer underflows. The related interrupt service routine is entered while the timer continues counting down. The current timer value (0xFFFx) represents the time already spent in ISR. Adding 1 bit time to current timer value compensates this interrupt service delay time and enables next sw-rxdpin sampling in 1 bit time distance exactly. A READ operation begins in the middle of the first received data bit. All incoming bits are stored in usart_sw_asc_receive_buffer arranged in correct bit order (LSB first) and the Transfer Completion Flag is set. The External Interrupt is enabled again to be prepared for handling the Start Bit of the next data byte reception. The final stop bit is completely ignored, which decreases the CPU overhead and saves time to get prepared for the Start Bit of the next byte of an input message stream. usart_write_timer_interrupt_service() handles a WRITE operation which is started with a self compensating timer reload before writing out the LSB of the usart_output_word. Every new ISR entry continues with bits of usart_output_word in ascending order. 3.4 Baud Rate Calculation Data transmission via an ASC interface requires an identical baud rate to be generated by both communication partners. This can be achieved by selecting a suitable clock oscillator base frequency and a corresponding prescaler factor. The load values for the HW-ASC baud rate generator is stored as a constant in file usa_defi.h and calculated by the formula: HW_USART_xxxx_BAUD = f OSC 2 * 16 * Desired_Baud_Rate - 1 The timer load and reload values (required for emulating a SW-ASC baud rate generator) are calculated automatically from this HW-ASC baud rate generator load value by the subroutine usart_init_sw_asc (). Application Note 12 V 1.0, 2004-02

ASC Emulation Software Description For read operations the initial load value of 1.5 bit time is corrected by a constant in file usa_defi.h (USART_INTERRUPT_DELAY_CORRECTION), which takes into account the Interrupt Response Time for External Interrupt1 after receiving a Start Bit, the Interrupt Response Time for READ Timer underflow including the execution time for all statements in the corresponding interrupt service routine before sampling in the first data bit. The exact value for USART_INTERRUPT_DELAY_CORRECTION may be extracted by analyzing the assembler program listing or by checking bit pulse signals with an oscilloscope. Note: The USART_INTERRUPT_DELAY_CORRECTION value depends on the clock generator frequency. 3.5 Load Measurement Emulating a hardware module by a set of software subroutines decreases the processor performance available for user application software. The processor load generated by the emulation software is defined as: Load = Time spent in emulating and interrupt service routines Total amount of time for transmitting / receiving n bytes * 100% The execution time of the required interrupt service and emulating routines is calculated by analyzing the compiler object module listing. The Total amount of time for transmitting / receiving n bytes can be easily calculated by multiplying the number of bits to be transmitted (including Start and Stop Bits) with the bit period time related to selected baud rate. For double checking purpose test statements are included in emulation subroutines indicating the beginning and the end of an interrupt service or emulation routine by switching port pin P2.15 to Low and to High state. This port pin may be scanned by an oscilloscope. However, the pulse width measured at this test pin does not exactly represent the CPU load caused by a subroutine execution. Even if the macro reset_test_pin_latch() is found at the very beginning of a C coded subroutine or the macro set_test_pin_latch() is seen as last statement in C source code, several stack operations to be executed are found in the compiler s object module listing before or after the test pin is affected (PUSH register x, PULL register x). The next table presents load calculation results for an ASC emulation via SW routines running with different baud rates (data frames without parity bit). Application Note 13 V 1.0, 2004-02

ASC Emulation Software Description Table 2 Load Measurement Values for an ASC emulation via SW routines (without parity bit) at SAB C161O Crystal Frequency Baud Rate Half Duplex Write Load Half Duplex Read Load Full Duplex Load 16 MHz 19.2 KB 10.4% 9.2% 19.6% 16 MHz 38.4 KB 20.7% 18.4% 39.1% 16 MHz 100.0 KB 54.0 % 48.0% - The load value increases with falling clock generator frequencies. 3.6 Performance Limitations The most severe limitation is seen in half duplex READ mode at 100 KB baud rate. The Read Timer interrupt service routine requires an execution time near 1 bit time. At the next higher baud rate (125 KBaud) the self calibrating timer reload mechanism fails after some ISR entries and loads the timer with a negative value (0xFFFx). Note: The Write Timer always requires the highest interrupt priority within the system to generate a bit stream with a very accurate ASC timing. Another fact which reduces the maximum baudrate of the application is the implementation in C. A solution in assembler would have a positive impact in the performance. Of course, this solution would be not that easy understood like the solution in C code. So, it is advised to implement the CPU intensive routines in assembler if performance sensitive applications are used. Speaking about performance, it is strongly advised to have a close look at the assembler code generated by the different compilers. Moreover, at C16x architecture the speed of executing code strongly depends on the area where code and data are fetched from (external memory 16 bit data access, external memory 8 bit data access, Internal RAM, on-chip Flash,...). 3.7 Debugging Support Pins To support program debugging some signals are provided to trigger an oscilloscope: a falling edge at P2.15 indicates the start of an emulation subroutine or an interrupt service routine; a rising edge indicates the end. data bits to be sampled in by the SW-ASC are provided at P3.8 (SW-ASC-RXD); data bits to be written out by the SW-ASC are provided at via P3.9 (SW-ASC-TXD). a LOW state at P2.11 indicates detection of a parity read error. Application Note 14 V 1.0, 2004-02

ASC Emulation Software Description 3.8 Make File The file usa_make.bat contains all statements to start the Keil or Tasking C cross compiler, linker and locator. (Versions Keil: C166 V3.05a, L166 V3.05, A166 V3.05. Versions Tasking: C166 V6.0r2, L166 V6.0r2, A166 V6.0r2). The paths to the source file and compiler / library directories must be modified by the user in respect to the individual file structure on his personal computer. The Make-File is started by typing usa_make.bat in a DOS window switched to the directory containing this batch file. 3.9 Support of KitCON161 Evaluation Board The KitCON-161 Evaluation Board is a starter kit (order at Siemens Semiconductors www) which helps for a general approach to the SAB C161. Generally speaking it is a printed circuit board which lets you load software down via the PC to the SAB C161. After that the SAB C161 executes that code out of the on-board flash memory. Using the test shell usa_test.c the SW-ASC of the SAB C161 communicates with the on chip HW-ASC of the SAB C161 device. The executable program (Keil: sw_asc.h86, Tasking: sw_asc.hex) can be directly downloaded to the KitCON161 evaluation board configured in address mode 1 (jumper 4 = open). The port pins selected for the SW-ASC are neighboured to the related HW-ASC pins and can be easily connected by setting jumpers on the 152 pin KitCON application area connector: The next table presents all port pins to be externally wired: Table 3 Port pins to be externally wired on KitCON-161 Evaluation Board SW-ASC-TXD (P3.9) SW-ASC-RXD (P3.8) Ext. Interrupt 1 (P2.9) HW-ASC-RXD (P3.11) X X HW-ASC-TXD (P3.10) After setting jumper 9 to position (2+3) and pressing the restart button the test program runs in an endless loop. X Application Note 15 V 1.0, 2004-02

http://www.infineon.com Published by Infineon Technologies AG