外文翻译--用SPMC75的PDC定时器做BLDC电机的速度检测.doc_第1页
外文翻译--用SPMC75的PDC定时器做BLDC电机的速度检测.doc_第2页
外文翻译--用SPMC75的PDC定时器做BLDC电机的速度检测.doc_第3页
外文翻译--用SPMC75的PDC定时器做BLDC电机的速度检测.doc_第4页
外文翻译--用SPMC75的PDC定时器做BLDC电机的速度检测.doc_第5页
已阅读5页,还剩29页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

bldc motor speed estimation using pdc timer module1 speed calculation of bldc 1.1 summary of bldcsince current bldc has substituted the electrical commutator for the mechanical one, it eliminates the disadvantages of noise, spark, electromagnetic disturbance, short lifetime, etc. now bldc is provided with advantages of simple structure, dependable operation and easy maintenance as ac motor does, as well as advantages of high efficient, no excitation cost and functional speed regulation as traditional dc motor does. so it is widely used in various fields of industrial control now.1.2 pdc module introduction spmc75f2413a provides two channels of 16 bit pdc (phase detection control, pdc) timers used for capture function and pwm operation. it also supports position detection features for brushless-dc motor application. the pdc timers are very suitable for both mechanical speed calculation, with aci and bldc motor included, and phase commutation for changing current conduction according to position information. figure 1-1 shows the block diagram of entire pdc timers, channel 0 and channel 1. for details of pdc timers specification, please refer to table 1-1.table 1-1 pdc timerfunction pdc timer 0 pdc timer 1 clock sources internal clock: fck/1, fck/4, fck/16, fck/64, fck/256, fck/1024 external clock: tclka, tclkbinternal clock: fck/1, fck/4, fck/16, fck/64, fck/256, fck/1024 external clock: tclka, tclkb io pins tio0a, tio0b, tio0c tio1a, tio1b, tio1c timer general register p_tmr0_tgra, p_tmr0_tgrb, p_tmr0_tgrc p_tmr1_tgra, p_tmr1_tgrb, p_tmr1_tgrc timer buffer register p_tmr0_tbra, p_tmr0_tbrb, p_tmr0_tbrc p_tmr1_tbra, p_tmr1_tbrb, p_tmr1_tbrc timer period and counter register p_tmr0_tpr, p_tmr0_tcnt p_tmr1_tpr, p_tmr1_tcnt capture sample clock internal clock: fck/1, fck/2, fck/4, fck/8 internal clock: fck/1, fck/2, fck/4, fck/8 counting edge count on rising, falling, both edge count on rising, falling, both edge counter clear source cleared on p_tmr0_tgra, p_tmr0_tgrb, p_tmr0_tgrc capture input. cleared on p_pos0_dectdata position detection data changes. cleared on p_tmr0_tpr compare matches. cleared on p_tmr1_tgra, p_tmr1_tgrb, p_tmr1_tgrc capture input. cleared on p_pos1_dectdata position detection data changes.cleared on p_tmr1_tpr compare matches. input capture function yes yes pwm compare match output function 1 output yes yes 0 output yes yes output hold yes yes edge-aligned pwm yes yes center-aligned pwm yes yes phase counting mode yes, phase inputs are tclka/tclkb yes, phase inputs are tclk c/tclkd timer buffer operation yes yes ad convert start trigger p_tmr0_tgra compare match p_tmr1_tgra compare matchinterrupt sources timer 0 tpr interrupt timer 0 tgra interrupt timer 0 tgrb interrupt timer 0 tgrc interrupt timer 0 pdc interrupt timer 0 overflow interrupt timer 0 underflow interrupt timer 1 tpr interrupt timer 1 tgra interrupt timer 1 tgrb interrupt timer 1 tgrc interrupt timer 1 pdc interrupt timer 1 overflow interrupt timer 1 underflow interrupt figure 1-1 pdc timers block diagram 1.3 pdc operation this note mainly depicts pdc application in motor speed measurement. for detailed pdc introduction, please refer to “spmc75f2413a programming guide” authored by sunplus. pdc module has four types of registers to perform speed measurement: timer control register p_tmrx_ctrl (x = 0, 1), position detection control register p_posx_dectctrl (x = 0, 1), input output control register p_tmrx_ioctrl (x = 0, 1), and timer interrupt enable register p_tmrx_int (x = 0, 1). where, p_tmrx_ctrl and p_posx_dectctrl are introduced in detail. 1.31input output control register p_tmrx_ctrl(x = 0, 1) b15 b14 b13 b12b11 b10 b9 b8 r/w r/wr/wr/wr/wr/wr/wr/w 0 0 0 0 0 0 0 0 spck mode clegs b7 b6 b5 b4 b3 b2 b1 b0 r/w r/w r/w r/w r/w r/w r/w r/w 0 0 0 0 0 0 0 0 spck mode clegsbit 15:14 spck: capture input sample clock select. these bits select the capture input sample clock. capture input will be sampled with sample clock. pulses shorter than four sample clocks will be considered invalid, and will be ignored.00 = fck/1 01 = fck/210 = fck/4 11 = fck/8bit 13:10 mode: modes select. these bits are used to select the timer operation modes. 0000 = normal operation (continuous counter up counting) 0100 = phase counting mode 1 0101 = phase counting mode 2 0110 = phase counting mode 3 0111 = phase counting mode 4 1x0x = edge-aligned pwm mode (continuous counter up counting, pwm output) 1x1x = center-aligned pwm mode (continuous counter up/down counting, pwm output)bit 9:8 clegs: counter clear edge select. these bits select the counter clearing edge when the clearing source is in input capture mode.00 = do not clear 01 = rising edge 10 = falling edge 11 = both edgebit 7:5 ccls: counter clear source select. these bits select the tcnt counter clearing source. 000 = tcnt clearing disabled 001 = tcnt cleared by p_tmrx_tgra (x = 0, 1) capture input 010 = tcnt cleared by p_tmrx_tgrb (x = 0, 1) capture input 011 = tcnt cleared by p_tmrx_tgrc (x = 0, 1) capture input 100 = tcnt cleared by every p_posx_dectdata (x = 0, 1) change 6 times101 = tcnt cleared by every p_posx_dectdata (x = 0, 1) change 3 times 110 = tcnt cleared by p_posx_dectdata (x = 0, 1) position detection data change 111 = tcnt cleared by p_tmrx_tpr (x = 0, 1) compare matchbit 4:3 ckegs: clock edge select, these bits select the input clock edge. when the input clock is counted using both edges, the input clock period is halved. when fck/1 is selected as counter clock, counter will count at rising edge if count at both edges is selected.00 = count at rising edge 01 = count at falling edge 1x = count at both edgesbit 2:0 tmrps: timer pre-scalar select. these bits select the tcnt counter clock source. it can be selected independently for each channel.000 = counts on fck /1 001 = counts on fck /4 010 = counts on fck /16 011 = counts on fck /64 100 = counts on fck /256 101 = counts on fck /1024 110 = counts on tclka pin input 111 = counts on tclkb pin inputcontrol register configuration p_tmrx_ctrl(x = 0, 1) is used for the selection of input capture during speed measurement. rather than being a general input signal, the input capture is a period between two position detection changes triggered by pdc interrupt. this period must be counted with a certain frequency supported by a clock source. thus, the counters on this function must be configured. mode: select a timer operation mode in seven modes. however, only the normal operation (continuous counter up counting) mode can be selected in this application, because the other six modes are all related to phase counting mode or pwm mode. ccls: select a tcnt counter clearing source from eight settings. in this application, one among the three can be set: 100, 101 or 110, which respectively indicates that tcnt is cleared for once every 6/3/1 times p_the posx_dectdata (x = 0, 1) changes. also, they can be described as: tcnt is cleared for once every 360/180/60 electrical degree rotation of bldc. this setting is critical for converting electrical revolution to mechanical revolution and measuring the bldc speed.ckegs: select the input clock edge, which can be rising, falling or both edges. when the input clock is counted using both edges, the input clock period is halved. note to count this factor on during the bldc speed calculation. tmrps: select the tcnt counter clock source from eight settings. this setting determines the precision and the range during bldc speed measurement. see the example code below: p_tmr0_ctrl, b.mode = 0; / normal counting mode p_tmr0_ctrl, b.ccls = 6; / tcnt cleared by p_posx_dectdata (x = 0, 1) / each time position detection data change p_tmr0_ctrl, b.ckegs = 0; / counting at rising edge p_tmr0_ctrl, b.tmrps = 3; / select fck/64 clock source 1.3.2 position detection control register p_posx_dectctrl(x = 0, 1) b15 b14 b13 b12b11 b10 b9 b8 r/w r/wr/wr/wr/wr/wr/wr/w 0 0 0 0 0 0 0 0 splck splmod splcnt b7 b6 b5 b4 b3 b2 b1 b0 r/w r/w r/w r/w r/w r/w r/w r/w 0 0 0 0 0 0 0 0pden spdlybit 15:14 splck: sampling clock select. select fck/4, fck/8, fck/32, or fck/128 for position sampling clock 00 = fck/4 01 = fck/8 10 = fck/32 11 = fck/128bit 13:12splmod: sampling mode select. select one of three modes: sampling when pwm signal is active (pwm is on), sampling regularly, or sampling when lower side (un, vn, wn) phases are conducting current. 00 = sample when upwm/vpwm/wpwm bit is set in p_tmrx_outputctrl (x = 3, 4) register and generate the pwm waveform01 = sample regularly 10 = sample when lower phases is in active state and conducting current 11 = reservedbit 11:8splcnt: sampling count select. these bits select the sampling count for the valid external position detection signals. the position signals must be sampled continuously match as many times as the sampling count set, for the position signals to be considered valid. the valid settings are from 1 to 15 times. note that count 0 and 1 are assumed to be one time.bit : 7pden: position detection enable. this bit enables/disables the position detection function for position input pins tioac. when enabled, the input signals of these pins will be sampled and the results will be latched to pdr 2:0 bits in pos_dectdata register. when disabled, pdr 2:0 will remain its status. 0 = disable 1 = enablebit 6:0spdly: sampling delay. these bits set a delay time clock in which at splck clock source. it is used to stop sampling in order to prevent erroneous detection due to noise that occurs immediately after pwm output turns on.position detection control register when the position detection changing event occurs, the p_tmrx_tcnt (x = 0, 1) value can be transferred to tgra. if the position detection interrupt enable bit pdcie is set to 1 in the corresponding p_tmrx_int (x = 0, 1) register, the pdc interrupt routine will be called to process the data. splck: select sampling clock from fck/4, fck/8, fck/32, or fck/128 for position sampling clock, which determines the detection precision of position change. proper setting of splck, splcnt and spdly will help to prevent erroneous detection and filter the disturbance. splmod: select one of these three modes: sampling when pwm signal is active (pwm is on), sampling regularly, or sampling when lower side (un, vn, wn) phases are conducting current. splcnt: sampling count select. the valid settings are from 1 to 15 times. note that count 0 and 1 are both assumed to be one time. pden: this bit enables/disables the position detection function for position input pins tioac. spdly: sampling delay with the range of 0 to 127.the setting example is shown as blew. p_pos0_dectctrl, b.splck = 2; / count on fck/32 p_pos0_dectctrl, b.splmod = 1; / sample regularly p_pos0_dectctrl, b.splcnt = 10; / sample 10 times p_pos0_dectctrl, b.pden = 1; / enable position detectionp_pos0_dectctrl, b.spdly = 100; / sample delay1.4 speed calculationin order to obtain the exact parameters, the data must be filtered after captured. there are many filter algorithms, such as low-pass filter, moving average filter, median filter, average filter, limiting filtering, first-order filter, moving average filtering, etc. in general, the data can be considered valid after processed by these filters. then the speed can be calculated by substituting these parameters data in the formula. assume fcap is pdc capture clock frequency; p is the pole-pair of bldc rotor; tcnt is cleared every m p_posx_dectdata (x = 0, 1) changes, that is, tcnt is cleared at every rad rotation (m=1, 3, 6), and the position data is ncapsince: (formula 1- 1)and =, since electrical degree = p x mechanical rotation then the mechanical angular velocity is (formula 1- 2)with the unit of rad/min. take n as the indicator. so: rad/min (formula 1- 3) n summarize: rpm (formula 1- 4) from the formula above, we can obverse that n is related to fcap, m, ncap and p (that is a constant when bldc is selected) .suppose there is a bldc with 2 pole-pair, 4000rpm rated speed. we will show you how to set the parameters of fcap and m. when m= 1, tcnt is cleared every time p_posx_dectdata (x = 0, 1) changes, , that is, tcnt is cleared for once every 60 electrical degree rotation of bldc. with a certain clock frequency, the motor rotation speed can be calculated by the formula 1- 4 at the highest speed when ncap is 1 and the lowest speed when ncap is 0xffff. table 1-2 motor speed vs clock frequencyfcapn fck/1 fck/4 fck/16 fck/64 fck/256 fck/1024nmax (rpm) 120m 30m 7.5m 1875k 468750 117187.5 nmin (rpm) 1831 457.8 114.4 28.6 7.2 1.8 when m= 3, tcnt is cleared for once every 3 times p_posx_dectdata (x = 0, 1) changes, that is, tcnt is cleared every 180 electrical degree rotation of bldc. from the formula 1- 4, we can see that the measurable motor speed when m= 3 is three times higher than that when m= 1, provided that other parameters are the same. when m= 6, tcnt is cleared every 6 times p_posx_dectdata (x = 0, 1) changes, that is, tcnt is cleared every 360 electrical degree rotation of bldc.from the formula 1- 4, we can see that the measurable motor speed when m= 6 is six times higher than that when m= 1, provides that other parameters are the same. above all, it is better to set m= 1 to ensure the veracity of positions. since the highest speed can be applied, it is important to select the lowest speed. assume the lowest measure speed is 200 rpm, we can set fcap as fck/16, fck/64, fck/256 or fck/1024. fck/16 is recommended to be selected for higher veracity.1.5 noise immunity through programming the bit value of splcnt (sampling count select) and spdly (sampling delay) in p_posx_dectctrl(x = 0, 1), users could avoid the erroneous detection due to noise that occurs immediately after pwm output turns on. it can ensure the correctness of speed measurement and phase commutation in bldc . the valid settings are from 1 to 15 times. note that count 0 and 1 are both assumed to be one time. these bits select the sampling count for the valid external position detection signals. the position signals must be sampled continuously match as many times as the sampling count set, for the position signals to be considered valid. then the sharp pulse can be filtered by this method. splck selects the sampling clock. figure 1-2 shows the sampling counting and figure 1-3 shows the noise immunity pulse. 0 1 2 3 4 5 6 7 8 9 10hall3hall2hall1splck figure 1-2 sampling counting hall3hall2hall10 1 2 3 4 5 6 figure 1-3 noise immunity pulse see figure 1-2 , the splcnt setting is 10. when sampling the position signal with the frequency that splck selected, a high-to-low transition occurs in hall3 at 0 to1 counting. then sample the hall signal for ten executive times. if they are all of the same value, the hall signal can be considered valid. when splcnt setting is 10, a high-to-low transition occurs in hall3 at the first counting, while a low-to-high transition occurs at the fourth counting. then reset the counter, sample hall3 for ten executive times. if they are all of the same value, the position signals can be considered as 011b still. by this way, a sharp pulse occurring in the signals can be filtered, which prevents the position signals from being disturbed. so the position signal will not be sampled if it varies quicker than the setting of splck/splcnt does (note that count 0 and 1 are assumed to be one time). 2 software design 2.1 software description this application note is designed for motor speed measurement when driving bldc, which is performed by pdc position detection change interrupt. 2.2 source file file name function type main system initialization and motor detection (or performed by isr) c isr position detection change input and speed calculation c spmc75 _spdet_v100 the key function for speed calculation lib spmc75_dmc_lib_v100.lib dmc communication function lib 2.3 dmc interfacespeed1_now: current speed by calculation user_r0: pdc data captured by pdc interrupt 2.4 subroutines spmc75_system_init ( ) prototypevoid spmc75_system_init(void) descriptioninitialize pdc timers and dmc input argumentsnone output argumentsnone head filesspmc75_spdet.h library filesspmc75_ spdet _v100 notepdc timer0 is initialized here examplespmc75_system_init(); spmc75_pdcetspd_isr ( ) prototypevoid spmc75_pdcetspd_isr(void) descriptiondata capture, filter and calculation input argumentsnone output argumentsnone head filesspmc75_spdet.h library filesspmc75_spdet_v100 notepdc isr examplespmc75_pdcetspd_isr(); 3 design tips 3.1 demo listing /*= = = = = = = = = = = = = = = =

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论