AVR32723: Sensor Field Oriented Control for Brushless DC motors with AT32UC3B0256. 32-bit Microcontrollers. Application Note. Features.



Similar documents
32-bit AVR UC3 Microcontrollers. 32-bit AtmelAVR Application Note. AVR32769: How to Compile the standalone AVR32 Software Framework in AVR32 Studio V2

How To Use An Atmel Atmel Avr32848 Demo For Android (32Bit) With A Microcontroller (32B) And An Android Accessory (32D) On A Microcontroller (32Gb) On An Android Phone Or

AVR1922: Xplain Board Controller Firmware. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR32138: How to optimize the ADC usage on AT32UC3A0/1, AT32UC3A3 and AT32UC3B0/1 series. 32-bit Microcontrollers. Application Note.

Atmel AVR4921: ASF - USB Device Stack Differences between ASF V1 and V2. 8-bit Atmel Microcontrollers. Application Note. Features.

Atmel AVR4920: ASF - USB Device Stack - Compliance and Performance Figures. Atmel Microcontrollers. Application Note. Features.

AVR115: Data Logging with Atmel File System on ATmega32U4. Microcontrollers. Application Note. 1 Introduction. Atmel

Atmel AVR4903: ASF - USB Device HID Mouse Application. Atmel Microcontrollers. Application Note. Features. 1 Introduction

AVR1900: Getting started with ATxmega128A1 on STK bit Microcontrollers. Application Note. 1 Introduction

AVR1510: Xplain training - XMEGA USART. 8-bit Microcontrollers. Application Note. Prerequisites. 1 Introduction

A Hadoop Job Scheduling Model Based on Uncategorized Slot

Boolean Algebra. ECE 152A Winter 2012

AVR32701: AVR32AP7 USB Performance. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

AVR1318: Using the XMEGA built-in AES accelerator. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

APPLICATION NOTE. Atmel AVR443: Sensor-based Control of Three Phase Brushless DC Motor. Atmel AVR 8-bit Microcontrollers. Features.

Engineer-to-Engineer Note

WiMAX DBA Algorithm Using a 2-Tier Max-Min Fair Sharing Policy

Canon NTSC Help Desk Documentation

Experiment 6: Friction

AntiSpyware Enterprise Module 8.5

8-bit. Application Note. Microcontrollers. AVR282: USB Firmware Upgrade for AT90USB

Welch Allyn CardioPerfect Workstation Installation Guide

AVR32788: AVR 32 How to use the SSC in I2S mode. 32-bit Microcontrollers. Application Note. Features. 1 Introduction

Application Note. 8-bit Microcontrollers. AVR270: USB Mouse Demonstration

Newton-Raphson Method of Solving a Nonlinear Equation Autar Kaw

Optimal Pricing Scheme for Information Services

APPLICATION NOTE. Atmel AVR134: Real Time Clock (RTC) Using the Asynchronous Timer. Atmel AVR 8-bit Microcontroller. Introduction.

Reasoning to Solve Equations and Inequalities

Resistive Network Analysis. The Node Voltage Method - 1

Vector Geometry for Computer Graphics

AVR1309: Using the XMEGA SPI. 8-bit Microcontrollers. Application Note. Features. 1 Introduction SCK MOSI MISO SS

AVR1321: Using the Atmel AVR XMEGA 32-bit Real Time Counter and Battery Backup System. 8-bit Microcontrollers. Application Note.

Irregular Repeat Accumulate Codes 1

YOU FINALLY FINISHED YOUR FILM. NOW WHAT? Distributor...? Sales agent...? GOT IT: SELF DISTRIBUTION

AVR287: USB Host HID and Mass Storage Demonstration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

AT91SAM ARM-based Flash MCU. Application Note

VRT012 User s guide V0.1. Address: Žirmūnų g. 27, Vilnius LT-09105, Phone: (370-5) , Fax: (370-5) , info@teltonika.

AVR1600: Using the XMEGA Quadrature Decoder. 8-bit Microcontrollers. Application Note. Features. 1 Introduction. Sensors

Small Business Networking

AVR1301: Using the XMEGA DAC. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Project 6 Aircraft static stability and control

Engineer-to-Engineer Note

AVR033: Getting Started with the CodeVisionAVR C Compiler. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

USER GUIDE EDBG. Description

How To Network A Smll Business

ALABAMA ASSOCIATION of EMERGENCY MANAGERS

AVR2006: Design and characterization of the Radio Controller Board's 2.4GHz PCB Antenna. Application Note. Features.

Small Business Cloud Services

Three-Phase Induction Generator Feeding a Single-Phase Electrical Distribution System - Time Domain Mathematical Model

