Queued SSC V

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

CRC Computation using PCP

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

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.

ASCLIN Asynchronous Synchronous Interface

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

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

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

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

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

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

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

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

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

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

NovalithIC H-Bridge Demo Board

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

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

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

Application Note, V 1.0, Sep AP TC1796 step B. Micro Link Interface: Quick Start. Microcontrollers. Never stop thinking.

Operating temperature T a

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

Industrial PROFET. Universal Application Board User s Manual

SPI Protocol of the TLE941xy family

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

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

Easy Kit Board Manual

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

Design Guideline for TC1782 Microcontroller Board Layout

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

Application Note No. 097

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

Design Guideline for TC1791 Microcontroller Board Layout

Design Guideline for TC1798 Microcontroller Board Layout

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

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

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

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

An introduction to MTV

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

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

XC2000/XE166 Family AP Application Note. Microcontrollers. FOC Motor Drive Kit with TLE5012 Speed and Position Sensor V1.

IRPS5401 programming guide

An SPI Temperature Sensor Interface with the Z8 Encore! SPI Bus

XMC LED current control explorer kit

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

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

Application Note No. 100

ESD8V0L... ESD8V0L1B-02LRH. Type Package Configuration Marking ESD8V0L1B-02EL

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

Section 5 SERCOM. Tasks SPI. In this section you will learn:

Dual H-Bridge shield. Dual H-Bridge shield - board user manual. Shield for DC motor control with IFX9202. About this document.

Sensor supply in bus mode

Using the Z8051 MCU s USI Peripheral as an SPI Interface

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

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

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

USER GUIDE EDBG. Description

Relaisdriving with HITFETs and SPIDERs

Operating Manual. Inferface. CANopen. English

Getting Started with ESPI Interface Using the Z8 Encore! XP F1680

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

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

Application Note, V1.0, Feb AP XC166 family. Software implementation of Trigonometric functions using CORDIC Algorithm.

TLT807B0EPV Demoboard

Memory Access Time in TriCore 1 TC1M Based Systems

Hello, and welcome to this presentation of the STM32 Universal Synchronous/Asynchronous Receiver/Transmitter Interface. It covers the main features

Application Note, V 1.1, Sept AP32034 TC1775B. Understanding the TC1775B BootStrap Loaders. Microcontrollers. Never stop thinking.

Security & Chip Card ICs SLE 4436/36E

Interfacing Z8 Encore! XP MCUs with an I 2 C-Based Character LCD

Microcontrollers and Interfacing

TIP120. Motion Controller with Incremental Encoder Interface. Version 1.0. User Manual. Issue August 2014

IP-48DAC channel 16-bit Digital/Analog Converter With memory Industry Pack Module PROGRAMMING MANUAL Version 1.

PCI-4IPM Revision C. Second Generation Intelligent IP Carrier for PCI Systems Up to Four IndustryPack Modules Dual Ported SRAM, Bus Master DMA

SPOC +2 User Manual Multichannel SPI High-Side Power Controller

TLx5012B 2go Evaluation Kit

EDBG. Description. Programmers and Debuggers USER GUIDE

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

Welcome to this presentation of the STM32 direct memory access controller (DMA). It covers the main features of this module, which is widely used to

Nuvoton Touch Key Series NT1160 Datasheet

AN3154 Application note

Systems Programming. Lecture 4 Z16 Architecture and Programming

Specification E2 Interface

XMC1000 EEPROM emulation and data retention

An SPI interface for the 65(C)02 family of microprocessors

NOVOtechnik. Content. TIM CANopen Gebrauchsanleitung TIM CANopen user manual SIEDLE GRUPPE

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

First steps through the TriCore Interrupt System

Hello, and welcome to this presentation of the STM32 I²C interface. It covers the main features of this communication interface, which is widely used

AN4666 Application note

Application Note. Introduction AN2471/D 3/2003. PC Master Software Communication Protocol Specification

B Interface description 12.01/

Absolute Pressure Sensor

EASY219 / IEC CANopen Master / Slave

STM8 I 2 C optimized examples

