BLDC Motor Control

What about motor control perpherical of the LPC1668?

Can I use it?



15 Apr 2010

It depends upon what you mean by BLDC motor control.  If you mean a small brushless DC fan with with a built in controller then yes it is easy.  All you need is a circuit to vary the voltage applied to the motor.  But if it is a larger brushless DC motor that requires an external circuit to generate the 3 phase excitation now you are talking about something a lot harder.  Yes it ccan be done as Texas Instrumentrs sells a Referenmce design Kit, RDK-BDC, for a BLDC motor using an ARM Cortex M3 processor.  However, youi will be very lucky if somebody posts the code to do it using mbed.


15 Apr 2010 . Edited: 15 Apr 2010

I´m talking about a direct current brushless motors, small or large, with or without hall sensor or rotatory encoder.

LPC1768 has a specific peripheral named MCPWM that is intended to Motor control PWM and other  for Quadrature Encoder Interface to support three-phase motors, with an inverter. But, I saw that it uses same pins than led 2 and 4...I thing..

The code is writen yet. There is a NXP library for that, MCPWM.

It is possible to remap this pin functions in mbed?





15 Apr 2010

The following information comes from:

I hope this answers your question.

"3.5 MCPWM.1: Input pins (MCI0-2) on the Motor Control PWM peripheral
are not functional
On the LPC1766, the Motor Control PWM (MCPWM) peripheral is optimized for
three-phase AC and DC motor control applications and can also be used in applications
which require timing, counting, capture, and comparison. The MCPWM contains three
input pins (MCI0-2) for PWM channels 0, 1, and 2. The inputs can be used as feedbacks
for controlling brushless DC motors with Hall sensors, and also can be used to trigger a
Timer/Counter’s (TC) capture or increment a channel’s TC when MCPWM is configured
as a timer/counter.
The input pins (MCI0-2) are not functional.
The GPIO interrupts on port 0 or port 2 can be used instead of the MCPWM MCI0-2 pins.
The GPIO interrupts give the ability to trigger an interrupt on both the rising and falling
edge; therefore, all six states of the connected hall sensor can be detected through an


There is a mistake in my previous message.  The Texas Instrument BLDC reference design kit part number is RDK-BLDC. The part number I previously provided was for a stepper motor.


11 Nov 2010

Not sure what you want to do but surely putting a RC brushless DC motor controller in place and controlling that with just a servo pulse from the Mbed would be far simpler.

11 Nov 2010

I was kinda dissapointed too when I found out that the MCPWM was not fully available (but I can understand why). If you aim to design a motor drive or inverter with the mbed, I am sure you can bit-bang your way through it (the mbed should be plenty fast enough for it.) However,  If you are just looking drive a BLDC motor, save yourself the trouble of building a motor drive (not as trivial as it sounds...) and buy a motor controller.

When driving a BLCD motor, is very important that the controller have a dedicated hardware, synchronized PWM etc.  STM32 is the solution, it was not trivial, of course. But not so hard, there are a lot of information, libraries and hardware schematics for the controller and inverter. It was so funny! ;)

I have designed and made a motor controller, some power stages for different motors and a kind of encoder for BLCD, for a very low-medium speed four motor autonomous vehicle (20km/h max speed). Also, 4WD, in two ways, with servos and with wheel rotation.

I use in-runner RC motors (ESky, very cheap)  with Hall Effect sensors, and is something like driving steep by steep motors.

With one of the cheap commercial RC motor controllers,  I think that it is impossible to achieve real control when driving at very low speed.

I have made all the PCBs and sensors mounts at home with my cnc milling machine,  I put three sensors for each motor with 120º distance.

16 Nov 2010

We actually use an STM32F103 (72Mhz) for controlling a 1600Watts 3-Phase BLDC motor (PWM 36kHz, 0 to 2000 RPM), software made by us with Independent Switching on power mosfets was actually pretty easy, it's the control loop you have to worry about. (by the way, the motor control library from ST is not really a library, it's more like a demo project.... cannot be used that easy)

Is it true this cannot be done using the LPC? I wanted to try building the controller on the 1768 and actually improve it by using sinus commutation.

20 Nov 2010

The LPC1768 is very suitable for driving BLDC motors, trapezoidal (6-step) or sinusoidal. See the appnote about it:

The MCPWM output, so the PWM works just fine. The eratasheet refers to the capture inputs of the MCPWM block.

It would be nice if someone could invest some time in making an BLDC library from the appnote.

21 Nov 2010

Actually in my experience, I think that it's not that easy to make a 'library' for motor control purposes. The thing is that every specific motor combined with mechanics, requires it's own implementation. Sure I could write a library type implementation but it would require numerous variables to accommodate for specific function.

28 Sep 2012

Hi, This topic is quite old and I am curious to know if there was something done. This work on BDLC with hall sensors interests me especially to make running some types of e-bikes prototypes, and understand what are the interesting variables for a full control of the motors. Thanks to keep me informed on the news.

13 Jan 2013

Have a look on the AN10898 BLDC motor control with LPC1700 showld help!

17 Jan 2013


We used another approach (not designing ourselves at low level) and just bought a Maxon EPos2 drive that is CAN bus connected and will operate even when the mbed is reset.

The protocol used on the CAN bus for motion control (CiA DSP402) is pretty standarized there are more components to choose from.

regards wvd_vegt

10 May 2013

thank u sir

01 Dec 2017

Can anyone give a program to control speed of BLDC motor for FRDM K64F processor?