CCU8 Capture and Compare Unit 8 XMC™ Microcontrollers July 2014 CCU8 Capture/Compare Unit 8 Timer Counter Free Running with Clear/Gate Count with Up/Down Con trol Per iod Int Time Clear Gate Count Compare Capture Capture Ti me r on Event Edg e/Center Aligne d P WM Per iod Compare Time Up/ Down Capture & Clear Int Int Int Time PWM0 Time Event PWM1 Highlights One timer architecture serves any use case. The regular and repetitive slice structure allows portable software and use of code generators. Two compare channels enable the generation of up to 4 complementary PWM signals per timer (16 per CCU8) Data Dead-time Dead-time Key Feature Customer Benefits › CCU8 serves as timer, counter, capture, compare › Shadow and buffer mechanism for coherency › Dead-Time insertion › Adjust the timer to the wanted application › Synchronize hardware events to software timing for real-time control › Generating complementary PWM signals Copyright © Infineon Technologies AG 2015. All rights reserved. 2 CCU8 Capture/Compare Unit 8 CCU8 Highlights 4 identical timer slices CC83 CC82 CC81 CC80 Pin Pin ... Pin Pin bit timer Prescaler 16 Dither Concatenation Period 16 bit timer Output Compare channel Period External Output 16 bit timer Functions Capture channel 0Capture 1functions Compare functions 16Capture bit timer Capture 2Capture 0Capture 1 3 Compare channel External Capture 2Capture Functions Compare 1 1 3 Dead CaptureChannel 0Capture Time Compare Channel 2 Capture 0 Capture 2 Capture 1 Capture 3 Interrupt Logic 4xPWM 4xPWM 4xPWM 4xPWM Add. Out s INTs The CCU8 is a flexible timer module, comprised of 4 identical timer slices tailored for multi-phase PWM generation and signal conditioning. Several input functions can be controlled externally (via pins or other modules) enabling a powerful resource arrangement for each application. Key Feature Customer Benefits › Modular timer approach › Flexible PWM generation › Flexible capture scheme › Each specific application function can be ported to any of the 4 Timers › Each Timer Slice can generate up to 4 PWM signals (2 x complementary) › Parallel capture and compare modes Copyright © Infineon Technologies AG 2015. All rights reserved. 3 CCU8 Modular Timer Approach › Equal structure and same availability of features for each of the 4 Timer Slices › Functions controllable via external signals do not depend on the selected signal › Portability of code is not dependent on the used Timer Slice › High amount of configurable external functions (11), make each Timer Slice a very flexible HW resource for signal conditioning CCU8 A function can be repeated or migrated to any of the 4 timers CCU8 Each Timer Slice has an indentical availability of functions that can be controlled via External Signals Timer Slice CC83 Timer Slice CC82 Timer Slice CC81 Pin... Option: Up/Down Count Control CC83 Option: Up/Down Count Control CC82 Option: Up/Down Count Control CC81 Option: Up/Down Count Control Count CC80 Timer Slice CC80 External Ev ent Sources Signal Signal Selection Selection Event selection Active: High/Low Falling/Rising H GPIOS Other modules Function selection L Event0 true Event0 Detect false Usage of up to 3 Events in parallel Type of Functions Start the t imer Stop the timer Capture into reg. 0 & 1 Capture into reg. 2 & 3 Gate the timer clock Up/down count direction Load the Timer Count events Status bit over ride with an input value TRAP for fail-safe op. Modulate the output Count Usage of the functions Pinx 6 5 4 3 2 1 0 6 5 4 3 2 Count 1 Input: 0 Control U/D Piny Input: Count Input: Timer Kernel U/D Control Input: Copyright © Infineon Technologies AG 2015. All rights reserved. Tim e Count Down Tim e Up Count Count Down Count Up 4 CCU8 Flexible PWM generation CCU8 › › › Each Timer Slice of the CCU8 can operate in center aligned or edge aligned mode Timer Slice CC83 Timer Slice CC82 Timer Slice CC81 Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Additional operation modes like single shot, counting or dithering modes are also available Complementary PWM signal generation with dead time Timer Edge Aligned Edge Aligned Free Running Mode Option: Reset / Gate Edg e A ligned Mode PWM g eneration Per iod and Du ty Cycle Adju stment Period Period PeriodN Int errupt Int errupt PeriodN+1 Compare2 CompareN+1 Compare1 CompareN 0 › › 0 HW asymmetric PWM generation Tim e Reset (Clear): PWM0 T1c1 T2c1 Tim e 0 PWM: PWM1 Gate Input: PWM2 T1c2 T1N T2c2 T2N T1N+1 T2N+1 PWM3 Additional external controllable functions give another degree of PWM manipulation (e.g. timer gate, timer load, timer clear, etc) Counting Center Aligned Option: Up/Down Cou nt Control Center Aligne d Mode Symme tric or Asymmetr ic PWM by HW Single Shot Period Count Period Asymmetric Compare Level 2 Symmetric Compare Level 1 0 0 Tim e Count Input: U/D Control Input: Count Down Count Up Tim e PWM0 t0 PWM1 Dead Time Copyright © Infineon Technologies AG 2015. All rights reserved. Tim e t1 – t0 = <peri od> Start t1 Stop 5 CCU8 Flexible Capture Scheme Timer Slice CC8y › › Each Timer Slice of the CCU8 can operate in compare and/or capture mode Possibility of using the available 4 capture registers in two modes: External Event Sources Signal Signal Selection Selection H GPIOS L Other modules Usage of the functions Type of Functions Start the t imer Stop the timer Timer Kernel Capture i nto reg. 0 & 1 Capture i nto reg. 2 & 3 Gate the timer clock Up/down count direction Load the Timer Count events Status bit over ride with an input value TRAP for fail-safe op. Modulate the output Event0 Detect false Usage of up to 3 Events in parallel Capture + Compare Two FIFO capture structures with a depth of 2 – 1 capture trigger › Function selection Event0 true – 2 capture triggers › Event selection Active: High/Low Falling/Rising Capture Trigger 1 Capture Trigger Distribution & Full-Flag Handling Logic Full/ Empty A FIFO structure, with a full/empty control, decreases the load on the CPU when reading back fast capture trigger info: Capture on Different events Full/ Empty Capture register3 Timer capture shift Capture register1 Full/ Empty Capture Trigger 0 Capture register2 Capture register0 Full/ Empty Capture Trigger Distribution & Full-Flag Handling Logic One FIFO capture structure with a depth of 4 – Depth of 2 Capture Trigger 1 – Depth of 4 Capture on the same event Capture TriggerDistribution Distribution & Full-Flag Capture Trigger Full-FlagHandling HandlingLogic Logic Full/ Empty FIFO structure will always return the oldest captured value Timer Full/ Empty Capture register3 Capture register2 Capture register1 Capture register0 Full/ Empty Full/ Empty Capture Trigger Distribution & Full-Flag Handling Logic Copyright © Infineon Technologies AG 2015. All rights reserved. 6 Input Functions control CCU8 System Integration DMA XMC4100 ● XMC4200 ● XMC4400 ● SCU XMC1100 XMC1200 XMC1300 ● NVIC CCU8x PORTS External Functions Timer Slice CC83 Timer Slice CC82 Timer Slice CC81 Timer Slice CC80 Period Output 16 bit timer Functions Compare Channels Interrupts/ Service Requests PWM + additional outputs POSIF VADC ERU Dis tribution Unit for complex signa l conditioning XMC4700 ● The CCU8 system integration offers several advantages: › Distribution bus over the ERU for complex signal conditioning application cases › Usage of interrupts/service requests as flexible connection for ADC conversion triggering (signal compression) › Synchronous control over several Timers via the SCU › The CCU8 is agnostic to the type of signal (feature and type: level, edge) › Target applications PORTS Signal Compression CCU4 XMC4500 ● – Motor Control – Power Conversion *Several components may be present or not depending on the device – Human Machine Interface – Connectivity – General Purpose Copyright © Infineon Technologies AG 2015. All rights reserved. 7 Application Example PWM for Generic Purpose (1/2) Overview Timer Slice CC8y External Event Sources Signal Signal Select ion Selection Function selection Event selection H L Start the Timer TR AP for fail safe op Gate the ti mer clock External Signals Usage Type of Functions Up/do wn c ount di rec t ion Center or Edge aligned Load the Tim er Cou nt events S tatus bi t overri de wit h an i nput value For a standard PWM generation application, four major functions can be controlled in each CCU8 Timer Slice: Output Timer Kernel Functions TRAP for fail-safe op. Passive level TRAP Dead Time 4xPWM Mod ulate the output Start PWM generation › Star t TRAP ON Start multiple timers at the same time Ext. TRAP OFF Center Aligned PWM0 PWM1 Type of counting scheme (edge or center aligned) › Passive Level of the PWM Timer Edge Aligned Forcing the PWM to passive › TRAP x2 TRPS E = 1 PWM0 x2 PWM1 Dead tim e TRAP exit can be synchronized with the PWM signal In Brief Standard functions for generic PWM generation › Dead time insertion for complementary signals The start of the PWM can be applied to any combination of timers. Additionally a TRAP signal can be configure to set the PWM in a pre configured passive state. Copyright © Infineon Technologies AG 2015. All rights reserved. 8 Application Example PWM for Generic Purpose (2/2) CCU8 › › › › For the two available counting schemes: edge and center aligned, different dead times can be programmed for the ON and OFF thresholds. In a straightforward PWM generation it is possible to output up to 4 PWM signals from the same Timer Slice: controlling up to two complementary switches. It is possible to combine the two compare channels and generate an asymmetric complementary PWM signal by HW. Dead time is programmable for both compare channels. Different deadtime for ON and OFF transition is also available for each Channel. Timer Slice CC83 Timer Slice CC82 Timer Slice CC81 Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 (CR1) > (PR) Per iod (PR) Compare Level Channel 1 Compare Level Channel 2 0 < (CR1) < (PR) (CR1) == 0 PWM0 from channel1 PWM1 from channel1 No dead time selecte d Duty Cycle = 0 % Duty Cycle = 100 % Duty Cycle = 0 % Duty Cycle = 100 % PWM2 from channel2 PWM3 from channel2 Dead Time OFF > Dead Time ON Per iod (PR) Compare level channel 2 Compare level channel 1 CR value2 Asymetric shift CR value1 time Symme tric PWM Asymm. PWM0 from channel 1 Asymm. PWM1 from channel 1 Dead Time Dead Time Application Example PWM Generation: Detailed Timing Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 9 Application Example PWM for Power Conversion (1/4) C1 D1 Q1 Np L1 Overview Co Ns Ns C2 With each CCU8 timer slice, it is possible to control up to two HalfBridges with the same switching frequency. Q2 D2 Half-Bridge 1 CCU8 Timer Slice CC83 Timer Slice CC82 Timer Slice CC81 Timer Slice CC80 D1 Q3 Np C2 Q4 Trigger(s) Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 C1 CPU New Duty Cycle ADC 2xPWM 2xPWM Co Ns D2 Half-Bridge 2 In Brief Each of the Compare Channels is generating 2 complementary PWM signals with configurable dead time. Dead time values for Half-Bridge 1 can be different from the dead time values of Half-Bridge 2. L1 Ns Conversion values In this application example, a second Timer Slice (CC83), is being used to generate the needed ADC conversion triggers. Controlling Half-Bridges Copyright © Infineon Technologies AG 2015. All rights reserved. 10 Application Example PWM for Power Conversion (2/4) In this application case, the second compare channel is used to generate the conversion trigger(s) for the ADC. With this a very good resource utilization is guaranteed. Different trigger stamp can be used for ON and OFF time frame. CPU C1 D1 Q1 L1 Conversion values New Duty Cycle When Several HalfBridges do not have the same fs, one Timer Slice per Bridge is needed. ADC Conversion triggers CCU8 Co Ns Np Ns C2 Timer Slice CC81 Q2 D2 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Half-Bridge 1 2xPWM C1 Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 D1 Q3 2xPWM C2 Co Ns Np L1 Ns Q4 D2 Half-Bridge 2 Period (PR) Value for compare of channel 2 is updated to a new value Per iod (PR) Compare level channel 2 Compare level channel 1 CR value(n) CR value(n+1) PWM0 time PWM fs1 time Period (PR) from channel 1 PWM1 from channel 1 Dead Time ADC trigger Dead Time ADC trigger time PWM fs2 Application Example Two Half-Bridges with different fs: Detailed Block Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 11 Application Example PWM for Power Conversion (3/4) CCU8 ... Overview Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Interleaved PFC First Phase 2xPWM Phase Shift Full Bridge N-Phase Converter Timer Slice CC81 Phase Shift Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 L1 Second Phase Φ = [0°, >360°] 2xPWM Φ = 120° L2 Timer Slice CC82 Phase Shift Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Second Phase Φ = [0°, >360°] 2xPWM Compare channel 2 controls the phase shift: it can be a fixed phase shift or updated on a cycle-by-cycle way Each Timer can then generate the appropriate phase shifted signals with dead-time In Brief › Phase Shift Control Φ = 120° L3 There are several power converter topologies that implement phase shift between one or more signals (complementary or not). A known topology is the 2 or 3 phase buck converter or a phase shift full bridge. While for a 3 phase buck converter the phase shift is fixed, this is not true for a phase shift full bridge. With the CCU8 timers it is easier to control a phase shift mechanism, for fixed and/or variable phase shift. Copyright © Infineon Technologies AG 2015. All rights reserved. 12 Application Example PWM for Power Conversion (4/4) CPU CC80 Timer is generating the PWM signals for Q1 and Q2 switches. These are complementary signals with dead time. New Phase Shift Value Conversion values VIN ADC Conversion triggers Q1 CCU8 Q3 Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Ip 2xPWM Np With Compare Channel 2 of the CC80 Timer it is possible to start the CC81 Timer. This will dictate then the phase shift of CC81 regarding to CC80. Due to the fact that it is possible to update the Compare Channel 2 value on-the-fly, the phase shift can be from 0 to > 360°. L1 Co Ns Ns Timer Slice CC81 Phase Shift Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 D1 Q4 D2 Q2 2xPWM Full Bridge GND Period (PR) Compare level Phase shift value channel 2 Compare level channel 1 time Ip time Q1 Q1 Q2 Dead Time Dead Time Start CC81 Timer Period (PR) Q2 If phase shift is > 180° Phase shift value Q3 Q4 Compare level channel 1 time Q3 Dead Time Q4 Dead Time Dead Time Application Example Phase Shift Full Bridge: Timing Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 13 Application Example PWM for Motor Control (1/3) CCU8 Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Phase A 2xPWM Timer Slice CC81 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Independent Timers per Phase More flexibility Phase B 2xPWM + A Timer Slice CC82 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 CCU8 C+ B+ A+ Phase C N 2xPWM S C- OR B- A- B C - Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Phase A + Phase B 4xPWM Only 2 Timers needed More motors in parallel Timer Slice CC81 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 Phase C 2xPWM In Brief › Motor Control PWM Overview Controlling a 3-phase motor is a common application within the motor control world, that can be simply done by the CCU8. Each CCU8 Timer can control a motor phase with complementary switches. If a higher resource utilization density is needed, it is possible to control with just one Timer, two phases in parallel. The CCU8 timers are able to generate the proper PWM patterns for SVM and block commutation. Copyright © Infineon Technologies AG 2015. All rights reserved. 14 Application Example PWM for Motor Control (2/3) Symmetric SVM PWM SVM pattern generation can be done in a symmetric or asymmetric way Asymmetric SVM PWM Period (PRy) Period (PRy) Timer (CC80) Timer (CC80) Compare 1 Compare 1 time time PWM A+ PWM A+ PWM A- PWM A- Timer (CC81) In asymmetric fashion one timer per phase is needed. Timer (CC81) Compare 1 Compare 1 time time PWM B+ PWM B+ PWM B- PWM BTimer (CC82) Asymmetric way gives more flexibility for sampling shunt currents via the ADC. Compare 1 Compare 1 Timer (CC82) Compare 2 time time PWM C+ PWM C+ PWM C- PWM CLess time for ADC sampling More time for ADC sampling Application Example SVM Pattern Generation: Timing Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 15 Application Example PWM for Motor Control (3/3) Different Block Commutation Patterns › › Several block commutation pattern schemes can be controlled by the CCU8 Link between CCU8 and POSIF interface gives flexibility for any type of output pattern generation. POSIF PWM A+ Controlling synchronously and in parallel all the PWM outputs PWM A- PWM B+ Multi-Channel Pattern PWM B- Phase A+/A- Phase B+/B- Phase C+/Cpassive passive passive PWM C+ PWM C- CCU8 Timer Slice CC80 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 time Phase A 2xPWM Timer Slice CC81 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 PWM A+ PWM APWM B+ PWM B- Phase B 2xPWM PWM C+ PWM C- Timer Slice CC82 Output Period Functions 16 bit timer External Functions Compare Channel 1 Dead Time Compare Channel 2 time Phase C 2xPWM PWM A+ PWM APWM B+ PWM BPWM C+ PWM Ctime Application Example Block Commutation PWM Generation: Timing Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 16 Application Example ADC triggering with Service Requests (1/2) Overview CCU8 Timer Slice CC80 External Functions Period 16 bit timer Compare Channel PORTS Dead Time A-/A+ + A Timer Slice CC81 External Functions Period 16 bit timer Compare Channel PORTS Dead Time Period 16 bit timer Compare Channel Interrupt Logic B+ N S C- B- B AC - PORTS Dead Time C-/C+ IA OR ADC Service conversion request Conversions In Brief › A+ B-/B+ Timer Slice CC82 External Functions C+ Using the Service Requests to compress ADC triggers IB IC It may be necessary in some applications to generate several ADC conversion triggers synchronized with a PWM signal. In a motor control application it may be necessary to measure several shunt currents in each PWM cycle. The CCU8 offers a way to compress all the conversion triggers to the ADC via just one signal. This enables a better optimization of resources and connectivity. Copyright © Infineon Technologies AG 2015. All rights reserved. 17 Application Example Signal Compression with Service Requests (2/2) →Two triggers per cycle →Trigger timestamp can be updated on-the-fly Period (PRy) In this example, we are using the second compare of each Timer Slice to trigger a delayed conversion trigger to the ADC. All the triggers are grouped together in a Service Request line. Compare 2 Compare 1 time PWM A+ PWM A- Compare 2 Compare 1 time PWM B+ Additionally, the conversion timestamp for the second 180° part of the signals can also be used to trigger a conversion. This timestamp can be different from the first one. PWM BCompare 2 Compare 1 time PWM C+ PWM CTo ADC via one conversion signal Service Request X conversions Application Example Grouped Conversion triggers: Timing Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 18 Support material: Collaterals and Brochures › › › › › Product Briefs Selection Guides Application Brochures Presentations Press Releases, Ads › www.infineon.com/XMC Technical Material › › › › › Application Notes Technical Articles Simulation Models Datasheets, MCDS Files PCB Design Data › › › › www.infineon.com/XMC Kits and Boards DAVETM Software and Tool Ecosystem Videos › Technical Videos › Product Information Videos › Infineon Media Center › XMC Mediathek Contact › Forums › Product Support › Infineon Forums › Technical Assistance Center (TAC) Copyright © Infineon Technologies AG 2016. All rights reserved. 19 Disclaimer The information given in this training materials 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. Infineon Technologies hereby disclaims any and all warranties and liabilities of any kind (including without limitation warranties of noninfringement of intellectual property rights of any third party) with respect to any and all information given in this training material. All the images used in the trainings are free for commercial use or free for use with attribution and were designed by Freepik.