Project - Allegro A4960 Sensorless BLDC Motor Driver

Allegro A4960 Sensorless BLDC Motor Driver

This is a driver for an A4960 sensorless brushless DC motor controller. It is developed for Micro Framework v.4.2 and based on manufacturers datasheet.

The code package consists of two parts:
• The driver itself, located in a4960 folder;
• Sample test program for FEZ Cerb 40: program.cs.

As A4960 is a pre-driver, it is controlling the external power circuit which best suits your motor. So, to run it properly, you need to design the schematics which would handle currents required by your motor. The scheme of the test device is shown in attached picture and described in readme.txt.
Another thing to mention for a power circuit design is that its very important that VBRG wire should be routed to the top of transistor bridge, LSS – to the bottom and CSP and CSM – to the ends of Rsense.
In most cases, the motor should run with default configuration settings. However, it may be needed to select a proper control PWM frequency for your motor – it sufficiently influences the operation stability, especially during the motor start sequence.
A few words about the test program. It initializes the controller and waits till the user presses the button. Then slowly increases the speed from 20% to 100% in 1% increments every 0.1 second and then continuously runs at 100% till the button is pressed again. Also, it counts and displays RPM ticks every second, outputs diagnostic faults, if any encountered and stops the motor in case of a fault.

A4960 datasheet:
A3940 datasheet:

1 Like

Good job! Thanks for sharing!

You are welcome! I hope it’ll help someone.

What are you building with that motor?

I think I haven’t understood your question :slight_smile:
I have tested several brushless motors, but one, shown in the video, had the most difficult start-up conditions in terms of torque.

@ m0rda - Just curious if you are building something interesting using that motor. That looks like a very powerful motor.

I plan to use it as a brushless spindle. It is supposed to burn 50A at 12V. Theoretically, it is 600W, but what the maximum power will be, only the tests will tell, especially, keeping the overheating in mind. Yet had no chance to test it under a good load.

I think this is the first brushless controller driver on codeshare, thanks for sharing.

This one works great also. Not sure if there are differences between aircraft motors & his type motor, though.

In terms of motors, there is no difference at all. They are both sensorless brushless motors. However, to run the this motor with the firmware you have mentioned, you need to have a speed controller (ESC) connected to the motor and control it with PWM. In my case it is kind of DIY ESC which connects directly to the motor and is driven by .NET MF device.

Hi! thanks for sharing!

I’m trying to run a motor with a microcontroller.

Could you please post the schematic you have used?

At the motor-start – what do you get from A4960 on SDO?

Because my motor is running, but if I set the run-reg I get 0xC000 on the SDO, what means a power-on-reset.
One reason for a POR could be, that the Vdd voltage drops under Vdduv. But since Ive decoupled it with 100nF to Ground this cant be the reason. Ive also measured Vdd and its stable on 3V3.

Do you (or anybody else) have an idea?


The schematics is posted as an attached picture on the codeshare page:
You are right about the reason when the POR bit is set. Also, it will always appear for the first data reading.
You can consider reading data from SPI in two cases: if you are reading / writing the config or of you get low on DIAG pin which signals an error. In this case an error code is pending to be read.
What I get at motor start depends on the motor. Some of motors, I tested, started smoothly, others generated BEMF failure and LOS. In this cases altering the ramp and start-up torque can help. Another thing that appeared to be helpful is a good large capacitor between ground and Vbb. And the PWM control frequency, of course.


That codeshare page link seems to be broken. I don’t suppose you could re-post it?


I don’t know why, these images have become unavailable at codeshare page.
Reposted the schematics:

Hi m0rda, thanks for your great work on the A4960 bldc driver, how did you deal with the exposed pad, shoul we tie it to GND or just make it float(not connected), this just made me confused. Looking forward to your reply. :slight_smile:

According to Allegro datasheet, the pad is just for thermal dissipation. I made it float :slight_smile:

@ m0rda
Thanks , I’ll try it. Does the IC get hot while working without connecting the thermal pad?

In my case it didn’t. The thing that was heating most was one of capacitors, before I have figured out correct parameters.
However, I hadn’t had a chance to test it properly, like running the motor for several hours continuously.


What did you use as shunt resistor. I have an application that will require a large amount of current but I’m afraid that the resistor wont handle it.


Hi, the codeshare link is giving error 404. Could you re-post it ?

Thanks a lot.