AVR319: Using the USI module for SPI communication. 8-bit Microcontrollers. Application Note. Features. Introduction

UNLOCKING TECHNOLOGY IVECO

APPLICATION NOTE. Atmel LF-RFID Kits Overview. Atmel LF-RFID Kit. LF-RFID Kit Introduction

Use Geometry Expressions to create a more complex locus of points. Find evidence for equivalence using Geometry Expressions.

Small Business Networking

MATH 150 HOMEWORK 4 SOLUTIONS

AVR305: Half Duplex Compact Software UART. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Using CryptoMemory in Full I 2 C Compliant Mode. Using CryptoMemory in Full I 2 C Compliant Mode AT88SC0104CA AT88SC0204CA AT88SC0404CA AT88SC0808CA

Fuzzy Clustering for TV Program Classification

trademark and symbol guidelines FOR CORPORATE STATIONARY APPLICATIONS reviewed

Space Vector Pulse Width Modulation Based Induction Motor with V/F Control

APPLICATION NOTE Atmel AT02509: In House Unit with Bluetooth Low Energy Module Hardware User Guide 8-bit Atmel Microcontroller Features Description

Section 5.3 Annuities, Future Value, and Sinking Funds

Atmel AT32UC3A3256 microcontroller 64MBit SDRAM Analog input (to ADC) Temperature sensor RC filter

ORIGIN DESTINATION DISAGGREGATION USING FRATAR BIPROPORTIONAL LEAST SQUARES ESTIMATION FOR TRUCK FORECASTING

Application Note. Atmel ATSHA204 Authentication Modes. Prerequisites. Overview. Introduction

AVR030: Getting Started with IAR Embedded Workbench for Atmel AVR. 8-bit Microcontrollers. Application Note. Features.

Atmel AVR ATxmega384C3 microcontroller OLED display with pixels resolution Analog sensors. Ambient light sensor Temperature sensor

AVR353: Voltage Reference Calibration and Voltage ADC Usage. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

Luby s Alg. for Maximal Independent Sets using Pairwise Independence

APPLICATION NOTE. AT07175: SAM-BA Bootloader for SAM D21. Atmel SAM D21. Introduction. Features

Application Note. 8-bit Microcontrollers. AVR272: USB CDC Demonstration UART to USB Bridge

Small Business Networking

Graphs on Logarithmic and Semilogarithmic Paper

Small Business Networking

APPLICATION NOTE. Atmel AT02985: User s Guide for USB-CAN Demo on SAM4E-EK. Atmel AVR 32-bit Microcontroller. Features. Description.

EN3: Introduction to Engineering. Teach Yourself Vectors. 1. Definition. Problems

Models and Software for Urban and Regional Transportation Planning : The Contributions of the Center for Research on Transportation

AVR317: Using the Master SPI Mode of the USART module. 8-bit Microcontrollers. Application Note. Features. Introduction

Binary Representation of Numbers Autar Kaw

USER GUIDE. ZigBit USB Stick User Guide. Introduction

How To Set Up A Network For Your Business

Vendor Rating for Service Desk Selection

Introducing a platform to facilitate reliable and highly productive embedded developments

Section 5.2, Commands for Configuring ISDN Protocols. Section 5.3, Configuring ISDN Signaling. Section 5.4, Configuring ISDN LAPD and Call Control

Atmel AVR1017: XMEGA - USB Hardware Design Recommendations. 8-bit Atmel Microcontrollers. Application Note. Features.

Faraday's Law of Induction

YIELD CURVE FITTING 2.0 Constructing Bond and Money Market Yield Curves using Cubic B-Spline and Natural Cubic Spline Methodology.

Incorporating Negative Values in AHP Using Rule- Based Scoring Methodology for Ranking of Sustainable Chemical Process Design Options

APPLICATION NOTE. Atmel AT01095: Joystick Game Controller Reference Design. 8-/16-bit Atmel Microcontrollers. Features.

SMARTCARD XPRO. Preface. SMART ARM-based Microcontrollers USER GUIDE

MENT STATUS. cd subject to resolution of indicated comments, :ptance or approval of design detiuls, calculations, the supplier and does not relieve

Lecture 3: Force of Interest, Real Interest Rate, Annuity

Morgan Stanley Ad Hoc Reporting Guide

8051 Flash Microcontroller. Application Note. A Digital Thermometer Using the Atmel AT89LP2052 Microcontroller

General Porting Considerations. Memory EEPROM XRAM

VoIP for the Small Business

Recurrence. 1 Definitions and main statements

How To Design An Ism Band Antenna For 915Mhz/2.4Ghz Ism Bands On A Pbbb (Bcm) Board