3D Magnetic Sensor 2 Go - TLE493D-A2B6

ArduCAM-M-2MP Camera Shield

TIM-UP 19k-S3-Spartan 6

8-Bit AP Application Note. Microcontrollers. Microcontroller. XC878 Class B Software Library V

PMC-DA Channel 16 Bit D/A for PMC Systems REFERENCE MANUAL Version 1.0 June 2001

Transcription:

TriCore AP32172 Application Note V1.0 2011-09 Microcontrollers

Edition 2011-09 Published by Infineon Technologies AG 81726 Munich, Germany 2011 Infineon Technologies AG 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 the 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 the nearest Infineon Technologies Office. Infineon Technologies components may be used in life-support devices or systems only 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.

TC1782 Revision History: V1.0, 2011-09 Martin Schrape Previous Version: Page Subjects (major changes since last revision) We Listen to Your Comments Is there any information in this document that you feel is wrong, unclear or missing? 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 Application Note 3 V1.0, 2011-09

Table of Contents Table of Contents 1 Preface... 6 2 Introduction... 7 3 Configuration... 7 4 Example Application... 10 4.1 Example 1... 10 4.2 Example 2... 12 4.3 Example 3... 14 5 Tools... 16 6 Source code... 16 7 References... 16 Application Note 4 V1.0, 2011-09

Preface 1 Preface This application note describes the implementation of a queued serial communication on the TriCore architecture [1] for the AUDO MAX-family. Queued serial communication is extremely helpful when multiple external devices are connected to one SSC interface and when the communication should be serviced quickly and with low or no CPU load. Up to eight slaves are possible on one SSC master. The application note explains the configuration of the build-in queued Synchronous Serial Communication (SSC) mode as well as alternative methods which uses the PCP. The document is aimed at developers who write or design real-time applications on the TriCore which uses the SSC interface to communicate with either multiple similar slave devices like Digital to Analog Converters (DAC), field bus chips or position encoders or different slave devices on the same SSC module. This guide assumes that readers have access to the TriCore Architecture Manual [2] and the TC1782 Users Manual [3], and have at least some general knowledge of TriCore instruction set, the architectural features and peripheral modules especially the DMA and the standard SSC functionality. See References on page 16 for more information on the TriCore and other relevant documentation. Figure 1 TC1782 Block Diagram Application Note 6 V1.0, 2011-09

Introduction 2 Introduction Figure 1 shows the TC1782 block diagram. Modules used in this application note are marked yellow. This section 2 gives an introduction to the principles of the queued SSC mode. With the queued SSC mode the TriCore can control multiple SSC slaves with different configurations like baud rates, data width and byte order. In this case, the control and data handling for an SSC slave is handled by multiple DMA channels. Section 3 explains a configuration and initialization of the DMA and SSC module to use the queued SSC mode. Section 4 illustrates three example applications that are provided with this application note. The examples are considering slave devices like DAC which has only a a Write interface. The queued SSC mode does also support Write as well as Read interfaces, so that e.g. field bus chip (R/W) or position encode (W) could use this mode but these devices are not in the scope of this application note. 3 Configuration The SSC configuration is controlled by four registers (Table 1): the Control Register CON (see page 10), the Baud Rate Timer Reload Register BR, the Slave Select Output Control Register SSOC and the Slave Select Output Timing Control Register SSOTC (see page 10). These registers are located directly behind each other in the address space. The basic idea of the queued SSC mode is that one DMA channel moves a configuration from an internal buffer of n 4 words to these four registers and then issues a request to a second DMA channel that send the data to the transmit buffer (Figure 2). The four registers can be easily addressed using a circular 16 byte buffer for the destination of the first DMA channel. During the modification of the SSC configuration the SSC needs to be disabled and reenabled when the configuration is finished. Therefore the enable bit is found twice in the module registers. The control register which is accessed first by the DMA holds a CON.EN bit, so that the first DMA move can disable the module, the subsequent 3 moves modifies the configuration but the last move to the SSOTC register is also used to re-enable the module. The SSCOTC register holds another enable bit SSCOTC.EN and a queued SSC Mode control bit SSC0TC.QSMEN. If both bit are set the module will be enabled (Figure 4). To service multiple transmission without any CPU interaction the SSC generates a request from the receive data buffer SSC0_RDR that is used as a hardware request to start the next transfer of the next SSC configuration by the first DMA channel (Figure 3). Table 1 Register Short Name SSC Register Overview used for Queued Mode Register Long Name Offset Address CON Control Register 10 H BR Baud Rate Timer Reload Register 14 H SSOC Slave Select Output Control Register 18 H SSOTC Slave Select Output Timing Control Register 1C H Figure 2 SSC Interrupt Control Application Note 7 V1.0, 2011-09

