Sensorless Vector Control with RL78G14 Renesas Electronics America Inc © 2012 Renesas Electronics America Inc All rights reserved Renesas Technology & Solution Portfolio © 2012 Renesas Electronics America Inc All rights reserved Microcontroller and Microprocessor Line-up 2010 2013 1200 DMIPS, Superscalar 32-bit Automotive & Industrial, 65nm 600µA/MHz, 1.5µA standby 1200 DMIPS, Performance Automotive, 40nm 500µA/MHz, 35µA deep standby 500 DMIPS, Low Power Automotive & Industrial, 90nm 600µA/MHz, 1.5µA standby 165 DMIPS, FPU, DSC Industrial, 40nm 242µA/MHz, 0.2µA standby 165 DMIPS, FPU, DSC Industrial, 90nm 242µA/MHz, 0.2µA standby 8/16-bit 25 DMIPS, Low Power Industrial, 90nm 1mA/MHz, 100µA standby Industrial & Automotive, 150nm 190µA/MHz, 0.3µA standby 44 DMIPS, True Low Power 10 DMIPS, Capacitive Touch Industrial & Automotive, 130nm 144µA/MHz, 0.2µA standby Format Automotive, 130nm WideIndustrial &LCDs 350µA/MHz, 1µA standby Embedded Security, ASSP © 2012 Renesas Electronics America Inc All rights reserved Enabling the Smart Society Energy efficiency is key to a Smart Society Energy harvesting Home Automation Smart Metering Industrial Motors Motor control is key to efficient energy management © 2012 Renesas Electronics America Inc All rights reserved Agenda Introduction to the Field Oriented Control (FOC) with Sensorless Speed and Position Detection Challenges to implement SVC on 16-bit MCUs RL78G14 special features Implementation with RL78G14 Introduction to the RL78G14 kit Lab procedure Sample motor currents and DC bus voltage Drive motor in open loop Understand sensorless position and speed estimation Drive motor by closing the speed loop Setup Sensorless Vector Control Demo Tune motor operation © 2012 Renesas Electronics America Inc All rights reserved Sensorless Vector Control Loop Inverse Park transform Commanded speed ω r* ∆ω r ωr Actual speed iq * Speed Regulator id = * id iq iq PI Regulator Uq * Uα d,q to id PI Regulator Ud α, β T −1 (θ ) * θ Uβ PWM1~6 * α, β * to a, b, c iq Clarke transform to d,q iα T (θ ) ωr a,b,c to iβ α, β θ Speed Estimation Computation intensive operations © 2012 Renesas Electronics America Inc All rights reserved ia α, β id Voltage Source 3-phase Inverter SIN PWM Motor Model Based Flux and Position Observer Park transform DC Bus Inverse Clarke transform ib 3-phase PMSM Examples of control equations Phase voltages: νa, νb, νc – ia, ib, ic phase currents – Rs stator resistance magnetic flux linkage – λ Clark transformation – 3-phase to 2-phase in stator frame Park transformation – ω – L angular speed mutual inductance © 2012 Renesas Electronics America Inc All rights reserved Challenges of 16-bit MCUs for Motor Control Most 16-bit MCUs are CISC architecture Good code density (smaller memory needed) Execution time may not be fast enough for real-time control Representation of quantities is range limited to 65536 unsigned -32768 to 32768 signed Without FPU scaling needs to be used Scaling limitation Multiply-Accumulate (MAC) operation: a = a + (b * c) d=b*c a=a+d Can the 16-Bit MCUs field oriented sensorless control? Yes with the right performance and peripherals! © 2012 Renesas Electronics America Inc All rights reserved RL78G14: 16-bit MCU for Motor Control 16-Bit CISC CPU Core Memory Program Flash up to 64KB SRAM up to 5.5KB Data Flash up to 4KB System DTC Interrupt Controller Levels, 20 pins Clock system Analog 20MHz External Clock 32.768KHz Internal OCO up to 64MHz Motor Control Support Timers External Clock x Timer Array 16-bit, 4ch ADC 10-bit, 12ch Interval Timer 12-bit, 1ch Internal Vref POR, LVD Internal LOCO 15KHz Window WDT 17-bit , 1ch Temp Sensor MUL/DIV/MAC Clock Monitoring RTC Calendar Communications Debug Single-Wire Safety Power Management Parity Check/protection HALT RTC,DMA Enabled ADC Self-diagnostic SNOOZE Serial,ADC Enabled SFR protection STOP SRAM On Memory CRC RAM x I2C Master / Slave Motor Control 3ph MC Timer RD 16-bit with dead time Encoder Timer RG 16-bit, 1ch Timer RJ 16-bit , 1ch ELC © 2012 Renesas Electronics America Inc All rights reserved 41 DMIPS @32MHz 3-stage pipelined Harvard architecture MUL/DIV/MAC instructions 16-Bit Barrel Shifter x I2C Multi-Master x CSI/SPI 7-, 8-bit x UART 7-, 8-, 9-bit x LIN 1ch 16-Bit Motor Control Timers – 64MHz / 1% Internal Clock – RD for 3-Phase PWM – RJ for interrupt culling – RG for quadrature encoder ADC trigger Event Link Controller (ELC) Data Transfer Controller (DTC) Hardware Safety – Independent Watchdog – Hardware shutdown Self-test o Flash ECC, RAM Parity, H/W CRC, WDT, A/D, RAM/SFR write protect, Clock monitor High Performance Optimized Architecture 16-bit CPU core with pipelining Efficient instruction execution – 86% in 1-2 cycles Single cycle multiplication (HW math assist) Data transfer controller (up to 24 channels) HW math assist 16-bit barrel shifter multiply signed & unsigned multiply/accumulate signed & unsigned 10 © 2012 Renesas Electronics America Inc All rights reserved Operation Clock cycles shift/rotate by n (n = 1-15) 16 x 16 = 32 Bit result 16 x 16 + 32 = 32 Bit result RL78/G14 Use for Motor Control Control loop cycle management PWM interrupt culling (skipping) – Timer RD: PWM frequency - 24KHz – Timer RJ: CPU Event count mode Count down from to – ELC : Interrupt Controller Timer RD Input from Timer RD Output to Timer RJ ELC Timer RJ – Control loop frequency set by Timer RJ underflow interrupt @8KHz Timer RD Complementary PWM 15 Timer RJ Event Link Controller TRD1 Underflow Trigger © 2012 Renesas Electronics America Inc All rights reserved Event Input Trigger Event Counter Software Flow – Main Loop Main loop synchronization cnt_init==0? Hardware and software Init cnt_init=NUM_INT Interrupt enabling Main loop body 125us Interrupt Speed ramp management Communication management 10ms Main loop General board management Parameter modification management 16 © 2012 Renesas Electronics America Inc All rights reserved Software Flow – Control Interrupt Phase current reading Park and Clarke transformations iu, iv, iw iα, iβ id, iq DC bus voltage reading Rotor phase angle calculation Current PI processing (idref, iqref), (idmea, iqmea), vdout, vqout Inverse Clarke and Park transformations vdout, vqout vαout, vβout, vuout, vvout, vwout PWM duty update Rotor phase estimation: θest Speed estimation: ωest Speed PI processing or Start up Main loop synchronization 17 © 2012 Renesas Electronics America Inc All rights reserved Physical quantities represented as 16-bit signed integers 32-Bit: -2147483648 to +2147483648 16-Bit: -32768 to +32768 sin(), cos(): -16384 to +16384 Voltages (V): (0 to 511.9) x 64 32768 Currents (A): (0 to 32) x 1024 32768 Resistance (Ω): (0 to 128) x 256 32768 Inductance (Henry): (0 to 2) x 16384 32768 Magnetic flux (Weber): 18 (-1 to +1) x 16384 (0 to 8) x 4096 32768 © 2012 Renesas Electronics America Inc All rights reserved High Integration = Cost Reduction Reduce system BOM by eliminating external components Voltage Regulator (1.6V to 5.5V input) Supply EEPROM IC Dedicated flash memory for data storage (Data Flash) Regulator IC Voltage Monitoring REG Reset IC DATA FLASH RL78 CPU LVD SRAM POR WDT PERIPHERALS Internal Reset CODE FLASH OCO Accurate Internal Oscillators Temp Sensor PERIPHERALS X1 Temp IC 19 © 2012 Renesas Electronics America Inc All rights reserved Temperature Sensor 20mA port drive (no need for external transistors) IEC60730 in HW (Easier/quicker certification) Sensorless Vector Control Lab Agenda Sample motor currents and DC bus voltage Drive motor in open loop Understand sensorless position and speed estimation Drive motor by closing the speed loop 20 Setup Sensorless Vector Control Demo Tune motor operation © 2012 Renesas Electronics America Inc All rights reserved Introduction to the RL78G14 Kit 21 © 2012 Renesas Electronics America Inc All rights reserved RL78G14 Kit 22 © 2012 Renesas Electronics America Inc All rights reserved RL78G14 Board 23 © 2012 Renesas Electronics America Inc All rights reserved Lab Overview Lab Objectives Lab Materials Get familiar with the RL78G14 starter kit and drive the motor Please verify you have the following materials at your lab station Understand ADC sampling to measure motor currents and DC bus voltage Drive the motor in open loop Understand sensorless position and speed estimation Drive motor by closing the speed loop Understand motor tuning RL78G14 Motor Control Evaluation Kit with E1 emulator, two USB cables, 24V DC power supply, control board and motor Laptop with the CD drive Skill Level Familiar with motor control techniques Time to Complete Lab 100 Minutes 24 © 2012 Renesas Electronics America Inc All rights reserved Familiar with sensorless vector control concepts Familiar with IAR Embedded Workbench Enabling the Smart Society Energy efficiency is key to a Smart Society Energy harvesting Home Automation Smart Metering Industrial Motors Motor control is key to efficient energy management 25 © 2012 Renesas Electronics America Inc All rights reserved Questions? 26 © 2012 Renesas Electronics America Inc All rights reserved Start Lab Please refer to the lab handout Go ahead and start the lab 27 © 2012 Renesas Electronics America Inc All rights reserved Summary Introduced FOC with sensorless speed and position detection Challenges to implement SVC on 16-bit MCUs RL78G14 special features Implementation with RL78G14 Introduced the RL78G14 kit Lab procedure Sampled motor currents and DC bus voltage Drove motor in open loop Examined sensorless position and speed estimation Drove motor by closing the speed loop 28 Setup sensorless vector control demo Tuned motor operation © 2012 Renesas Electronics America Inc All rights reserved Renesas Electronics America Inc © 2012 Renesas Electronics America Inc All rights reserved ... closing the speed loop Setup Sensorless Vector Control Demo Tune motor operation © 2012 Renesas Electronics America Inc All rights reserved Sensorless Vector Control Loop Inverse Park transform... Introduced FOC with sensorless speed and position detection Challenges to implement SVC on 16-bit MCUs RL78G14 special features Implementation with RL78G14 Introduced the RL78G14 kit ... 24 © 2012 Renesas Electronics America Inc All rights reserved Familiar with sensorless vector control concepts Familiar with IAR Embedded Workbench Enabling the Smart Society Energy efficiency