This circuit than can be reduced to a planar circuit

Transcription:

AVR7: Sensor Feld Orented Control for Brushless DC motors wth ATUCB056 Fetures Stndlone Spce Vector Modulton lbrry for AVR UC mcrocontroller. Prk nd Clrke mthemtcl trnsformton lbrry for AVR UC mcrocontroller. Theory of Feld Orented Control. PC pplcton for rel tme motor remote control nd dsply of regulted vrbles. -bt Mcrocontrollers Applcton Note 1 Introducton Ths pplcton note delvers n mplementton of Sensor Feld Orented Control lgorthm for brushless DC motor on Atmel AVR UCB mcrocontrollers. Ths softwre ncludes stndlone lbrres for ll mthemtcl trnsformtons requred by the lgorthm. For more nformton bout the AVR rchtecture, plese refer to the pproprte documents vlble from http://www.tmel.com/vr. Requrements The softwre provded wth ths pplcton note requres severl components: A computer runnng Mcrosoft Wndows 000/XP/Vst or Lnux AVRStudo nd the GNU toolchn (GCC) or IAR Embedded Workbench for AVR compler. A JTAGICE mkii or AVROne! debugger Rev. 16A-AVR-06/09

Theory of Operton.1 Overvew. Block Dgrm As contnuty n the energy effcency process, the ncrese of cpblty of mcrocontrollers llows to mplement complex lgorthm s Feld Orented Control methodology whch llows to: Reduce power consumpton (less power loss) of electrcl motor drvng. Provde smoother nd more ccurte motor control thn snusodl commnd wth hll feedbck. Optmze motor choce (torque): fnd the best lterntve between dmenson nd power. But ths lgorthm requres more complex computton nd requres more CPU bndwdth thn stndrd lgorthms. Moreover, ths commnd strtegy fts wth some brushless DC motors wth dynmcl lod chnges due to reducton of response tme. It llows regultng torque nd speed t the sme tme. The followng block dgrm descrbes the prncple of the lgorthm. Indeed, t s bsed on: A vectorl commnd for -phses Brushless DC Motors. A perodc current smplng of the shunts locted on these -phses. encpsulted regulton loops: one for the current (torque nd power loss) nd nother for the speed. Fgure -1. Block Dgrm -phses current (I,Ib,Ic) Feld Orented Control Block Current Regulton loop Vectorl Commnd Speed Trget Speed Regulton loop Speed nd Poston AVR7 16A-AVR-06/09

AVR7. System Overvew As shown Fgure -, the -phses current re mesured nd one Hll Effect feedbck s used to compute feld orented control lgorthm. Fgure -. System Overvew PWM -phses Inverter PWM_XH PWM_XL PWM_YH PWM_YL -phses BLDC PWM_ZH ATUCB056 (56K flsh, K RAM) Sensor FeldOrented Ccontrol Process PWM_ZL IA IB IC Current Speed Hll Effect A USB Tsk USB-CDC PC 16A-AVR-06/09

The USB connecton s used through PC pplcton for rel tme motor remote control nd dsply of regulted vrbles. Ths dt montor dsplys feedbck control remotely. Ths GUI provdes: - grphs nd 1 cursor dsply. - 4 nputs control. The purpose s to be ble to connect to the pplcton wthout dsturbng the behvor of the pplcton. The pplcton offers the followng fetures: - Implements vector control of Brushless DC motor. - Speed rnge from 400 rpm to 000 rpm. 1 - Wth 100 µsec control loop, the CPU s used t 5% by the Sensor Feld Orented Control Process t 4MHz. - Dsply n rel tme the current nd speed mesured. - Control of speed n rel tme. 4 AVR7 1 See secton 5.9 for the explnton of ths lmtton. 16A-AVR-06/09

