App lication Note, V 1.0, Mar. 2005 AP32013 TriCore Connecting Low-Side Switch TLE6244X to Microcontroller TC1796 using the Microsecond Bus Microcontrollers N e v e r s t o p t h i n k i n g . TriCore Revision History: 2005-03 Previous Version: Page Subjects (major changes since last revision) V 1.0 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: [email protected] Edition 2005-03 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. AP32013 Connecting TLE6244X to TC1796 via usBus Table of Contents Table of Contents Page 1 1.1 1.2 1.3 Introduction ................................................................................................... 4 Introduction Microsecond Bus ....................................................................... 4 Introduction TLE6244X and Application Board.............................................. 5 Introduction TC1796 and TriBoard ................................................................ 6 2 Hardware Connections and Visualization...................................................... 9 3 3.1 3.2 3.3 3.4 Software ...................................................................................................... 11 ASC0 Initialization ....................................................................................... 12 MSC0 Initialization ...................................................................................... 12 SSC0 Initialization ....................................................................................... 13 GPTA0 Initialization..................................................................................... 14 4 4.1 4.1.1 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.1.10 4.1.11 4.1.12 Menu ........................................................................................................... 15 Main Menu .................................................................................................. 16 Show TLE6244X Registers ..................................................................... 16 Change Control Mode (SPI/ usBus/ parallel)........................................... 16 Reset Diagnostics of TLE6244X ............................................................. 16 Send Data to TLE6244X ......................................................................... 16 Reset TLE6244X ..................................................................................... 17 Change Control Mode ............................................................................. 17 Send Data to TLE6244X ......................................................................... 17 Select MSC source.................................................................................. 18 Change MSC Data Register.................................................................... 18 Send Data via SPI ................................................................................... 18 Change GPTA clock: up.......................................................................... 18 Change GPTA clock: up.......................................................................... 19 5 Jitter– and Latency Measurement ............................................................... 20 6 6.1 6.2 Appendix ..................................................................................................... 23 Reference.................................................................................................... 23 Tools ........................................................................................................... 23 Application Note 3 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Introduction 1 Introduction This application note describes how the TLE6244X can be connected to the TC1796 using the microsecond bus to drive the output stages with patterns generated by the GPTA (General Purpose Timer Array) of the TC1796. The software gives the possibility to access the TLE6244X with a terminal program and change the configuration. 1.1 Introduction Microsecond Bus The microsecond Bus (usBus, also µSB) is a serial interface which is especially designed to connect external power devices to a microcontroller. The usBus can provide real-time control of outputs that until now have only been possible using discrete or PWM I/O ports of the microcontroller. This control is achieved using serial communication instead of parallel signal lines. The microsecond bus can run at higher frequencies than the standard SPI, providing faster response for outputs that are controlled serially. The allowed tolerance of the bus frequencies further ensures precise control of output timing. The real-time control capability of the microsecond bus means that fewer parallel ports from the microcontroller as well as to the slave device are required. The usBus can send the data to the slave with more than 32 MHz (downstream) and receive data and status information via a low speed asynchronous serial data stream (upstream channel). Figure 1 TLE6244X connected to TC1796 Application Note 4 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Introduction 1.2 Introduction TLE6244X and Application Board The TLE6244X is an 18-fold Low-Side Switch (0.35 Ω to 1 Ω) in Smart Power Technology (SPT) with a Serial Peripheral Interface (SPI) and 18 open drain DMOS output stages. The TLE6244X is protected by embedded protection functions and designed for automotive and industrial applications. The output stages can be controlled via the SPI interface or directly in parallel for PWM applications. Additionally a usBus interface is available to control the power stages OUT1...OUT7 and OUT9...OUT16 with a refresh rate of one microsecond (16 signals @ 16 MHz), thus giving the bus its name. Figure 2 TLE6244X Block Diagram The Application Board TLE6244X is equipped with a 5V linear voltage regulator that can be connected directly to 12V so the TLE6244X can be supplied from Vbat. On the Board there are 21 power screw terminals (X1) for all power lines (Outputs, VDD, Vbat, GND) and a 50 pin connector (X2) for all "non power" lines where the upper row contains the signals, the lower row is GND. Application Note 5 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Introduction Figure 3 TLE6244X Application Board For using the application board with MSC control all the DIP switches have to be off except for SW1.1 (Vdd supply over onboard voltage regulator). 1.3 Introduction TC1796 and TriBoard The TC1796 is a high performance microcontroller with TriCoreTM CPU, program and data memories, internal buses, an interrupt controller, a peripheral control processor (PCP2) and a DMA controller, several on-chip peripherals, and an external bus interface. The TC1796 is designed to meet the needs of the most demanding embedded control systems applications where the competing issues of price/performance, real-time responsiveness, computational power, data bandwidth, and power consumption are key design elements. The TC1796 offers several versatile on-chip peripheral units such as serial controllers, timer units, and Analog-to-Digital converters. Within the TC1796, all these peripheral TM CPU/system via two Flexible Peripheral units are connected to the TriCore Interconnect (FPI) Buses. Several I/O lines on the TC1796 ports are reserved for these peripheral units to communicate with the external world. The operating frequency is up to 150 MHz. Application Note 6 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Introduction Figure 4 TC1796 Block Diagram To connect power devices via the usBus the TC1796 has two Micro Second Channel Interface (MSC) modules with following features: • High-speed synchronous serial transmission on downstream channel – Serial output clock frequency: fFCL = fMSC/2 = 40 MHz – Fractional clock divider for precise frequency control of serial clock fMSC – Command, data, and passive frame types – Start of serial frame: software controlled, timer controlled, or free running – Programmable upstream data frame length (16 or 12 bits) – Transmission with or without SEL bit Application Note 7 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Introduction – Flexible chip select generation indicates status during serial frame transmission – Emergency stop without CPU intervention • Low-speed asynchronous serial reception on upstream channel – Baud rate: fMSC divided by 8, 16, 32, 64, 128, 256, or 512 – Standard asynchronous serial frames – Parity error checker – 8-to-1 input multiplexer for SDI line – Built-in spike filter on SDI The TC1796 Evaluation Board (TriBoard) is equipped with external memories (Flash and RAM) and peripherals for connection to the environment. There is also an interface for the On Chip Debugging Features (OCDS1 and OCDS2). To connect the TLE6244X to the TC1796 the connectors X801…X804 are used. Figure 5 TC1796 Evaluation Board For this application only internal memory is used, so it is easy to run the software on other hardware too. To start from internal i.e. S301.[1:4] = On Off On On. Application Note flash HWCFG[3:0] 8 has to be 0010b; V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Hardware Connections and Visualization 2 Hardware Connections and Visualization To control the TLE6244X with the TC1796 different interfaces have to be used. The data for the output stages of the TLE6244X can be sent using the MSC0 of the TC1796 while all commands are sent using the SPI interface. For this the TC1796’s SSC0 is used. With the SPI commands the TLE6244X can be configured to use the usBus for the data. As the TLE6244X doesn’t have an upstream channel the feedback (status) is also received over the SPI. Table 1 Pin Connection TLE6244X - TC1796 TLE6244X Function Powersupply SPI Control Signals usBus Vbat VDD TC1796 Function - 55 54 53 56 31 30 GND X2.1 X2.3 X2.5 X2.7 X2.13 X2.15 Vss MTSR0 SCLK0 MRST0 SLSO0 GPIO P2.4 GPIO P2.5 IN6 / FDA 63 X2.29 SOP0B / P9.7 / GPTA55 IN7 / SSY 61 X2.31 IN16 / FCL 62 X2.49 Vbat VDD GND SI SCK SO SS Reset ABE Pin 23 47 TLE6244X AppBoard EN01 / P9.6 / GPTA54 FCLP0B / P9.8 / GPTA56 extern Pin - 12 V - AF15 AF14 AE15 AE14 D1 C1 GND - D20 - C19 - C20 - The SPI uses the signals SCK (clock), SI/ SO (data) and SS (chip select). The signals FCL, FDA and SSY of the usBus are comparable to these standard SPI signals. Application Note 9 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Hardware Connections and Visualization Figure 6 Connections Overview For visualisation LEDs are connected to the 18 switches, so it is possible to see which channel is active. Figure 7 Picture of TriBoard TC1796 and Applicationboard TLE6244X Application Note 10 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Software 3 Software The software does the setup of the required peripherals (ASC0, SSC0, MSC0 and GPTA0), configures the TLE6244X for usBus communication and allows the user to control the communication modes and patterns and to read the status of the TLE6244X. The TC1796 is clocked with a 16 MHz quartz. If another quartz is used the CPU frequency has to be adapted (to 150MHz) using the PLL. Figure 8 Program Flow Application Note 11 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Software 3.1 ASC0 Initialization The asynchronous/synchronous serial interfaces (ASC0) is used for the communication between the PC and the TC1796 using the RS232 standard. A terminal program (like MTTTY or HyperTerminal) displays the data from the TC1796 and TLE6244X and sends the control data. The ASC0 uses a baud rate of 19 200 Bit/s and 8-bit data asynchronous operation with one stop bit and no parity. The terminal program has to be set up accordingly. 3.2 MSC0 Initialization The Micro Second Channel Interfaces (MSC0) of the TC1796 can be configured in many different ways to match the requirements of different devices. The TLE6244X uses following settings: - 16 data bits for each data-frame (at the pin FDA) - 16 clock-pulses for each data-frame (at the pin FCL) - clock frequency: 1...16 MHz - one sync -input (pin SSY) to latch the input data stream - no error correction In the TLE6244X only the powerstages OUT1...OUT7 and OUT9...OUT16 can be controlled by the usBus interface. The other ones can only be controlled by SPI or parallel interface. Figure 9 usBus Communication The MSC module of the TC1796 can reach a serial output clock frequency of 37.5 MHz. For this the serial data and clock outputs of the downstream channels are connected with dedicated LVDS differential output drivers for better EMC. It has a flexible chip select generation to connect more than one power device and it can indicate command frames and data frames so no SPI interface is needed. The frame length is programmable and the data from the power device (status information) can be received via a low-speed asynchronous serial upstream channel. Application Note 12 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Software The TC1796’s MSC module with this enhancements is a usBus interface of the 2nd st generation whereas the TLE6244X is 1 generation. 3.3 SSC0 Initialization The synchronous serial interface (SSC0) is used for the SPI communication between the TC1796 and the TLE6244X. After power up the TLE6244X can only be accessed and controlled by the SPI interface. Control of the power stages with the usBus interface has to be enabled by sending a SPI command. The maximal clock frequency is 5 MHz. The SSC0 uses a transfer data widths of 16 bit, transfer and receive of the MSB is first. The idle clock line is low while the transmit data is shifted on the leading clock edge and latched on the trailing edge. Figure 10 SPI communication The TLE6244X has a couple of SPI instructions so it is possible to read data from the device or write the registers. An overview of the instructions can be found in the TLE6244X datasheet. Figure 11 TLE6244X SPI access format Application Note 13 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Software With the SPI instructions it is possible to check if a TLE6244X (or other device) is connected and if the communication is working. The software will notiy a message if no device is connected or the communication is disturbed. 3.4 GPTA0 Initialization The General Purpose Timer Array (GPTA0) provides a set of timers, compare and capture functionalities, which can be flexibly combined to form signal measurement and signal generation units. They are optimized for tasks being found in engine, gearbox, electrical motor control applications, but can be used as well to generate simple and complex signal waveforms needed in other industrial applications. In this application the GPTA0 is used to generate some PWM pattern to be sent with the usBus to the TLE6244X. There is the possibility to connect the GPTA outputs directly to the MSC0 shift register so the data can be transferred without any CPU interaction. The GPTA0 generates 4 times 4 output signals with different duty cycles using the same period in each group of 4. Figure 12 GPTA pattern Application Note 14 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Menu 4 Menu After the initialization the main menu to control the TC1796 and TLE6244X is displayed in the terminal program after pressing “space”. The menu will always be shown after pressing “space”. Figure 13 Main Menu after Initialization displayed with MTTTY There are two submenus with some more selections. To go back from the submenu to the main menu just a non-valid selection has to be used. Application Note 15 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Menu 4.1 Main Menu The main menu’s different selections can be activated by pressing the number (resp. ‘r’ for “Reset”) printed at the beginning of the line. Table 2 Main Menu Selections Main Menu 0 Show TLE6244X Registers 1 Change Control Mode (SPI/ usBus/ parallel) 2 Reset Diagnostics of TLE6244X 3 Send Data to TLE6244X r Reset TLE6244X 4.1.1 Show TLE6244X Registers The registers of the TLE6244X are read via the SPI interface and displayed. The #ABE pin (VDD-monitoring and shut-off signal) of the TLE6244X is connected to the port pin P2.5 of the TC1796 and is also displayed. Any fault condition of the TLE6244X can be seen in this registers. So this information can be used by the software to detect failures and react on them. 4.1.2 Change Control Mode (SPI/ usBus/ parallel) The submenu “Change Control Mode (SPI/ usBus/ parallel)” is displayed. 4.1.3 Reset Diagnostics of TLE6244X The diagnostic registers of the TLE6244X are not reset automatically after eliminating the fault, so they have to be reset by software. This is done by writing the DEL_DIA SPI instruction. 4.1.4 Send Data to TLE6244X The submenu “Send Data to TLE6244X” is displayed. Application Note 16 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Menu 4.1.5 Reset TLE6244X The reset pin of the TLE6244X is connected to the port pin P2.4 of the TC1796. The TC1796 puts this pin to low for more than 1 µs so the TLE6244X is reset. 4.1.6 Change Control Mode The submenu “Change Control Mode” allows changing the way the TLE6244X is controlled. Table 3 Submenu Change Control Mode Change Control Mode (SPI/ usBus/ parallel) 1 Change Control Mode to SPI 2 Change Control Mode to usBus 3 Change Control Mode to parallel The multiplexer of the TLE6244X is changed with the SPI instructions so that the different control modes are selected. The TC1796’s mode isn’t changed; it always sends a signal on the MSC and SPI. The parallel inputs are not connected, they can be changed using the Application Board’s switches. 4.1.7 Send Data to TLE6244X The submenu “Send Data to TLE6244X” gives the possibility to change the data that is send to the TLE6244X. Table 4 Submenu Send Data to TLE6244X Send Data to TLE6244X 1 Select MSC source (GPTA or DD Register) 2 Change MSC Data Register 3 Send Data via SPI 4 Change GPTA clock: up 5 Change GPTA clock: down Application Note 17 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Menu 4.1.8 Select MSC source The TC1796 offers the possibility to use either the data from the MSC downstream data register or to use directly the output from the GPTA to send over usBus. Figure 14 GPTA Connection to MSC It is possible to select the connections bitwise. The software only switches all the channels to either GPTA or MSC_DD. 4.1.9 Change MSC Data Register The value of the downstream data can be changed by typing in hexadecimal format. As the MSC_DD register is 32-bit wide 8 digits has to be sent over the RS232. Not valid characters are ignored. For the TLE6244X only the lower 2 Bytes (4 digits) are relevant. 4.1.10 Send Data via SPI This selection sends one time a dynamic pattern over the SPI where every channel is switched on and off in numerical order and reverse. 4.1.11 Change GPTA clock: up This selection increments the clock frequency for the GPTA’s timer using the prescaler of the clock distribution unit. This shortens the period length. Application Note 18 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Menu 4.1.12 Change GPTA clock: up This selection decrements the clock frequency for the GPTA’s timer using the prescaler of the clock distribution unit, the period will increase. Application Note 19 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Jitter– and Latency Measurement 5 Jitter– and Latency Measurement The usBus is designed to provide real-time control of outputs although it is a serial interface. For real-time control the time between the GPTA switching from high to low (or vice versa) until the TLE6244X output stage switches is relevant. This jitter and latency can be measured by connecting the GPTA’s signal directly to a port pin. The other signals are already available at the port pins, so an oscilloscope can be used for the measurement. The TLE6244X latches the usBus data with a rising edge of the SSY signal. So the jitter is the time from the change of the GPTA signal until the rising edge of the SSY whereby the new data of the GPTA has to be transmitted in the same usBus frame. Figure 15 Jitter measurement (Ch1: GPTA signal; Ch2: SSY; Ch3 : FDA) In this figure the new level of the GPTA is transmitted with the next data frame because it was to late to take this new data for the already started transmission. Here the latency is 2.76 µs; the frame length is 1.5 µs. The baudrate of the usBus is 12.5 MHz. Application Note 20 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Jitter– and Latency Measurement The maximum jitter is less than two times the frame length. This worst case would occur when the GPTA changes the level very short after the MSC module latching the data for the next transmission. The minimum jitter is about the frame length when the GPTA changes the level very short before the MSC module is latching the new data. This case can be seen in the next figure. Figure 16 Jitter measurement (Ch1: GPTA signal; Ch2: SSY; Ch3 : FDA) Application Note 21 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Jitter– and Latency Measurement After the TLE6244X latching the data it takes some additional time until the power stage switches to the new level. Figure 17 Latency measurement (Ch1: GPTA signal; Ch2: SSY; Ch3: FDA; Ch 4: TLE6244X power stage output) The delay time is tdon + tson. In this case it takes 4.6 µs until the power stage has reached the new level (0.2UBatt). This latency has no influence on PWM accuracy where an accurate duty cycle is needed, because this time is always constant. This means the signal is only delayed. Application Note 22 V 1.0, 2005-03 AP32013 Connecting TLE6244X to TC1796 via usBus Appendix 6 Appendix 6.1 Reference • Data sheet TLE6244X, V4.2, 2003-08-29 • Application Note “Application Board TLE6244X”, V 1.1, Jan 2003 • Target Specification TC1796 (B-Step), V 2.2, June 2004 System Unit and Peripheral Unit • User’s Manual TriBoard TC1796, V 3.0, June 2004 6.2 • • • • Tools DAvE V2.1 with TC1796 Support V2.2 HighTec Compiler Development Suite V2.4 pls Debugger V1.10.02 MTTTY V4.00 Application Note 23 V 1.0, 2005-03 http://www.infineon.com Published by Infineon Technologies AG