Skip to main content
Associate II
December 11, 2025
Solved

B-G431-ESC1 Electronic Speed Control PWM issues

  • December 11, 2025
  • 2 replies
  • 2035 views

Hello,

I apologise in advance if my post lacks any important information, I am very new to working with these sorts of boards and have limited experience with motor control in general. 

I am using a B-G431-ESC1 to drive a 24V hoverboard motor. I have profiled the motor and uploaded the firmware to it and it runs just fine on the motor pilot with FOC speed control. I had also used the potentiometer on the ESC to change the speed without issue.

I wanted to switch to using PWM signals to control the speed of the motor, and reuploaded the firmware to the board with the potentiometer option disabled and the Electronic Speed Control option enabled for the stage configuration. 
Using an ESP32 I generate a 490Hz PWM signal and first send 1060us pulses to the ESC (verified with an oscilloscope). I then send a new PWM to the ESC where the signal is high for 1850us. 

My expectation was that the initial 1060us PWM would arm the driver, and then the 1850us PWM would command the ESC to drive the motor close to its maximum speed, but the motor does not move. The motor does stiffen a little and is harder to rotate by hand, and if i do rotate it by hand quickly it sometimes continues to move at a constant speed. I have also connected the ESC to the esp whilst the ESC was connected to a motor pilot on a laptop, and the motor switches from "IDLE" to "RUN" as the esp sends the PWM signal.

I am writing here for some advice on what I must change to allow the PWM signal to work as I expected, with a variable PWM being able to control the speed of the motor. I would be very appreciative of any help that anyone may provide me :)

Many thanks.

motor workbench: Version: 6.4.1 Build: 250722.154358
STM32 cubeIDE: Version 2.0.0
STM32 cubeMX: Version 6.16.0

Best answer by rudyard

Hello,

Ah I see. I have it set up now with the STO-PLL as the main sensor and hall as auxiliary.

I made some changes that have ultimately allowed me to achieve the ESC control I was aiming for:

  • I saw a post on this community that mentioned a potential mistake in the generation of the esc.c, on line 121:
    if((pHandle->Ton_value >= pESC_params->Ton_arming) && (pHandle->Ton_value > pESC_params->Ton_min))

    That post supposed that the second inequality is the wrong way around. I changed this and the motor was then able to move when i sent it signals using the esp.
  • After this first change, the motor would move but only moved at a single speed (about 1/6th of the max speed), unless the pulse was longer than the maximum value mentioned in the documentation (1860us), in which case it jumped straight to the max speed. I was using the correct frequency and tried varying the pulse width but it the speed did not change. I looked into the esc.c file again and then found that the "speed_min_valueRPM" value in the mc_parameters.c was set to 1000, whilst my maximum speed was 600. I may be missing it but i cant find any option in the motor workbench to set a minimum speed, and none of the speeds values i had set were 1000. Either way, changing this value in the mc_parameters.c file to 0 seems to have resolved my issue.

 

Thank you both @GMA and @STuser2 :)

2 replies

Senior III
December 11, 2025

I am not sure if it is Hall sensor based or sensor less. If it is hall sensor then proper placement angle is required. Apart from that the PWM signal what you are providing looks fine. The below diagram is from the user manual.

STuser2_0-1765476951317.png

Maybe you can try disabling UART in case it is loading the CPU, it is just a guess.

  

rudyardAuthor
Associate II
December 12, 2025

Hello,
Thank you for your reply :)
It is hall sensor based and I had the sensorless (Observer + PLL) as an auxiliary sensor, not sure if theres much difference to it but I figured it wouldn't hurt (maybe im wrong).

I had neglected to properly consider the hall sensor values, as I was unsure how to actually check these values. There is no datasheet I could find for this motor, but I believe it comes from a zimx HB1 hoverboard. Previously I had kept the default values of 120 for the "sensor displacement" and 300 for the "displacement electrical angle".

Not the most scientific method, but I tried different combinations of 120 and 60 for those respective values, and all but one combination caused an immediate speed feedback error, which was 120 and 60 for the "sensor displacement" and "displacement electrical angle" respectively.

It is now moving a lot faster and with a lot more torque.
In fact, it's stuck at its maximum speed and doesn't respond to changes to the speed reference in the motor pilot.
Adjusting the PI divisors slows down how quickly it reaches the maximum speed but doesn't actually make it respond to new speed references. This is without the use of the esp32, for now I am just using the potentiometer and the motor pilot UI.


Senior III
December 12, 2025

It is hall sensor based and I had the sensorless (Observer + PLL) as an auxiliary sensor, not sure if there much difference to it but I figured it wouldn't hurt (maybe im wrong).

Yes it will not be a problem. (I have never used though)

 

For profiling of the motor and hall sensor you can use the motor profiler software. There is documentation available of how to use the profiler in the MCSDK.

STuser2_0-1765544118488.png

 

GMA
Technical Moderator
December 12, 2025

Hello @rudyard,

Refer to application note for the ESC signal description.
Using the B-G431B-ESC1 board with MCSDK 6.4.1, ESC behaves as expected.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA
rudyardAuthor
Associate II
December 12, 2025

Hello,

thank you for your reply :)

Are you referring to the note under figure 15 in the manual? I had thought that my signals were as the manual instructed, if a 1060us signal arms it with a minimum speed and then other signals within the 1060us to 1860us range adjust speed.
Apologies if that is not what you meant or if I have missed something in this section.

GMA
Technical Moderator
December 12, 2025

Hello @rudyard,

As mentioned in the "1. Features" chapter of the application note: Full reference design for electronic speed controller capable of both sensorless FOC and 6-step algorithm.
Try with the main sensor set to STO-PLL.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.Best regards.GMA