AVR7 16A-AVR-06/09 4 Motor Control Theory 4.1 Generl Model. The mthemtcl model n constnt domn lnked to the sttor s lnked to dfferentl equton wth constnt coeffcents defnng the motor behvor. Applyng the Lenz-Frdy model, we hve: [ ] [ ] [ ] bc bc bc dt d I R V + Wth: [ ] c b bc v v v V, [ ] c bc I b nd [ ] c b bc R s the sttorc resstnce, [ ] t c b v v v re the sttorc voltges, [ ] t c b re the sttorc current nd [ ] t c b re the globl felds n the sttorc solenod. [ ] [ ][ ] [ ] sf bc Ibc L + We cn wrte : Ls (constnt) s the nductnce n sttorc gyres. M (constnt) s the mutul nductnce between the sttorc gyres θ s the electrcl poston of the rotor (θ θ élec ) Ф sf s the mx vlue (constnt) of the flux crete by the permnents mgnet through the sttorc gyres. + + + ) cos( ) cos( ) cos( π θ π θ θ sf sf sf c b c b c b dt d Ls M M M Ls M M M Ls dt d R v v v In order to smplfy the mthemtcl resoluton of ths system, some mthemtcl trnsformtons re used. Usng the Prk P1(θ), the nstntneous power s kept nd t llows to hve mthemtcl expresson of the torque stll cceptble for the rel motor. [ ] + + ) cos( ) cos( ) cos( π θ π θ θ sf sf sf c b bc Ls M M M Ls M M M Ls

Usng the Prk nverse trnsformton, t s possble to return to the vlues spce from regulted vlues nd generte commnds. 4.1.1 Prk Trnsformton (P1(θ)) nd Clrke Trnsformton (nv P-1(θ)). The Prk trnsformton s defned from the mtrx P1(θ), t defnes the lnk between the rel vectors [ V bc], [ I bc] et[ bc], the new vectors [ V 0 dq],[ I 0 dq] et[ 0dq]. 1 cos( θ ) 1 π P 1( θ ) cos( θ ) 1 π cos( θ ) Fgure 4-1. Prk Trnsformton sn( θ ) π sn( θ ) π sn( θ ) V q v b V d v [P1(θ)] -1 θ v [x bc ]P1(θ)[X 0dq ] V 0 v c Wth V 0 0V, I 0 0A nd 0 0Wb, the normlzed Prk trnsformton s the ddton the Concord Trnsformton T nd the rottng mtrx p(θ) : + 0 1 cosθ snθ T + p ( θ) snθ cosθ Fgure 4-. D to D Trnsformton x x b x c T t x α x β P(-θ) X d X q 6 AVR7 The Prk nd Clrke trnsformtons re mplemented s softwre lbrry component n the softwre pckge ssocted wth ths pplcton note. See lso secton 5. 16A-AVR-06/09

AVR7 4. Power Brdge Commnd. The power brdge stge s here to power the BLDC motor wth lterntves voltges from contnuous source. Ths brdge llows modultng frequency nd mpltude. Fgure 4-. Power Brdge Stge I T T b T c E b b b n c c c T T b T c m C C C b C b C c C c Fgure II-1 Onduleur de tenson trphsé. Power Brdge Stge The logcl sgnls C, C, Cb, C b, Cc nd C c re commnd sgnls for the power brdge. The output voltges re gven from the ground m of source genertor nd from the vrtul neutrl pont n of BLDC motor. V V V m bm cm C E Cb Cc (II-1) V V V m bm cm V V V n bn cn + V + V + V nm nm nm For n equlbrted lod: n + Vbn + Vcn 0 In tht wy, we hve: V V, so : V nm ( Vm + Vbm + Vcm) 1. V V V n bn cn 1 1 1 1 1 1 V 1 V V m bm cm E 1 1 1 1 1 C 1 Cb Cc 16A-AVR-06/09

Or : 1 1 V n t 1 t T. 1 1 Vα t T. nd T Vbn 1 1 Vβ Vcn C Vα t t We conclude so: T. E b C, ( T s the trnslton of T ) Vβ Cc The followng tble gves the voltge vlues n the spces (α, β ) nd (, b, c). Tble 4-. Voltge Vlues n the spces (α, β ) nd (, b, c) Vector C C b C c V α V β V n V bn V cn V 0 0 0 0 0 0 0 0 0 V 1 1 0 0 1 0-1 -1 V 1 1 0 1 1 1 - V V 4 0 1 0 0 1 1 E 1-1 0 E -1-1 - 1 1 V 5 0 0 1 1-1 -1 V 6 1 0 1 1 1-1 V 7 1 1 1 0 0 0 0 0 We show tht ll vectors components (V α, V β ) re wth modules locted n the regulr hexgon. E nd re Fgure 4-4. Spce Vector vlues n the regulr hexgon. (0, 1, 1) (0, 1, 0) V 4 V V β V 1 4 5 6 V 5 (0, 0, (1, 1, V 6 (1, 1, 0) V 1 (0, 0, 1) (1, 0, 1) (1, 0, 0) V α 8 AVR7 16A-AVR-06/09

4..1 Spce Vector PWM. The vectorl modulton uses drectly the sgnl for the Concord trnsformton. It AVR7 supposes tht regulton loop s ever mplemented for the generton of V α nd V β components. As stted below, t nstntneous pont, the power brdge s ble to generte only 8 voltges (V, 0,,7) n the spce of trnsformton Concord (V α, V β ) wth two components equl to 0 nd 6 wth the module equl to E nd the ngle to ( π ) ( 1). Two successve vectors, clled V nd V +1 defned sector (Fgure 4-4) wth I from the ntervl [I, VI]. V V V α β E π cos ( 1) E π sn ( 1) π 1 p ( 1) 0 The power stge s only ble to delver voltges nstntneous voltges on smplng perod T, we cn wrte: ( Vαβ ) δ V+ δ + 1 V + 1 Where δ nd δ + 1 re the durton for reltve vlues re the reltves voltges when V nd V +1 ; δ V nd δ + 1 V + 1 re the projecton of vector (V αβ ). The Spce Vector Modulton s mplemented s softwre lbrry component n the softwre pckge ssocted wth ths pplcton note. See lso secton 5. 16A-AVR-06/09

Fgure 4-5. Sector Determnton Algorthm. V α nd V β Yes No V β 0 1 or or 4 or 5 or 6 Yes V α 0 No Yes V α 0 No 1 or or 5 or 6 4 or 5 Yes No Yes No Yes No Yes V β - V α 0 V β + V α 0 n V β + V α 0 V β - V α 0 No Yes 1 5 6 5 4 In ll cses, t s needed to determned sector number where s locted the vector V. To reduce tme executon computng δ et δ + 1, we hve used ths lgorthm. In tht wy, δ et δ + 1 re clculted drectly from V α nd V β : And so V V α β V δ V α β + δ V α + 1 V β + 1 V V α β E π 1 δ p ( 1) + 0 Π p( δ + 1 1 ) 0 10 AVR7 16A-AVR-06/09

AVR7 Tble 4-. Sector expressons Sector 1 T 1 τ 1 + τ + τ 0 T τ + τ 0 T τ 0 T 1 τ + τ 0 T τ + τ + τ 0 T τ 0 4 T 1 τ 0 T τ + τ 4 + τ 0 T τ 4 + τ 0 T 1 τ 0 T τ 4 + τ 0 T τ 5 + τ 4 + τ 0 5 T 1 τ 0 + τ 6 T τ 0 T τ 0 + τ 5 + τ 6 6 T 1 τ 0 + τ 1 + τ 6 T τ 0 T τ 0 + τ 6 16A-AVR-06/09

4. Current Mesurement Stge Three dentcl shunts re used to red the current I,Ib nd Ic. These vlues should be mplfed to be n the rnge of the ADC. Indeed, f we mesure current of severl mllmps (500mA), the mxmum voltge s round 0.05V. Fgure 4-6. Amplfer stge R Shun R R VA - + R ADC V V1 V1 V R V Offset For exmple: R Vs Offset + ( V V1) R1 When mesurng the three currents I,Ib nd Ic, only two mesures re requred, ndeed I + Ib + Ic 0. Fgure 4-7. ADC nd PWM synchronzton T T PWM T1 ADC t m t m t m t The ADC mesures re done every perod of the PWM. The frst ADC mesure should be done n the tme rnge nmed tm. Ths tme s the mnmum tme where none of the -phses re drven. For exmple: In cse of sector 1, T1 s the longest tme so t mens tht T1 > T-tm, n tht cse t s not possble to mesure I. So Ib nd Ic re mesured nd I s derved from the two others mesures wth the equton I Ib Ic. 1 AVR7 16A-AVR-06/09

AVR7 4.4 Current regulton nd speed Regulton 4 In order to reduce tme consumng effect of regultor, we hve used the Integrtor Proportonl (IP) regultor. 4.4.1 Current Regulton In contnuous domn, the closed loop hs the mthemtcl expresson: K Id Idref Lc s + ( R + Kd ) s + K It s possble to esly dentfy the second order of the trnsfer functon: Wth s + ε ωn s + ωn n nd Kd K Lcω εω Lc R n These correctors hve been chosen to hve deprecton rte ε nd response tme of 5 (T r W n ). Fgure 4-8. Response tme vs Deprecton rte. Response Tme Deprecton rte For tht ω n R L c wth K 4R Lc nd Kd 7. R 4.4. Speed Regulton The externl closed loop for speed regulton hs the followng mthemtcl expresson: Ω Ω ref J s K + Kdv s + K Kv Wth ωn et ε ωn J v s K J dv + ε ωn s + ωn 4 The PI regultor s mplemented s softwre lbrry component n the softwre pckge ssocted wth ths pplcton note. See lso secton 5. 16A-AVR-06/09

4.5 Executon Tme nd Regulton Loop We choose ω n 0.1R/L c nd ε, So K R.01 L v 0 J et Kdv 0. 4 c R J Lc The followng tble gves the number of opertons for ech functon Tble 4-. Opertons costs Functon Add Mul Dv Shft Concord 7 0 0 17 bc-to- αβ Clrk 4 0 6 αβ-to-dq Clrk Inv 4 0 6 dq-to- αβ Regulton 7 4 0 14 Decouplng 5 5 0 6 SVPWM 7 0 0 54 14 AVR7 5 The decouplng stge s the stge to seprte torque nd power loss regultons fter the current mesurement stge. The de s to be sure to only regulte torque (wthout dsturbng the power loss loop). 16A-AVR-06/09

AVR7 4.6 Generl Algorthm As shown n Fgure 4-9, the regulton_loop_tsk() process s sequenced on tck reference (every 100µs). Ths tsk synchronzes current mesurement nd computes ll mthemtcl trnsformtons to execute the Feld Orented Control lgorthm. Insde ths tsk, there re two regulton loops nterlnked: - Current regulton loop. - Speed regulton loop. Fgure 4-9. Regulton Loop Tsk Step Mchne regulton_loop_tsk() MC_current_mesurement() Current mesurement of the -phses Hll Interrupt Yes No Wt hll_estmtor_updte() Updte Tet nd Speed vlues Compute new Tet nd Speed Clrke() Relze the Clrke Trnsformton prk() Relze the Prk Trnsformton Speed Regulton? Yes Proceed Speed Regulton No prk_nv() Execute Speed Regulton ² Relze the Inverse Prk Trnsformton Current Regulton Execute Current Regulton svpwm() Compute new vectorl commnd Messge Redy? Prepre New Messge for the HMI CDC Tsk Sleep() 16A-AVR-06/09

5 Source Code Archtecture 5.1 Softwre Archtecture Fgure 4-10. Softwre Archtecture Feld Orented Control pplcton mn.c CDC communcton tsk HMI usb_tsk() devce_cdc_tsk() devce_cdc_tsk.c Motor Control regulton_loop_tsk() Motor Drver mc_control.c mc_drver.c Motor Control Lbrry PI Regultor SERVICES/MOTOR//PI Spce Vector Modulton SERVICES/MOTOR/SVPWM PARK SERVICES/MOTOR/PARK CLARKE SERVICES/MOTOR/CLARKE HALL ESTIMATOR SERVICES/MOTOR/HALL DRIVERS usb.c dc.c pwm.c flshc.c pm.c gpo.c Ths pplcton does not requre ny opertng system to run. The mn() functon s n chrge of cllng the softwre «tsks» (usng scheduler) relzng FOC lgorthm computton nd USB communcton wth the Communcton Devce Clss (CDC) for HMI mngement. There re tsks: regulton_loop_tsk()the regulton tsk tht computes ll clculton for dedcted FOC lgorthm. usb_tsk() / devce_cdc_tsk()the USB Tsk: Ths tsk s n chrge of the CDC communcton mngement. The mn loop of the pplcton s smple free-runnng tsk scheduler: whle(true) { #fdef USB_DEBUG usb_tsk(); devce_cdc_tsk(); #endf mc_regulton_tsk(); } 16 AVR7 16A-AVR-06/09

AVR7 5. Pckge The EVK1101-SENSOR-FIELD-ORIENTED-CONTROL-X.Y.Z.zp contns projects for ATUCB056 RevF or lter: EVK1101-SENSOR-FIELD-ORIENTED-CONTROL-X.Y.Z Defult hrdwre confgurton of the project s to run on the EVK1101 bord, lthough ny bord cn be used (refer to secton 5.5.5) 5. Documentton For full source code documentton, plese refer to the uto-generted Doxygen source code documentton found n: AVR7/APPLICATIONS/EVK110x-MOTOR-CONTROL/BLDC- FOC/EXAMPLE/redme.html 5.4 Projects/ Compler The IAR project s locted here: src/ APPLICATIONS/EVK110x-MOTOR-CONTROL/BLDC-FOC/EXAMPLE/IAR/ The GCC mkefle s locted here: src/ APPLICATIONS/EVK110x-MOTOR-CONTROL/BLDC-FOC/EXAMPLE/GCC/ The AvrStudo project s locted n the root-dr of the pckge: -./ 5.5 Implementtons Detls 5.5.1 Mn() The mn() functon of the progrm s locted n the fle: src/applications/evk110x-motor-control/bldc-foc/example/mn.c Ths functon wll: Intlze PWM outputs for Spce Vector Generton. Intlze ADC nputs for -phses current mesurement. Intlze USB connecton for CDC HMI connecton. 5.5. Motor Control Lbrry The motor control lbrry s locted here: src/services/motor_control/ Ths folder delvers: The Prk nd Clrke trnsformtons explned n secton 4.1.1 re delvered n the folder src/services/motor_control/park_clarke/ The Spce Vector Modulton explned n secton 4..1 s delvered n the folder src/services/motor_control/svpwm/ 16A-AVR-06/09

5.5. HMI CDC Tsk The HMI CDC Tsk s locted here: src/applications/evk110x-motor-control/bldc- FOC/EXAMPLE/devce_cdc_tsk.c Ths tsk receves nd sends messges through the USB communcton. Wth: The messge defnton locted n src/applications/evk110x-motor- CONTROL/BLDC-FOC/EXAMPLE/ENUM/frme.h 5.5.4 ATUCB Drvers The exmple frmwre uses the AVR UC drver lbrry vlble n src/utils/libs/drivers/atucb/ 5.5.5 Bord Fle Defnton 5.5.5.1 Bord customzton The pplcton s desgned to run on the EVK1101. All projects re confgured wth the followng defne: BOARDEVK1101. The EVK1101 defnton cn be found n the src/boards/evk1101 drectory. For IAR project, open the project optons (Project -> Optons), choose the «C/C++ Compler», then «Preprocessor». Modfy the BOARDEVK1101 defnton by BOARDUSER_BOARD. For GCC, just modfy n the confg.mk fle (src/applications/evk110x-motor-control/bldc-foc/example/gcc) the DEFS defnton wth D BOARDUSER_BOARD. For AvrStudo, open the project propertes (Project -> Propertes), go n the «C/C++ buld», then «Settngs», «tool settngs» nd «Symbols». Modfy the BOARDEVK1101 defnton by BOARDUSER_BOARD. 5.6 Project Confgurton The project confgurton fles cn be found n the src/applications/evk110x- MOTOR-CONTROL/BLDC-FOC/EXAMPLE/CONF/ drectory. Confgurton fles re not lnked to IAR, GCC or AvrStudo projects. The user cn lter ny of them, then rebuld the entre project n order to reflect the new confgurton. /CONF: confgurton heder fles of demo modules: CPU settngs, Perpherl Clock settngs nd Motor settngs 5.7 GUI Applcton The GUI pplcton nstller s locted here: src/applications/evk110x-motor-control/bldc-foc/labview/foc_gu.ms The USB drver s locted here: 18 AVR7 src/applications/evk110x-motor-control/bldc-foc/labview/usb_cdc.nf 16A-AVR-06/09

5.8 CPU Cost nd Memory Usge for Sensor Feld Orented Control lgorthm. AVR7 All results re gven usng IAR Workbench 5. compler revson.10a wth speed optmzton level nd Hmtrx optmzton. Crter CPU Occupton Code Sze Dt Const Result 5% wth tck vlue of 100 us t 4MHz. 17Kb 1Kb.5Kb 5.9 Lmtton of the Sensor Feld Orented Control lgorthm. All the pplcton hs been mplemented wth fxed pont lbrry wrtten n -bt formt (Q1.1) 6. The usge of ths lbrry llows ccelerted computtons but t genertes some lmttons n the vrton rnge of ech vrble. For exmple, when computng current regulton, every ADC smples re scled by vrble nmed E. Ths vrble mtches rto of the bus voltge. In the current mplementton, ths vrble hs been fxed to hlf of the nomnl voltge of the motor. In tht cse, the nomnl speed s equl to 000 rpm. 6 See the pplcton note: http://www.tmel.com/dyn/resources/prod_documents/doc076.pdf for more detls. 16A-AVR-06/09

5.10 Complng the pplcton 5.10.1 If you re usng AVRStudo The followng steps show you how to buld the embedded frmwre ccordng to your envronment. Lunch vrstudo Crete new AVR C project («Fle» -> «new» -> «AVR C Project»). Fll-n the dlogue box wth project nme, set trget MCU to UCB056 nd press fnsh. Choose Import rchve fle («Fle» -> «mport» ), press the next button. Select the EVK1101-SENSOR-FIELD-ORIENTED-CONTROL-X.Y.Z.zp rchve fle wth the browse button. Select «nto folder», check «Overwrte exstng resources wthout wrnng» nd press the fnsh button. The project s now vlble n the gven project nme. Press the buld button 5.10. If you re usng GCC wth the AVR GNU Toolchn Lod the Code: Plese refer to the pplcton note AVR7: AVR Studo gettng strted Open shell, go to the src/applications/evk110x-motor-control/bldc- FOC/EXAMPLE/GCC/ drectory nd type: mke rebuld progrm run 5.10. If you re usng IAR Embedded Workbench for Atmel AVR Open IAR nd lod the ssocted IAR project of ths pplcton (locted n the drectorysrc/applications/evk110x-motor-control/bldc- FOC/EXAMPLE/IAR) Press the Debug button t the top rght of the IAR nterfce. The project should comple. Then the generted bnry fle s downloded to the mcrocontroller to fnlly swtch to the debug mode. Clck on the Go button n the Debug menu or press F5. 0 AVR7 16A-AVR-06/09

AVR7 5.11 Strt the PC pplcton Plug the EVK1101 to the PC through USB Connecton. The USB enumerton should strt; new serl port ppered n Wndows. Power-up the power brdge. 5.11.1 Feld Orented Control GUI Once the GUI s lunched, the user cn select serl port number nd connect the pplcton. Fgure 4-11. Feld Orented Control GUI Iq Speed Id Serl port 5.11.1.1 Increse Speed Vlue When the speed reference ncreses wth constnt resstve torque vlue, the Iq ncreses smoothly to trget the new speed vlue. The Id remns t 0. Fgure 4-1. Increse Speed Vlue Step Speed Iq When the user wnt to ncrese speed vlue 16A-AVR-06/09

5.11.1. Increse Resstve Torque Vlue The resstve torque vlue ncreses so the mesured speed vlue decreses. To compenste t, the FOC lgorthm should ncrese the Iq reference nd fnlly the speed s regulted. The Id remns t 0. Fgure 4-1. Increse Resstve Torque Vlue Step Speed Iq AVR7 16A-AVR-06/09

AVR7 6 Reference [1] Commnde vectorelle sns cpteur de poston d'une mchne synchrone à mnts permnents Atmel Nntes & IREENA- [] NI LbWndows /CVI http://www.n.com/lwcv/ 16A-AVR-06/09

7 Appendx Fgure 14. Hrdwre Schemtc. 4 AVR7 16A-AVR-06/09

16A-AVR-06/09 AVR7

Dsclmer Hedqurters Interntonl Atmel Corporton 5 Orchrd Prkwy Sn Jose, CA 9511 USA Tel: 1(408) 441-011 Fx: 1(408) 487-600 Atmel As Unt 1-5 & 16, 19/F BEA Tower, Mllennum Cty 5 418 Kwun Tong Rod Kwun Tong, Kowloon Hong Kong Tel: (85) 45-6100 Fx: (85) 7-169 Atmel Europe Le Krebs 8, Rue Jen-Perre Tmbud BP 09 78054 Snt-Quentn-en- Yvelnes Cedex Frnce Tel: () 1-0-60-70-00 Fx: () 1-0-60-71-11 Atmel Jpn 9F, Tonetsu Shnkw Bldg. 1-4-8 Shnkw Chuo-ku, Tokyo 104-00 Jpn Tel: (81) -5-551 Fx: (81) -5-7581 Product Contct Web Ste www.tmel.com Techncl Support Avr@tmel.com Sles Contct www.tmel.com/contcts Lterture Request www.tmel.com/lterture Dsclmer: The nformton n ths document s provded n connecton wth Atmel products. No lcense, express or mpled, by estoppel or otherwse, to ny ntellectul property rght s grnted by ths document or n connecton wth the sle of Atmel products. EXCEPT AS SET FORTH IN ATMEL S TERMS AND CONDITIONS OF SALE LOCATED ON ATMEL S WEB SITE, ATMEL ASSUMES NO LIABILITY WHATSOEVER AND DISCLAIMS ANY EXPRESS, IMPLIED OR STATUTORY WARRANTY RELATING TO ITS PRODUCTS INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, CONSEQUENTIAL, PUNITIVE, SPECIAL OR INCIDENTAL DAMAGES (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF PROFITS, BUSINESS INTERRUPTION, OR LOSS OF INFORMATION) ARISING OUT OF THE USE OR INABILITY TO USE THIS DOCUMENT, EVEN IF ATMEL HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Atmel mkes no representtons or wrrntes wth respect to the ccurcy or completeness of the contents of ths document nd reserves the rght to mke chnges to specfctons nd product descrptons t ny tme wthout notce. Atmel does not mke ny commtment to updte the nformton contned heren. Unless specfclly provded otherwse, Atmel products re not sutble for, nd shll not be used n, utomotve pplctons. Atmel s products re not ntended, uthorzed, or wrrnted for use s components n pplctons ntended to support or sustn lfe. 009 Atmel Corporton. All rghts reserved. Atmel, Atmel logo nd combntons thereof, AVR, AVR Studo nd others, re the regstered trdemrks or trdemrks of Atmel Corporton or ts subsdres. Wndows nd others re regstered trdemrks or trdemrks of Mcrosoft Corporton n the U.S. nd or other countres. Other terms nd product nmes my be trdemrks of others. 16A-AVR-06/09