lpc1700 无刷电机控制
- 格式:pdf
- 大小:884.06 KB
- 文档页数:25
无刷直流电机控制策略1. 定时器计数器控制定时器计数器控制是一种比较简单但常用的控制策略,其原理是通过定时器来生成不同频率的脉冲信号,从而控制电机的转速。
在BLDC电机中,通常采用六步换相的方式来控制电机的转动。
具体步骤如下:1) 初始化定时器计数器,设置好脉冲信号的频率;2) 通过对定时器计数器的计数值进行判断,确定电机当前的转动状态(即哪些相通电);3) 根据电机的转动状态,依次改变相的通断状态,实现电机的正向或反向转动。
定时器计数器控制的优点是实现简单、稳定可靠,适用于对转速要求不高的场合。
但是其缺点是对电机的控制精度较低,无法实现精确的转速和位置控制。
2. 电压脉宽调制(PWM)控制电压脉宽调制(PWM)控制是一种通过改变电机的供电电压来实现速度和位置控制的方法。
在BLDC电机中,PWM控制通常是通过改变驱动器的占空比来控制电机的转速。
具体步骤如下:1) 生成一个高频的PWM信号;2) 通过改变PWM信号的占空比,控制电机的供电电压;3) 根据电机的供电电压,控制电机的转速和位置。
PWM控制的优点是控制精度高,可以实现较精确的转速和位置控制,适用于对电机控制精度要求较高的场合。
然而,其缺点是实现复杂、成本较高。
3. 磁矢量控制磁矢量控制是一种通过检测电机磁场信息来实现对电机转速和位置控制的方法。
在BLDC 电机中,磁矢量控制通常是通过检测电机磁极位置、电流和磁场,来实现高效的转速和位置控制。
具体步骤如下:1) 通过传感器检测电机的磁场信息;2) 分析磁场信息,确定电机的转动状态;3) 根据电机的转动状态,控制电机的相序和电流,实现精确的转速和位置控制。
磁矢量控制的优点是控制精度高、效率高、噪音低,适用于对电机控制性能要求较高的场合。
然而,其缺点是实现复杂、成本高,需要增加传感器等设备。
总结以上介绍了三种常用的无刷直流电机控制策略,每种策略都有其特点和适用范围。
在实际应用中,根据具体的需求和条件选择合适的控制策略是非常重要的。
无刷电机控制器原理图无刷电机控制器是一种用于控制无刷直流电机的电子设备,它通过控制电机的电流和电压,实现对电机的精准控制。
在本文中,我们将介绍无刷电机控制器的原理图,以帮助大家更好地理解其工作原理。
首先,我们来看一下无刷电机控制器的基本组成部分。
无刷电机控制器通常由电源模块、驱动模块、控制模块和保护模块组成。
电源模块负责提供电机所需的电源,驱动模块负责控制电机的转速和方向,控制模块则用于接收外部控制信号,并将其转换为电机控制指令,保护模块则用于监测电机的工作状态,并在出现异常时进行保护。
接下来,我们来详细介绍无刷电机控制器的原理图。
在原理图中,我们可以看到各个模块之间的连接关系和信号传输路径。
电源模块通常由电源输入端、电源滤波器、电源管理芯片和电源输出端组成,其中电源管理芯片负责对输入电源进行稳压和滤波处理,以保证电机工作时的稳定电源供应。
驱动模块则包括电机驱动芯片、功率放大器和电机输出端,电机驱动芯片负责接收控制模块发送的电机控制指令,并将其转换为驱动电机的电流和电压信号,功率放大器则负责放大信号并驱动电机正常工作。
控制模块通常由微控制器或数字信号处理器组成,它负责接收外部控制信号,并将其转换为电机控制指令,然后发送给驱动模块。
同时,控制模块还可以接收来自电机的反馈信号,并进行闭环控制,以实现对电机的精准控制。
最后,保护模块则包括过流保护、过压保护、过温保护等功能模块,它们负责监测电机的工作状态,并在出现异常时及时进行保护,以避免电机损坏。
总的来说,无刷电机控制器的原理图是一个复杂的电子系统,它通过各个模块之间的协同工作,实现对无刷电机的精准控制和保护。
希望通过本文的介绍,大家对无刷电机控制器的工作原理有了更深入的了解。
无刷直流电机控制方法
无刷直流电机(Brushless DC Motor,BLDC)是一种基于电子换相技术来驱动的电机,它具有高效率、高功率密度、高可靠性等优点。
以下是几种常见的无刷直流电机控制方法:
1. 基于霍尔传感器的六步换相控制方法:BLDC电机通常内置三个霍尔传感器,可以用来检测转子位置。
控制方法通过监测霍尔传感器的状态,来确定哪个绕组需要通电。
该方法只需简单的逻辑门电路即可实现。
2. 无霍尔传感器的电子换相控制方法:这种方法采用传感器无关的技术,通过测量三相电流和电动势来确定转子的位置。
通常需要使用一个称为电机控制器或无刷电机驱动器来完成电子换相功能。
3. 磁场导向控制方法(Field-Oriented Control,FOC):该方法是一种高级控制技术,通过将三相电流分解为坐标轴上的直流分量和交流分量,将电机控制问题转化为直流电机的控制问题。
这种控制方法可以提供更高的动态性能和控制精度。
4. 直流电压控制方法:这种方法基于直流电压的控制原理,通过改变电机的电压来控制电机的转速和转矩。
该方法简单易实现,但通常不能提供高精度和高动态性能。
以上仅为常见的几种无刷直流电机控制方法,实际应用中还有其他高级控制技术和方法,例如逆变器驱动技术、空间矢量调制控制等。
具体选择何种控制方法,需根据电机应用要求、控制精度和成本等因素综合考虑。
教你用光驱的线路板控制光驱的无刷电机
近日得一坏光驱拆开来看了一下,主轴电机及控制电路是好的,如果用原配的线路板来控制
该电机则可省下一笔电调的费用。
该电机没有进行过改装。
如果改装了,电器性能发生了变化,估计用原来的控制电路就不能控制了,就算可以控制的话性能也要打个折扣的。
好了,开始工作了:
拆开光驱,可以看到如下图的电机和控制电路:
拆掉集成电路的散热片,用的是BA6869FP,28个引脚
来个特写,我们只用关心22脚和23脚:
将线路板接上电脑的电源,打开电源开关,然后用一金属物体将22脚和23脚短接,如果电机转了起来,那么恭喜你可以执行下一步了。
22脚用来接收其他集成电路发出的主轴电机的伺服信号,在模型上使用时我们没有这个信
号,所以把22脚与外部的连接断开。
但这时如果短接22脚和23脚电机不转啊,别急,将23脚和+5V电源连接电机就又工作了。
我现在只做到这一步,还没有把整块控制电路从线路板中分隔出来,不过应该没有什么大问
题了。
有些光驱用的是BA6849控制的也是28个引脚,我查了下BA6849的使用说明,应该和BA6869
差不多的。
大家研究研究吧。
无刷直流电机运行原理与基本控制方法无刷直流电机(Brushless DC motor,BLDC)是一种通过电子器件进行电动势控制的电机。
它与传统的有刷直流电机相比,无需换向器,具有体积小、寿命长、效率高等优点。
本文将介绍无刷直流电机的运行原理以及基本控制方法。
无刷直流电机由定子和转子两部分组成。
定子部分是由若干个绕组组成的,每个绕组分别位于电机的不同位置上,并通过适当的方式连接到驱动电子装置上。
转子部分是一个由磁铁组成的旋转部件。
当绕组首先通电时,电流产生的磁场将影响转子上的磁铁,使其始终追随绕组的磁场运动。
由于转子上有多个磁铁,每个磁铁都可能受到不同的绕组的影响,因此能够实现高效的力矩输出。
1.传感器反馈控制:传感器反馈控制是一种常用的无刷直流电机控制方法。
这种方法通过在电机上安装霍尔传感器或编码器等反馈装置,实时获取电机的位置信息。
控制器根据这些信息,采用恰当的算法控制电机的相序和电流大小以使电机达到所需的速度和位置。
2.电子换向:电子换向是指通过改变电流的方向和大小来实现电机转子上的磁场方向的变化。
具体地,通过控制器引入恰当的电流波形,使得转子上的磁铁始终与绕组的磁场保持正交关系,从而实现电机的正常运转。
3.空载检测:空载检测是一种无刷直流电机常用的控制方法。
当电机不承受负载时,转子的转速会比正常情况下更高。
通过监测电机的转速,控制器可以判断电机是处于空载还是负载状态,并相应地调整电流的大小和方向,以达到所需的控制效果。
4.PID控制:PID控制是一种常用的控制方法,适用于无刷直流电机的速度和位置控制。
PID控制器根据电机的速度或位置误差计算出一个调整量,然后通过调整电流和相序来实现电机的控制。
PID控制器的输出可以根据需求进行调整,从而实现不同的电机运行模式。
总结无刷直流电机是一种通过电子器件进行电动势控制的电机,具有高效、寿命长等优点。
其运行原理是通过控制电流的大小和方向,使得转子上的磁铁与绕组的磁场保持正交关系,从而实现电机的正常运转。
低成本A R M7L P C2101微处理器设计无刷直流电机的控制方案(一)低成本ARM7LPC2101微处理器设计无刷直流电机的控制方案(一) 本文阐述使用低成本的ARM7LPC2101微处理器设计无刷直流电机的控制方案;详细地介绍微处理器、MOSFET驱动和MOSFET的原理设计和程序流程,以及与电机保护相关的技术及处理方法,如电机稳定运行状态机,降低电机噪声,软件防止电机陡转等。
该方案可以应用在打印机、电动自行车、洁牙机等电机控制产品上。
LPC2101是基于16/32位ARM7CPU嵌入高速Flash闪存的微控制器,具备高性能,小体积封装,低功耗,片上可选择多种外设等优点,应用范围很广。
其具备的多种32位和16位定时器、10位A/D转换器和每个定时器上PWM匹配输出特性,尤其适用于工业控制。
无刷直流电机是一种易驱动电机,适用于变速和启动转矩很高的应用,它的使用范围从大规模的工业模具到调光控制的小型电机(12V 直流电机),外形和尺寸也是各种各样。
1无刷直流电机的基本原理图1无刷电机组成无刷直流电机一般由定子、转子和金属壳体等组成,如图1所示,通过反向极性的吸引产生扭矩使电机运转。
一旦转子开始运转,固定的刷子和转子部分将不断反复地连接、断开,电动势和反电动势在转子旋转过程中产生,新的电极总是和定子极性相反。
由于这种变换是固定的,因此转子以一种固定的形式运动。
通过给电机施加反向电压和反向的转子线圈电流,使南北极性翻转,电机改变其运动旋转方向。
速度和电机的扭矩大小是依据电机旋转产生的磁场强度来控制的,而电机的旋转能量是依赖于通过电流大小来控制的,因此调整电机转子的电压和电流可以改变电机的速度。
本电机速度的控制是根据LPC2101微控制器的PWM信号的变化而产生的。
2无刷直流电机的控制2.1双向旋转图2使用全桥电路双向旋转驱动有刷直流电机的双向旋转,可通过全桥驱动电路改变电流来实现完成,如图2所示。
无刷直流电机的控制方法无刷直流电机的控制啊,就像是在指挥一场超级复杂的交响乐。
你看,那电机里的电流就像是一群调皮的小音符,在电路这个大乐谱里到处乱窜,而我们的控制方法呢,就是那个拿着指挥棒的大师。
要是用开环控制的方法,那就像是闭着眼睛在高速公路上开车,只知道一个劲儿地踩油门(给电压),至于电机到底转得咋样,就全靠运气啦。
这就好比你放风筝,只一股脑儿地放线,不管风筝在空中是不是要跟别的风筝打架(电机运行不稳定),完全是一种粗放型的管理。
闭环控制可就不一样啦,它就像是给电机请了个超级保姆。
这个保姆时刻盯着电机的转速、电流这些指标,就像盯着宝宝有没有好好吃饭(正常运行)一样。
一旦发现电机这个“小宝贝”转得快了或者慢了,就赶紧调整,就像宝宝哭了要赶紧哄一样迅速。
还有一种叫矢量控制的方法,这可就高大上了,就像是给电机做了个超级精确的定位导航系统。
它把电机的磁场和电流这些抽象的东西,像拆乐高积木一样,拆得清清楚楚,然后再按照最优的方式组合起来。
这就好比把一群调皮的小动物,先分清哪个是兔子,哪个是狐狸,然后再让它们排好队前进,让电机运行得又高效又精准。
要是把无刷直流电机比作一个活力四射的运动员,那控制方法就是教练。
一个好的教练(控制方法)能让运动员(电机)发挥出超强的实力。
如果是个蹩脚的教练,那电机就像没头的苍蝇,有劲使不出。
在无刷直流电机的控制世界里,控制算法就像是魔法咒语。
不同的咒语(算法)能让电机做出各种各样神奇的动作。
就像哈利·波特挥动魔杖一样,我们通过不同的控制算法,让电机按照我们的意愿转动、加速或者减速。
无刷直流电机的控制也像是一场微妙的平衡游戏。
电压、电流、转速这些参数就像走钢丝的杂技演员手里的平衡杆。
稍微有点偏差,电机就可能摔个“狗吃屎”(出现故障),所以控制方法得小心翼翼地调整这个平衡杆,让电机稳稳地在最佳状态下运行。
而且啊,控制无刷直流电机就像在驯服一匹烈马。
你不能太强硬,也不能太软弱。
无刷电机控制方法:提升高效稳定性能
无刷电机(BLDC)良好的功率密度、高效率和低噪音使其成为电
动汽车、无人机、家用电器和工业机械等领域中的热门选项。
然而,
为了实现更高的性能和较好的控制,需要一些切实可行的方法。
以下
是一些无刷电机控制方法,可用于提升其高效稳定性能。
1. 传统电机控制方法:无刷电机使用的传统控制方法包括定速控
制和传统三角波控制。
定速控制利用恒定的电压或电流来控制电机,
但缺乏调速和调力矩的灵活性。
传统三角波控制以三角波信号控制电
机轴的电压和电流,但会产生较大的电磁噪声,对无人机和家电等对
噪音敏感的应用不适合。
2. 矢量控制:无刷电机的矢量控制可实现轴向控制,提高了动态
性能和响应性。
矢量控制通过控制转子磁通和定子电流来达到控制目的,并使用高精度的传感器反馈进行补偿。
由于矢量控制需要实时反馈,因此准确的传感器信息至关重要。
3. 感应电机控制(FOC):FOC是矢量控制的一种变体,通过无感知向量控制方法实现高效率、高精度控制,并有效地消除了低速抖动。
FOC需要实时反馈的磁通信息和良好的参数识别,是一种容错能力较差的控制方法。
4. 非线性控制:非线性控制方法,如滑模控制和逆向学习控制,
可以消除控制系统中不确定性和干扰,提高系统的适应能力和抗干扰
性。
但由于非线性控制方法需要进行很多复杂的数学推导,实际应用
较为困难。
总的来说,无刷电机的控制方法因应用场景、性能要求和技术水
平的不同而异。
在选择控制方法时需要根据具体情况进行权衡和评估,综合考虑系统的可靠性、易用性和成本等因素。
AN10898BLDC motor control with LPC1700Rev. 01 — 05 January 2010 Application noteDocument informationInfo ContentKeywords LPC1700, BLDC, Motor control, QEI, MCPWM, CMSISAbstract This application note describes the implementation of Brushless DCmotor control in the LPC1700 using the dedicated motor control PWM.Contact informationFor additional information, please visit: For sales office addresses, please send an email to: salesaddresses@Revision history RevDateDescription01 20100105 Initial version.1. IntroductionBrushless DC (BLDC) motors are rapidly gaining popularity. They offer longer life andless maintenance than conventional brushed DC motors. Some other advantages overbrushed DC motors and induction motors are: better speed versus torque characteristics,noiseless operation and higher speed ranges. In addition, the ratio of torque delivered tothe size of the motor is higher, making them useful in applications where space andweight are critical factors.This application note demonstrates how to implement six-step commutation or BrushlessDC motor control on the LPC1700 family. The LPC1700 is equipped with a dedicatedMotor Control PWM which reduces the CPU utilization during motor control while alsoreducing development time. This application note also intends to be a reference andstarting point for motor control system developers using LPC1700 familymicrocontrollers.Application note AN10661 “Brushless DC motor control using the LPC2141” is used as areference for this application note, and may be downloaded from /.The LPC1700 user manual is referenced, so keep the LPC1700 user manual (UM10360)at hand.As with the system described in AN10661, this application note shows a complete motorcontrol system solution, not only showing the usage of NXP microcontrollers but alsoNXP MOSFET driver circuits and MOSFETs.LPC1700Fig 1 shows a Motor Control block diagram, which is suitable for a wide variety ofapplications, including air conditioners, electric pumps, fans, printers, robots, electricbikes, mixers, food processors, blenders, vacuum cleaners, toothbrushes, razors, coffeegrinders, etc.2. The brushless DC motor fundamentals2.1 The brushless DC motorBrushless DC motors consist of a permanent magnet rotor with a three-phase statorwinding. As the name implies, BLDC motors do not use brushes for commutation;instead, they are electronically commutated. Typically, three Hall sensors (Fig 2) areused to detect the rotor position and commutation is based on these sensor inputs.In a brushless DC motor, the electromagnets do not move; instead, the permanentmagnets rotate and the three-phase stator windings remain static (see Fig 2). This solvesthe problem of transferring current to a moving rotor. In order to do this, the brush-commutator assembly is replaced by an intelligent electronic “controller”. The controllerperforms the same power distribution as found in a brushed DC motor, but is uses asolid-state circuit rather than a commutator/brush system.The speed and torque of the motor depends on the strength of the magnetic fieldgenerated by the energized windings of the motor, which in turn depends on the currentflow through each winding. Therefore, adjusting the voltage (and current) will change themotor speed.Fig 2. The brushless DC motor2.2 Electrical commutationA BLDC motor is driven by voltage strokes coupled with the given rotor position. Thesevoltage strokes must be properly applied to the active phases of the three-phase winding system so that the angle between the stator flux and the rotor flux is kept close to 90° to maximize torque. Therefore, the controller needs some means of determining the rotor's orientation/position (relative to the stator coils.)Fig 3 depicts a systematic implementation on how to drive the motor coils for a correctmotor rotation. The current direction through the coils determines the orientation of the stator flux. By sequentially driving or pulling the current though the coils the rotor will be either pulled or pushed. A BLDC motor is wound in such a way that the current direction in the stator coils will cause an electrical revolution by applying it in six steps. As alsoshown in Fig 3 each phase driver is pushing or pulling current through its phase in twoconsecutive steps. These steps are shown in Table 1. This is called trapezoidalcommutation. Fig 5 shows the relation between the definitions six-step commutation (six Hall sensor edges H1, H2 and H3), block commutation (i a, i b, i c) and trapezoidalcommutation (e a, e b, e c).Table 1. Switching sequenceSwitching intervalPhase currentSwitch closed SequencenumberA B C0 0° - 60° + - OFF 1 41 60° - 120° + OFF - 1 62 120° - 180° OFF + -3 63 180° - 240° - + OFF 3 24 240° - 300° - OFF +5 25 300° - 360° OFF - + 5 42.3 Revolution speed controlVarying the voltage across the motor can simply control the rotor speed. This can be achieved by pulse width modulation (PWM) of the phase voltage. By increasing ordecreasing the duty-cycle, more or less current per commutation step will flow through the stator coils. This affects the stator flux and flux density, which changes the force between the rotor and stator.This means that the rotation speed is determined by the load of the rotor, the current during each phase, and the voltage applied.2.4 Torque controlJust like speed control, torque is controlled by the amount of the current through the stator coils. For maximum torque the angle between the stator and rotor flux should be kept at 90°. With trapezoidal commutation, the control resolution is 60° and the angle between the stator and rotor flux is from -30° to +30°, which introduces a torque ripple.2.5 Position feedbackThe rotor position feedback can be accomplished though a couple of techniques. Mostcommonly is the hall sensor feedback, but other techniques include using an encoder or even eliminating sensors entirely. This application note will only focus on the hall sensor feedback and encoder feedback and will not explore sensorless operation.2.5.1 Hall sensor feedbackThe hall sensors are placed such that they generate an edge at each switching interval as explained in Chapter 2.2. This makes it very easy to determine the current rotororientation, and to activate each phase in the right sequence.Fig 5. Trapezoidal control with Hall sensor feedback2.5.2 Encoder feedbackThe most commonly used encoder is the quadrature encoder. For more detailedinformation on quadrature encoders, please see chapter 3.2.3. The LPC1700The LPC1700 is an ARM Cortex-M3 based microcontroller for embedded applicationsrequiring a high level of integration and low power dissipation. The ARM Cortex-M3 is anext generation core that offers system enhancements such as modernized debugfeatures and a higher level of support block integration.The LPC1700 operates at up to 120 MHz CPU frequency. The peripheral complement ofthe LPC1700 includes up to 512 kB of flash memory, up to 64 kB of SRAM, EthernetMAC, a USB interface that can be configured as either Host, Device, or OTG, 8 channelgeneral purpose DMA controller, 4 UARTs, 2 CAN channels, 2 SSP controllers, SPIinterface, 3 I2C interfaces, 2-input plus 2-output I2S interface, 8 channel 12-bit ADC, 10-bit DAC, motor control PWM, Quadrature Encoder interface, 4 general purpose 32-bittimers, 6-output general purpose PWM, ultra-low power RTC with separate batterysupply, and up to 70 general purpose I/O pins.This application note will deal with the motor control specific peripherals, which are themotor control, PWM and the Quadrature Encoder Interface.3.1 LPC1700 Motor Control PWM (MCPWM)The NXP LPC1700 family is equipped with a dedicated Motor Control PWM (MCPWM).This MCPWM is optimized for three-phase AC and DC motor control applications.The motor control PWM architecture is designed such that there are three independentchannels, of which each channel controls a modulated output pair with oppositepolarities. All channels can be set-up and controlled independently, but can beinterconnected using the ‘Three phase DC mode’ or the ‘Three phase AC mode’.Each channel includes:• a 32-bit Timer/Counter (TC)• a 32-bit Limit register (LIM)• a 32-bit Match register (MAT)• a 10-bit dead-time register (DT) and an associated 10-bit dead-time counter• a 32-bit capture register (CAP)•two modulated outputs (MCOA and MCOB) with opposite polarities• a period interrupt, a pulse-width interrupt, and a capture interruptIn total the MCPWM has 10 I/O lines to fully control the power inverter stage in the motorcontrol system. Each channel includes a PWM output pair, called MCOAx and MCOBx,and an input MCIx, where x is the channel number ranging from 0 to 2. The MCPWMalso has a low-active Fast Abort pin, MCABORT. This pin will put the output pins to thepassive state and can be used for a safety state.Fig 6 depicts a simplified block diagram of the MCPWM. The three independent channels are shown in the block diagram. Each channel has its own timer counter (TCn1) whichcan be clocked either by the peripheral clock (PCLK) or the motor control input pins 0 to2 (MCI0..2). The match registers (MATn) and the Limit registers (LIMn), together with thedead-time generator, are responsible for the state of the channel outputs. Valid states for the channel outputs can be ‘passive’ or ‘active’ and the output control determineswhether these states are HIGH or LOW.For the detailed MCPWM block diagram, please see the LPC1700 User Manual(UM10360).3.1.1 Operation modesThe MCPWM supports many different modes of operation. These are briefly summarized in the following section. For more detail on these modes, please refer to the LPC1700User Manual.1. n indicates the channel number, 0 to 23.1.1.1 PWMThe first mode of operation is the regular PWM mode. Within this mode, one can selectedge- or centre-aligned PWM waveform generation. For both edge- and centre-alignedwaveforms, dead-time delay can be implemented on the passive-to-active states.Please note that after reset all A outputs are set to ‘passive’ state and the mapping of‘passive’ is LOW.Fig 7. Dead time generation on the passive to active state3.1.1.2 External event countingThe second mode is the ‘External event counting’ mode. Instead of using the PCLK, the external MCIx trigger pin will cause the TC to rise and/or fall.3.1.1.3 Three-phase DC modeIn the ‘Three-phase DC mode’, the internal MCOA0 signal can be routed to any or all ofthe MCO outputs. The current commutation pattern register (MCCP) determines to which output the MCOA0 signal is routed.Fig 8 shows with the red dashed line the change in signal flow with respect to the normal PWM operation mode.3.1.1.2 Three-phase AC modeThe ‘Three-phase AC mode’ compares the MAT register of all channels to the channel 0Timer counter (TC0).Fig 9 shows the three-phase AC mode operation.3.1.1.3 Fast AbortThe last operation mode is the Fast Abort mode. This mode is entered when the active-low pin MCABORT is externally pulled low. All MCOAx and MCOBx pins will be put in the ‘passive’ state. The polarity of these pins can be set using the POLA bits in the MCPWMcontrol register (MCCON).3.1.2 MCPWM pin descriptionAs described in the previous chapters, the MCPWM has in total 10 I/O pins used in operation. See Table 2 for a description of these 10 pins.Table 2. MCPWM pin descriptionFunction Name Pin name DescriptionMCOA0 P1.19 MCPWM channel 0 output AMCOB0 P1.22 MCPWM channel 0 output BMCOA1 P1.25 MCPWM channel 1 output AMCOB1 P1.26 MCPWM channel 1 output BMCOA2 P1.28 MCPWM channel 2 output AMCOB2 P1.29 MCPWM channel 2 output BMCI0/MCFB0[1] P1.20 MCPWM input 0 or MCPWM Feedback 0MCI1/MCFB1[1] P1.23 MCPWM input 1 or MCPWM Feedback 1MCI2/MCFB2[1]P1.24 MCPWM input 2 or MCPWM Feedback 2MCABORT P1.21 Low-active fast abort[1] Please note that the MCPWM input pins are shared with the QEI input pins3.2 Quadrature Encoder Interface (QEI)The quadrature encoder, also known as a 2-channel incremental encoder, convertsangular displacement into two pulse signals. By monitoring both the number of pulsesand the relative phase of the two signals, you can track the position, direction of rotation, and velocity. In addition, a third channel, or index signal, can be used to reset theposition counter. This quadrature encoder interface module decodes the digital pulsesfrom a quadrature encoder wheel to integrate position over time and determine direction of rotation. In addition, it can capture the velocity of the encoder wheel.3.2.1 QEI pin descriptionAs depicted in Fig 10 the three signals from the quadrature encoder (Phase A, Phase B and Index) are fed into the QEI. Pins used for these signals are:Table 3. QEI pin description[1]Function Name Pin name DescriptionMCFB0P1.20 Used as the Phase A (PHA) input to the QEIMCFB1 P1.23 Used as the Phase B (PHB) input to the QEIMCFB2 P1.24 Used as the Index (IDX) input to the QEI[1] Please note that the QEI input pins are shared with the MCPWM input pins.For a detailed description on how the QEI is implemented in the application, see thefollowing chapters. A detailed description of the usage can be found in the LPC1700User Manual (UM10360).4. Application setupThis chapter will describe how the application is setup.Fig 11. LPC1700 Motor control application block diagram4.1 ConnectionsThis application uses the MCPWM peripheral for controlling the power inverter. As Fig 11depicts, the MCPWM A channels are used for driving the High-side switching FETs andthe MCPWM B channels are driving the Low-side switching FETs.For rotor orientation feedback, either a Hall sensor or a quadrature encoder can bechosen. The MCPWM input pins (MCI0..2) and the QEI pins (PHA, PHB and IDX) areshared pins, called MCFB0..2. In this application, no hardware is implemented to detectan ‘un-safe’ state for triggering the MCABORT pin.Table 4. Application connectionsFunction Name Pin name Signal Signal PurposeA H Motor phase A high side FET driveMCOA0 P1.19A L Motor phase A low side FET driveMCOB0 P1.22MCOA1 P1.25B H Motor phase B high side FET driveB L Motor phase B low side FET driveMCOB1 P1.26C H Motor phase C high side FET driveMCOA2 P1.28C L Motor phase C low side FET driveMCOB2 P1.29MCFB0P1.20 FB0 Hall0 or QE PHA feedback inputMCFB1P1.23 FB1Hall1 or QE PHB feedback inputFB2Hall2 or QE IDX feedback inputMCFB2 P1.24A IN Motor current measurement inputAD0.5 P1.31GPIO0 P0.16 Hall0 Hall0 or QE PHA feedback inputGPIO1 P0.17 Hall1 Hall1 or QE PHB feedback inputor QE IDX feedback inputGPIO2 P0.18 Hall2 Hall2UsedMCABORT P1.21 NotAs Fig 11 shows, the feedback pins are connected to both the MCFB pins and someGPIO pins, this is because of the MCPWM.1 errata in the LPC1700 errata sheet. Please see this errata for more information.4.2 Power inverterThe power inverter in this application note is based on the same power inverter stage as described in AN10661, and is briefly explained in the following paragraphs4.2.1 MOSFET selectionThe NXP Semiconductors PH20100S N-channel TrenchMOS logic level FET is used for this system. It is chosen in relation with the selected motor, which is supplied with 24 V.For a 24 V - supplied motor, the MOSFET V DS needs to be at least 40 V, while the draincurrent needs to be high enough to deal with the motor (starting) current. The latter isalready reduced thanks to a soft-acceleration mechanism (in small steps up towards the required speed) implemented in software. The PH20100S can deal with a maximumdrain current of 34.3 Amps and a peak current of 137 Amps and is available in an SMDSOT669 (LFPAK) package4.2.2 MOSFET driver selectionMOSFET drivers are needed to raise the controller’s output signal (driving the MOSFET) to the motor supply voltage level. In this application note we selected the PMD3001D and the PMGD400UN from NXP Semiconductors, as shown in Fig 12.4.3 BLDC motor selectionThe MOSFETs used in this power inverter are rated at 12 V with a switching frequency of20 kHz (50 μs) to have a safe operating current of about 40 A. Therefore this board iscapable of driving a motor of approximately 480 W.During development of this application note, a Maxon EC32 80W with Hall sensors and quadrature encoder extension was used.5. SoftwareThe software written for this application note is based on the Cortex MicrocontrollerSoftware Interface Standard (CMSIS) and therefore uses the driver CMSIS-Compliantstandard peripheral firmware driver library. The latest version of this driver library can befound on the NXP microcontrollers support page.Usage of the relevant driver library files and the application dedicated sources will beexplained in this chapter.Keil ARM-MDK version 4.01 is used as IDE during development of the LPC1768firmware.A UART is used as a feedback mechanism and parameter control interface allowing foryour preferred terminal program to be used.5.1 Folders and filesAll files needed for this application note is are arranged in the following orderTable 5. Top folder structureFolder Descriptionapps_src All application dedicated source filesCore Core specific driver and initialization files, CMSIS compliantuseful for this application noteDocumentation DocumentationDrivers CMSIS compliant driver libraryLst Destination folder for all listing files compiled by the compilerObj Destination folder for all object files compiled by the compilerLPC1700_BLDC.uvproj Keil uVision4 project file5.1.1 Firmware sourceThe application-dedicated source files written for this application notes can be found asindicated in Table 5 in the apps_src folder.5.1.1.1 BLDC.cThe BLDC.c source file incorporates the initialization, controlling and interrupt handling of the BLDC motor control. Table 6 describes all functions in this file.Table 6. Functions description in BLDC.cFunction Descriptionvoid BLDC_init (void) BLDC control initialization- MCPWM initialization- Hall feedback initialization through MCFB pins orGPIO- QEI initialization, if selectedvoid BLDC_Enable (void)Enable the BLDC motor controlvoid BLDC_setDuty(unsigned int duty)Set the PWM duty cyclevoid BLDC_calcRPM(PIDstr *ptr)Calculate the current RPMvoid BLDC_break (void) Break the BLDC motorvoid BLDC_commutate (unsigned char step) Commutate the BLDC motor according the right commutation sequencevoid MCPWM_IRQHandler (void) MCPWM interrupt handler function, for the Hall sensorfeedback if selectedvoid EINT3_IRQHandler (void) The external interrupt 3 or GPIO interrupt handlerfunction, in this case it handles the Hall sensor feedbackif selected through the GPIO interruptsvoid QEI_IRQHandler (void) QEI interrupt handler function, handles the QEI positioncompare interrupts5.1.1.2 Main.cThe Main.c is the application entry file. Here all application-specific initializations aremade and a small pre-emptive scheduler is started for task scheduling with a 1 msresolution. It also includes the retarget function enabling usage of the printf function.Table 7. Functions description in Main.cFunction Descriptionvoid Systick_Handler (void) The core systick interrupt handler, used for 1 ms countsthroughout the systemint sendchar (int c) Retargeting function for printf usage, which will becollected and send over the UARTvoid UART0_IRQHandler (void) UART0 interrupt handler, it directs to the UART driverlibrary.void UART0_IntReceive (void) UART0 receive callback function, handles all incomingUART data and put it on the ring buffervoid Call_1ms(void) The 1 ms schedulerTasks:- Start PID calculation- If motor is enabled but no speed, hard commutatevoid Call_10ms(void) The 10 ms schedulerTasks:- Start processing incoming UART data on ringbuffervoid Call_100ms(void) The 100 ms schedulerTasks:- Print the current RPMvoid Call_1s(void) The 1 s schedulervoid initApplication(void) Initialize the application- Systick configuration- LED configuration- UART configuration- BLDC Motor control configurationint main(void) Main program entry function- Initialize system- Initialize the application- Enable the BLDC motor- Run scheduler in endless loop5.1.1.3 PID.cThe PID consists only of one function, PID_calc_cntr which actually is a PI controller.The input of this function is a pointer to a PIDstr structure. This structure contains allvariables needed for the PI controller to calculate the manipulated value or output.5.1.1.4 Retarget.cRetarget.c is the Keil standard solution for linking the stdio.h files to the low levelprocessor dependent drivers.By defining the int sendchar (int c) function in the application code, as in thisapplication is done in the main.c, the stdio.h functions as printf can be used.5.1.1.5 UART_ProcessData.cThe functions in the UART_ProcessData c source file takes care for proper UARTcommand processingTable 8. Functions description in UART_ProcessData.cFunction Descriptionvoid UART_processError (void)UART process error handler, gives ‘Invalid command’response to user.Processes the incoming commandsvoid UART_processMessage(UART_RING_BUFFER_T *rb,PIDstr *pid,uint8_t loc)The commands which can be used during operation are described in Table 9.Table 9. UART command set[1]Command Descriptionstart Starts/Enables the motorStop Stops the motor, but keeps it free running and thereforewill not brakebreak Stops the motor and actively brakespeed=nnnn Give the RPM setpoint,Poles The number of motor pole pairsdir=n Set the motor direction, 0 = CW and 1 = CCWp=n.nn Set the P value, point is floatingi=n.nn Set the I value, point is floating[1] All commands are case sensitive.The UART_processMessage function is set to be very flexible and the user can easilyadd or delete commands from the command set.5.1.1.6 Controlling structure PIDstr1typedef volatile struct _PIDstr {2 double p; /**< The PID Product-value */3 Double i; /**< The PID Integrating-value */4 Double d; /**< The PID Diff-value, not used but for future purpose */5 DWORD sp; /**< Setpoint in mechanical RPM */6 DWORD pv; /**< Process value, dt in sys counts, used for RPM calc */7 Double err[3]; /**< Error in PI(D) calculations */8 DWORD mv; /**< Manipulated value, output of the PI(D) controller */9 BYTE HALstate; /**< Current HAL state */10 DWORD CMT_CNT; /**< Commutation counter, motor commutated check*/11 DWORD CMT_step; /**< Current commutation step */12 DWORD RPM; /**< Current motor mechanical RPM */13 BYTE Enable; /**< Motor enable, 0 = DISABLE, 1 = ENABLE */14 BYTE Direction; /**< Motor rotation direction, Clockwise = CW or CounterClockwise = CCW */15 BYTE Brake; /**< Motor electrical break, 0 = DISABLE, 1 = ENABLE */16 DWORD Period; /**< Switching frequency of the phase drives */17 BYTE Poles; /**< Number of Pole-pairs in the motor */18 DWORD Tick_cur; /**< Current tick value, for RPM calculations */19 DWORD Tick_old; /**< Current tick value, for RPM calculations */20 DWORD Tick_new; /**< Current tick value, for RPM calculations */21} PIDstr;NXP Semiconductors AN10898LPC1700 BLDC motor control 6. Legal information6.1 DefinitionsDraft — The document is a draft version only. The content is still under internal review and subject to formal approval, which may result in modifications or additions. NXP Semiconductors does not give any representations or warranties as to the accuracy or completeness of information included herein and shall have no liability for the consequences of use of such information.6.2 DisclaimersGeneral — Information in this document is believed to be accurate and reliable. However, NXP Semiconductors does not give any representations or warranties, expressed or implied, as to the accuracy or completeness of such information and shall have no liability for the consequences of use of such information.Right to make changes — NXP Semiconductors reserves the right to make changes to information published in this document, including without limitation specifications and product descriptions, at any time and without notice. This document supersedes and replaces all information supplied prior to the publication hereof.Suitability for use — NXP Semiconductors products are not designed, authorized or warranted to be suitable for use in medical, military, aircraft, space or life support equipment, nor in applications where failure or malfunction of a NXP Semiconductors product can reasonably be expected to result in personal injury, death or severe property or environmental damage. NXP Semiconductors accepts no liability for inclusion and/or use of NXP Semiconductors products in such equipment or applications and therefore such inclusion and/or use is for the customer’s own risk.Applications — Applications that are described herein for any of these products are for illustrative purposes only. NXP Semiconductors makes no representation or warranty that such applications will be suitable for the specified use without further testing or modification.Export control — This document as well as the item(s) described herein may be subject to export control regulations. Export might require a prior authorization from national authorities.6.3 TrademarksNotice: All referenced brands, product names, service names and trademarks are property of their respective owners.NXP SemiconductorsAN10898LPC1700 BLDC motor controlPlease be aware that important notices concerning this document and the product(s) described herein, have been included in the section 'Legal information'.© NXP B.V. 2010. All rights reserved.For more information, please visit: For sales office addresses, email to: salesaddresses@7. Contents1. Introduction.........................................................3 2. The brushless DC motor fundamentals ............4 2.1 The brushless DC motor....................................4 2.2 Electrical commutation.......................................5 2.3 Revolution speed control....................................6 2.4 Torque control....................................................6 2.5 Position feedback...............................................7 2.5.1 Hall sensor feedback..........................................7 2.5.2 Encoder feedback..............................................7 3. The LPC1700........................................................8 3.1 LPC1700 Motor Control PWM (MCPWM)..........8 3.1.1 Operation modes................................................9 3.1.1.1 PWM................................................................10 3.1.1.2 External event counting....................................10 3.1.1.3 Three-phase DC mode.....................................11 3.1.1.4 Three-phase AC mode.....................................12 3.1.1.5 Fast Abort.........................................................12 3.1.2 MCPWM pin description...................................13 3.2 Quadrature Encoder Interface (QEI)................14 3.2.1 QEI pin description...........................................14 4. Application setup..............................................15 4.1 Connections.....................................................15 4.2 Power inverter..................................................16 4.2.1 MOSFET selection...........................................16 4.2.2 MOSFET driver selection.................................16 4.3 BLDC motor selection......................................17 5. Software.............................................................18 5.1 Folders and files...............................................18 5.1.1 Firmware source ..............................................19 5.1.1.1 BLDC.c.............................................................19 5.1.1.2 Main.c ..............................................................20 5.1.1.3 PID.c................................................................21 5.1.1.4 Retarget.c.........................................................21 5.1.1.5 UART_ProcessData.c......................................22 5.1.1.6 Controlling structure PIDstr ...........................23 6. Legal information..............................................24 6.1 Definitions........................................................24 6.2 Disclaimers.......................................................24 6.3 Trademarks......................................................24 7. Contents. (25)。