Configuration Figure 3 SSC0 Module Implementation and Interconnection Figure 4 Mode Control Application Note 8 V1.0, 2011-09

Configuration SSCn_CON Control Register [10 H ] Reset Value: 0000 0000 H 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 0 PAR EEN PAR TYP PAR REN PAR TEN r rw rw rw rw 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 EN MS 0 A REN BEN PEN REN TEN LB PO PH HB BM rw rw r rw rw rw rw rw rw rw rw rw rw Field Bits Type Description EN 15 rw Enable Bit 0 B Transmission and reception are disabled. 1 B Transmission and reception are enabled. This bit is available as module output line SSC enabled. Note that EN should only be cleared by software while no transfer is in progress (STAT.BSY = 0). Note that the transmission/reception enable can also be controlled in queued SSC mode by bit SSOTC.EN. SSCn_SSOTC Slave Select Output Timing Control Register [1C H ] Reset Value: 0000 0000 H 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 0 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 EN QSM SLS EN 0 O7 INACT TRAIL LEAD MOD rw w r r rw rw rw Field Bits Type Description QSMEN 14 w Mode Enabled EN 15 rw Enable Bit r 0 B When QSMEN is written with 0, the state of bit SSOTC.EN is don t care. In this case, the enable/disable of the SSC is controlled by bit CON.EN only. Note that EN should only be cleared by software while no transfer is in progress (STAT.BSY = 0). 1 B When QSMEN is written with 1, queued SSC mode is enabled, and the state of bit SSOTC.EN is copied to CON.EN. QSMEN is always read as 0. 0 B Transmission and reception are disabled. 1B Transmission and reception are enabled. Note that the transmission/reception enable can also be controlled in queued SSC mode by bit CON.EN. Application Note 9 V1.0, 2011-09

Example Application 4 Example Application Three examples show how the SSC can be configured for queued SSC mode. The first one uses the mode described in the user s manual, writing data to four slave devices. The second example shows how to configure the DMA to transmit larger values than 16 bit using two DMA channels. The third example is a speed optimized modification of the second example that uses a PCP channel instead of DMA channel. 4.1 Example 1 Figure 5 shows the communicatiuon to four slave devices with different baudrates and up to 16 bit data width. The configuration is stored in a ring buffer ssc_cfg with a size of of four times four words (Listing 1 Line 1-18). For SLAVE0 the SSC0 interface is configured for 12 bit data width, MSB first and 1.5 Mbaud, SLAVE1 requires 8 bit data width, LSB first and 1.0 Mbaud, SLAVE2 requires 16 bit data width, MSB first and 2.0 Mbaud and SLAVE3 is set up to 4 bit data width, LSB first and 1.0 Mbaud. Figure 5 Timing Diagram Example 1 The DMA channel 0 is configured for a 4 transfers of 4 moves of 32-bit data(line 37). Each transfer is hardware controlled by the DMA Request Line SSC receive data request SSC0_RDR. The channel configures the CON, BR, SSIOC and SSOTC registers (Line 40) and triggers after each transfer, i.e. after the SSC configuration, the DMA channel 1 using the service request line 9 (Line 42). DMA channel 1 transfers by 1 move a 16 bit data to the SSC transmit buffer SSC0_TB. A system timer is configured in this example to start the queued transmission cyclically (Figure 6). The interrupt routine requests the first transfers by software and also sets the hardware transaction request so that the further transfers two to four are handled by hardware. Figure 6 Cyclical Transmission Application Note 10 V1.0, 2011-09

