POSIF Position Interface XMC™ Microcontrollers July 2014 POSIF Position Interface Highlights POSIF Interrupt Control Mode Selection IN IN IN ... IN IN Phase B Phase A LPF Index INTs Quadrature/ Linear Interface IN OUT1 OUT2 Mode Hall1 Hall2 Hall3 2/3 Hall Sensor Interface Output control OUT3 OUT4 OUT5 IN IN OUT0 OUT6 Multi-Channel Control MCP The POSIF module is the ideal solution for motor control applications using Hall Sensors and Quadrature Decoders. The user can configure freely the type and usage of the resources to perform an optimized mapping to the wanted application. Key Feature Customer Benefits › Interface for linear or quadrature rotary encoder › › › Interface for Hall Sensors › Stand-alone multi channel control › › Application tailored motor position and velocity measurement. Tailored solution for 2 or 3 Hall Sensor applications. Coupling with PWM generation. Perform multi-level modulation for PWM. Tailored modulation development Copyright © Infineon Technologies AG 2015. All rights reserved. 2 POSIF Interface for linear or quadrature rotary encoder › Linear or Quadrature Interface › Input signal filtering › Position monitoring (tick counting + direction) › Velocity Monitoring (time between ticks or/and elapsed time for a number of ticks) › Revolution Monitoring POSIF Interrupt Control Phase A Phase B Phase B Index IN OR IN Mode Selection LPF Phase A Index Quadrature/linear Interface INTs Output control Mode rev Configurable resource Organization Motor Shaft revolution counter dir Hall1 IN Hall2 Hall3 Clock 2/3 Hall Sensor Interface clock Motor Shaft Position Monitor speed Direction IN Multi-Channel Control Velocity Measurement Phase A Phase A Phase B Phase B clock/ticks Copyright © Infineon Technologies AG 2015. All rights reserved. 3 POSIF Interface for Hall Sensors › Current and Expected pattern can be easily updated via SW › Flexible Input signal debouncing/filtering › Time measurement between Correct Hall Events › Programmable error handling (Wrong Hall Event) › Synchronization with the PWM generation POSIF Interrupt Control INTs Phase B IN IN Mode Selection LPF Phase A Index Mode Hall1 IN Hall2 Hall3 IN Quadrature/Linear Interface PWM Sync Configurable resource Organization Debouncing Timer Output control Edge 2/3 Hall Sensor Interface CHE E xpec te d pat te rn + Curre nt pa tt ern WHE Multi-Channel Control Copyright © Infineon Technologies AG 2015. All rights reserved. MCP Timer measuring the distance between Correct Hall events PWM generation timers 4 POSIF Stand-alone multi channel control › Multi-Channel Control can work in stand-alone (without any of the other two modes) › With multi-channel control it is possible to control a pattern (max. 16 bits) that is controlling the PWM outputs (of CCU4/CCU8) › Pattern can be updated on-the-fly completely synchronous with the PWM timers › The pattern is completely controlled by SW, allowing any type of PWM output control Pattern is applied to the Timers Request for a new pattern can be done via SW or HW Synchronization of the pattern update with the PWM timers allows glitchless operation POSIF Interrupt Control INTs Phase B IN Mode Selection LPF Phase A Index PWM outputs in parallel. Allows multiple timer output control Quadrature/linear Interface Output control PWM timers patt Mode IN Hall1 IN Hall2 Hall3 PWM0 2/3 Hall Sensor Interface PWM1 PWM2 SW HW IN Pattern Update request IN PWM sync Multi-Channel Control Next pattern PWM3 update Current pattern pattern Copyright © Infineon Technologies AG 2015. All rights reserved. 1001 b 1100 b 0110 b 5 POSIF System Integration DMA NVIC Input Functions control PORTS Mode Selection Quadrature/Linear Interface Index Hall1 Hall2 XMC4400 ● XMC1100 XMC1200 XMC1300 ● XMC4500 ● XMC4700 ● The POSIF system integration offers several advantages: Interrupt Control Phase A XMC4200 ● Interrupts/ Service Requests POSIF Phase B XMC4100 ● 2/3 Hall Sensor Interface Output control Hall Sensor Encoder Multi channel › Distribution bus from CCU4/CCU8 over the ERU for complex signal conditioning application cases › Distribution of control logic to all of the Timer units (CCU4/CCU8) › Connectivity to the ADC to perform signal monitoring (or emulation) for motor control › Target applications Hall3 Multi-Channel Control CCU8 CCU4 VADC – Motor Control ERU Dis tribution Unit for complex signa l conditioning *Several components may be present or not depending on the device – Power Conversion – Human Machine Interface – Connectivity – General Purpose Copyright © Infineon Technologies AG 2015. All rights reserved. 6 Application Example Hall Sensor Control BLDC (1/2) Hall Inputs Debouncing H1 Overview db t Transition detected H2 H3 For a standard BLDC motor control application, the POSIF is the monitoring the Hall Sensor outputs. In every transition of the Hall Sensors a debouncing timer is started. Debouncing Over Compare Hall Inputs with Expected Pattern Stop/TRAP PWM Wrong Transition Time between CHE Correct Transition che t Sync with PWM 2 sync slots PWM Timers outs MultiChannel waiting for PWM sync MCP Pattern Update A+ AB+ 010110b 110100b If after the debouncing time the transition is the expected one, than the Hall Sensor Control logic “informs” the multi-channel control that a pattern update is possible. BC+ C- In Brief Standard BLDC motor control After this, the multi-channel control waits for a sync signal from the PWM timers to update the multi-channel pattern. Copyright © Infineon Technologies AG 2015. All rights reserved. 7 Application Example Hall Sensor Control BLDC (2/2) › Interrupt Control IN Index Hall1 IN Hall2 Hall3 A timer is used to debounce the input signals. PWM Sync IN If a CHE occurs, then the PWM Delayed timers will Sample Expected signalize when Current Hall Event Position the POSIF H1: 1 1 1 updates the Multi-Channel H2: 0 0 1 pattern n Wrong Hall Event can be used to generate a TRAP for the PWM timers Phase A n CHE H3: 1 CHE 0 0 0 0 1 1 0 CHE 0 CHE 0 Quadrature/Linear Interface Mode IN n › INTs Phase B Mode Selection LPF CHE 1 WHE 1 Errror! Debouncing Timer Output control Edge 2/3 Hall Sensor Interface CHE E xpec te d pat te rn + Curre nt pa tt ern WHE Multi-Channel Control Level Events Input Signals › POSIF The Hall Sensor logic inside the POSIF is monitoring the input pattern against the expected pattern 6 * CCU4/8xOUTy:s › MCP A+ Timer measuring the distance between Correc t Hall Even ts WHE T im e r0 MCP WHE T im e r1 MCP WHE T im e r2 MCP Pattern for BLDC is applied to the CCU8 timers in parallel CCU8 is then controlling a 3 phase motor scheme + A- A C+ B+ A+ C- A- N S B+ BC+ - B- B C C- Application Example Hall Sensor Control: Detailed Block Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 8 A+ AB+ BC+ C- Application Example Quadrature Decoder – fixed time stamp (1/2) Perform action, e.g. change rotation direction Overview Counter Overflow Value The Quadrature Decoder Interface of the POSIF, together with the flexible set of Timers present in each derivative, can be use to: 0x0000 POSIF Interrupt Control INTs Phase B IN IN IN Mode Selection LPF Phase A Index Output control Quadrature/linear Interface Counter (for motor shaft position) dir clock Mode Hall1 Hall2 Hall3 2/3 Hall Sensor Interface implement a tailored solution to monitor the motor shaft position › implement a robust velocity measurement algorithm Timer+Counter (for velocity) Multi-Channel Control Calculate speed › speed Read back the number of elapsed ticks Time stamp ISR In Brief Position monitoring plus velocity calculation within a fixed timestamp ISR In this application case, one counter is monitoring the motor shaft position. The velocity is monitored by storing/capturing the elapsed number of ticks within a fixed time windows. Copyright © Infineon Technologies AG 2015. All rights reserved. 9 Application Example Quadrature Decoder – fixed time stamp (2/2) With this setup it is possible to configure the ISR timestamp for velocity calculation. Every time that an ISR is triggered by the “Velocity Timer0” the SW reads back the stored number of ticks from Velocity Counter0. › High Speed › The Position Counter can work completely decoupled from the velocity calculation. This counter can be used to trigger an ISR with a certain number of elapsed ticks or revolutions. Low Speed Quadrature clock Period clock Direction Position Counter Counter Overflow Value Descr.: Monitors the motor shaft position 0x0000 Velocity Timer1 Descr.: Captures/Stores the time elapsed between the last 3 consecutive ticks AND Captures/stores the elapsed time between the last tick and the trigger generated by Velocity Timer0 Captured Data Time between two consecutive ticks Captured Data Time between last tick and time wi ndow tri gger Velocity Counter0 IN Index IN Phase A Index Quadrature/linear Interface Mode Output control dir Hall1 Hall2 Hall3 2/3 Hall Sensor Interface clock speed IN Multi-Channel Control Nr.elapsed ticka 0x0000 Captured Data Velocity Timer0 Descr.: Generates a capture trigger for the Velocity Counter0 and Velocity Timer1 with a periodicity equal to the one set in the Time Window Nr.el apsed ticks Capture trigger Phase B Mode Selection LPF Capture trigger IN Capture Trigger Phase A Capture trigger Interrupt Control Phase B High Speed Limi t Descr.: Captures/stores the elapsed number of ticks that occured within the time window dictated by the Velocity Timer0 POSIF Time Wi ndow 0x0000 Fixed time Application Example Quadrature Decoder fixed time stamp: Detailed Timing Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 10 Application Example Quadrature Decoder – Enhanced Position and Velocity (1/2) Overview Perform action, e.g. change rotation direction Counter Overflow Value The flexible resource utilization between the POSIF and the CCU4/CCU8 modules, gives the possibility of having multiple timers/counters to monitor different variables. 0x0000 POSIF Interrupt Control INTs Phase B IN IN IN Mode Selection LPF Phase A Index Output control Quadrature/linear Interface dir Counter (for motor shaft position) clock Mode Hall1 Hall2 Hall3 2/3 Hall Sensor Interface speed 2 Timers+Counter (for velocity and angle adjustmen t) Multi-Channel Control - Calculate speed - Information for SVM/angle calculation - Number of elapsed ticks - Distance between ticks - distance between last tick and ISR In this application case, a position counter is used to monitor the motor shaft position. Time stamp Besides that one additional counter and two timers are used to monitor: ISR ISR › In Brief › › Enhanced position and velocity monitoring › the number of elapsed ticks between a fixed timestamp the time distance between ticks the jitter between the last tick and the ISR Copyright © Infineon Technologies AG 2015. All rights reserved. 11 Application Example Quadrature Decoder – Enhanced Position and Velocity (2/2) › › › With this setup it is possible to configure the ISR timestamp for velocity calculation. E.g. calculate the velocity every 2 ms. High Speed Low Speed Quadrature clock Period clock Direction Position Counter In each ISR the SW has available the number of elapsed ticks, the time distance between two consecutive ticks, the distance between the ISR and the last tick. Counter Overflow Value Descr.: Monitors the motor shaft position 0x0000 Velocity Timer1 Descr.: Captures/Stores the time elapsed between the last 3 consecutive ticks AND Captures/stores the elapsed time between the last tick and the trigger generated by Velocity Timer0 All these variables can be used not only to calculate the accurate velocity but also for angle calculation that can be feedback to the SVM calculation routine Captured Data Time between two consecutive ticks Captured Data Time between last tick and time wi ndow tri gger Velocity Counter0 IN Index IN Phase A Index Quadrature/linear Interface Mode Output control dir Hall1 Hall2 Hall3 2/3 Hall Sensor Interface clock speed IN Multi-Channel Control Nr.elapsed ticka 0x0000 Captured Data Velocity Timer0 Descr.: Generates a capture trigger for the Velocity Counter0 and Velocity Timer1 with a periodicity equal to the one set in the Time Window Nr.el apsed ticks Capture trigger Phase B Mode Selection LPF Capture trigger IN Capture Trigger Phase A Capture trigger Interrupt Control Phase B High Speed Limi t Descr.: Captures/stores the elapsed number of ticks that occured within the time window dictated by the Velocity Timer0 POSIF Time Wi ndow 0x0000 Fixed time Application Example Enhanced Position and Velocity: Block Diagram Copyright © Infineon Technologies AG 2015. All rights reserved. 12 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. 13 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.