Example Application 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 unsigned align(64) ssc_cfg[16] = { // 0x0000401B, // SSC0_CON master, MSB, 12-bit 0x0000001D, // SSC0_BR 1.5Mbaud 0x00000100, // SSC0_SSOC slave 0 0x0000C000, // SSC0_SSOTC enable 0x00004007, // SSC0_CON master, LSB, 8-bit 0x0000002C, // SSC0_BR 1Mbaud 0x00000200, // SSC0_SSOC slave 1 0x0000C000, // SSC0_SSOTC enable 0x0000401F, // SSC0_CON master, MSB, 16-bit 0x00000016, // SSC0_BR ~2Mbaud 0x00000400, // SSC0_SSOC slave 2 0x0000C000, // SSC0_SSOTC enable 0x00004003, // SSC0_CON master, LSB, 4-bit 0x0000002C, // SSC0_BR 1Mbaud 0x00000800, // SSC0_SSOC slave 3 0x0000C000 // SSC0_SSOTC enable }; unsigned short align(64) msg[4] = {0x123, 0x45, 0x6789, 0xA}; void interrupt(stm_int) stm_icr(void) { DMA_STREQ.B.SCH00 = 1; DMA_HTREQ.B.ECH00 = 1; STM_ISRR.B.CMP0IRR = 1; } int main(void) { } // PORT initialization P3_IOCR0.U = 0x20900000; P3_IOCR4.U = 0x90909090; P2_IOCR0.U = 0x0000A000; // P3.3 MRST0, P3.2 SCLK0 // P3.7 SLSO02, P3.6 SLSO01,\ P3.5 SLSO00, P3.4 MTSR0 // P2.1 is SLSO03 // DMA initialization DMA_CHCR00.U = 0x00424004; // 4x4x32bit, single mode, \ SSC0_RDR request after each transfer DMA_SADR00.U = (unsigned) ssc_cfg; // Source is cfg[] DMA_DADR00.U = (unsigned) &SSC0_CON.U; // Destination CON, BR, SSOC, SSOTC DMA_ADRCR00.U = 0x00004688; // 64Byte source, 16Byte destination buffer DMA_CHICR00.U = 0x90C; // DMA request after each transfer by SRN09 DMA_CHCR01.U = 0x00380000; // 1x1x16bit, continuous mode, \ DMA_SR09 request after each transaction DMA_SADR01.U = (unsigned) msg; // Source is msg[] DMA_DADR01.U = (unsigned) &SSC0_TB.U; // Destination is SSC0_TB DMA_ADRCR01.U = 0x00000308; // 8Byte source buffer DMA_HTREQ.B.ECH01 = 1; // Enable hardware transfer request // STM generates an interrupt every 2^13/90MHz = 91us. STM_CMCON.U = 0x0C00; // 2^(0xC+1) STM_CMP0.U = 1; STM_ICR.U = 1; STM_SRC0.U = 0x1000 STM_INT;// Enable STM interrupt to TC enable(); for (;;) ; Listing 1 qssc1.c Application Note 11 V1.0, 2011-09

Example Application 4.2 Example 2 This example is made for three similar slave devices where each slave device is listening to a command stream of 2 24 bit. This command sequence is required for e.g. LTC2602/LTC2612/LTC2622, a dual DAC device. For a data width larger than 32 bit it is not possible to use the CS output of the SSC but the CS has to be generated by a standard I/O port pin. Figure 7 shows the communicatiuon to three slave devices using the same baudrate and 2 24 bit data width. The module frequency is 40 Mhz, the bautrate 20 MBaud. Two DMA channel are used. The first one set/reset the CS line. The second transfers 12 bit. This sequence is done four times in a row before selecting the next slave. Figure 7 Timing Diagram Example 2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 unsigned short dac[6] = { 0x1122, 0x3344, 0x5566, 0x7788, 0x99AA, 0xBBCC }; unsigned align(64) t[16] = { 0x2000C0, 0x2000C0, 0x2000C0, 0x2000C0, // PR5 PS7 PS6 => reset P3.5, set P3.7 P3.6 0x4000A0, 0x4000A0, 0x4000A0, 0x4000A0, // PR6 PS7 PS5 => reset P3.6, set P3.7 P3.5 0x800060, 0x800060, 0x800060, 0x800060, // PR7 PS6 PS5 => reset P3.7, set P3.6 P3.5 0x0000E0, 0x0000E0, 0x0000E0, 0x0000E0}; // PS7 PS6 PS5 => set P3.7 P3.6 P3.5 unsigned short align(32) s[16] = { 0x0200, 0x0000, 0x0210, 0x0000, // 0x0200, 0x0000, 0x0210, 0x0000, // 0x0200, 0x0000, 0x0210, 0x0000, // 0x0000, 0x0000, 0x0000, 0x0000 }; // void interrupt(stm_int) stm_isr(void) { // insert the 4 MSB of dac to LSB of s[0] s[0] = insert(s[0], extru(dac[0], 12, 4), 0, 4); // set s[1] the 12 LSB of dac s[1] = extru(dac[0], 0, 12); s[2] = insert(s[2], extru(dac[1], 12, 4), 0, 4); s[3] = extru(dac[1], 0, 12); s[4] = insert(s[4], extru(dac[2], 12, 4), 0, 4); s[5] = extru(dac[2], 0, 12); s[6] = insert(s[6], extru(dac[3], 12, 4), 0, 4); s[7] = extru(dac[3], 0, 12); s[8] = insert(s[8], extru(dac[4], 12, 4), 0, 4); s[9] = extru(dac[4], 0, 12); s[10] = insert(s[10], extru(dac[5], 12, 4), 0, 4); Application Note 12 V1.0, 2011-09

28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 } s[11] = extru(dac[5], 0, 12); DMA_STREQ.B.SCH00 = 1; DMA_HTREQ.B.ECH00 = 1; DMA_HTREQ.B.ECH01 = 1; STM_ISRR.B.CMP0IRR = 1; int main(void) { AP32172 Example Application // SSC0 initialization SSC0_BR.U = 0x00000001; // baud rate = 22.5Mbaud (max of A1+ pad is 25MHz) SSC0_SSOTC.U = 0xC; SSC0_CON.U = 0x0000C01B; // enable, 12-bit master, MSB first // PORT initialization P3_IOCR0.U = 0x20900000; // P3.3 is MRST0, P3.2 is SCLK0 P3_IOCR4.U = 0x80808090; // P3.7 is SLSO02, P3.6 is SLSO01, P3.5 is SLSO00, P3.4 is MTSR0 P3_OUT.U = 0xE; // DMA initialization DMA_CHCR00.U = 0x00404010; // 16x1x32bit, single mode, SSC0_RDR request after each transfer DMA_SADR00.U = (unsigned) t;// Source is t[] DMA_DADR00.U = (unsigned) &P3_OMR.U; // Destination P3_OMR DMA_ADRCR00.U = 0x00000608; // 32Byte source buffer DMA_CHICR00.U = 0x90C; // Interrupt after each Transfer to SRN09 DMA_CHCR01.U = 0x00200010; // 16x1x16bit, single mode, DMA_SR09 request after each transfer DMA_SADR01.U = (unsigned) s;// Source is s[] DMA_DADR01.U = (unsigned) &SSC0_TB.U; // Destination is SSC0_TB DMA_ADRCR01.U = 0x00000508; // 16Byte source buffer } // STM generates an interrupt every 2^13/90MHz = 91us. STM_CMCON.U = 0x0C00; //2^(0xC+1) STM_CMP0.U = 1; STM_ICR.U = 1; STM_SRC0.U = 0x1000 STM_INT;// Enable STM interrupt to TC enable(); for (;;) ; Listing 2 qssc2.c Application Note 13 V1.0, 2011-09

Example Application 4.3 Example 3 This example is a performance optimized alternative of example with two similar slave devices. SCLK0 of Figure 8 shows a continous clock signal instead of the interrupted one in Figure 7. This example uses one DMA channel and one PCP channel Figure 8 Timing Diagram Example 3 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 unsigned short dac[4] = { 0x1122, 0x3344, 0x5566, 0x7788 }; volatile short far share align(32) s[8] = {0x0200, 0x0000, 0x0210, 0x0000, 0x0200, 0x0000, 0x0210, 0x0000}; void interrupt(stm_int) stm_icr(void) { s[0] = insert(s[0], extru(dac[0],12,4),0,4); s[1] = extru(dac[0],0,12); s[2] = insert(s[2], extru(dac[1],12,4),0,4); s[3] = extru(dac[1],0,12); s[4] = insert(s[4], extru(dac[2],12,4),0,4); s[5] = extru(dac[2],0,12); s[6] = insert(s[6], extru(dac[3],12,4),0,4); s[7] = extru(dac[3],0,12); } DMA_CHICR02.U = 0x00000008; // Channel 02 Transfer interrupt enabled SRN0 P3_OUT.U = ~0x20; DMA_STREQ.B.SCH02 = 1; DMA_HTREQ.B.ECH02 = 1; // Enable Hardware transfer request by SSC0_TDR STM_ISRR.B.CMP0IRR = 1; int main(void) { // SSC0 initialization SSC0_BR.U = 0x00000001; // baud rate = 22.5 Mbaud SSC0_SSOC.U = 3; SSC0_CON.U = 0x0000C01B; // enable, 12-bit master, MSB first // PORT initialization P3_IOCR0.U = 0x20900000; // P3.3 is MRST0, P3.2 is SCLK0 P3_IOCR4.U = 0x00808090; // P3.6 is SLSO01, P3.5 is SLSO00, P3.4 is MTSR0 P3_OUT.U = ~0; // P3.6 is high, P3.5 is high // DMA initialization DMA_CHCR02.U = 0xC0204004; // 4 transfers of one 16bit move DMA_SADR02.U = (unsigned) s; // Channel 02 destination address register DMA_DADR02.U = (unsigned) &SSC0_TB.U; // Channel 02 destination address Application Note 14 V1.0, 2011-09

Example Application 42 43 44 45 46 47 48 49 50 51 52 53 54 register DMA_ADRCR02.U = 0x00000408; // Channel 02 address control register DMA_SRC0.U = 0x1400 DMA_INT; // Enable DMA interrupt to PCP } // STM generates an interrupt every 2^13/90MHz = 91us. STM_CMCON.U = 0x0C00; //2^(0xC+1) STM_CMP0.U = 1; STM_ICR.U = 1; STM_SRC0.U = 0x1000 STM_INT; // Enable STM interrupt to TC enable(); for (;;) ; Listing 3 qssc3.c 1 2 3 4 5 6 7 8 9 void interrupt(dma_int) dma_isr(void) { DMA_CHICR02.U = 0x00000000; // Channel 02 Transfer interrupt disabled while (SSC0_STAT.B.BSY) ; // alternative for 25Mbaud for(int i=0;i<25;i++) nop(); P3_OUT.U = ~0x40; DMA_STREQ.B.SCH02 = 1; DMA_HTREQ.B.ECH02 = 1; // Enable Hardware transfer request by SSC0_TDR DMA_INTCR.B.CICH02 = 1; } Listing 4 qssc3.pcp.c Application Note 15 V1.0, 2011-09

Tools 5 Tools The examples were build using the Tasking compiler Version 3.5r1. mingw32-make (www.mingw.org) was used as a make tool. The example code includes a project workspaces for the PLS UDE debugger V3.08. 6 Source code The source code provided with this application consists of a single Tasking project. 7 References [1] http://www.infineon.com/tricore [2] TriCore Architecture V1.3.8 2007-11 [3] TC1784 User s Manual V1.0 2009-07 Application Note 16 V1.0, 2011-09

w w w. i n f i n e o n. c o m Published by Infineon Technologies AG