Hoverboard-Firmware-Hack-Gen2.x icon indicating copy to clipboard operation
Hoverboard-Firmware-Hack-Gen2.x copied to clipboard

disable PWM does not work

Open JochenKr opened this issue 1 year ago • 8 comments

I tried to turn off the PWM outputs but it seems that it doesn't have an effect.

My approach was to force timer_automatic_output_disable(TIMER_BLDC); in CalculateBLDC(void) as below https://github.com/RoboDurden/Hoverboard-Firmware-Hack-Gen2.x-GD32/blob/839d1ab7ff600f73b3853bb75097d5406cfda1bf/HoverBoardGigaDevice/Src/bldc.c#L184


	if (1)//(currentDC > DC_CUR_LIMIT || bldc_enable == RESET || timedOut == SET)
	{
		timer_automatic_output_disable(TIMER_BLDC);		
		//DEBUG_LedSet(SET,0)
  }
	else
	{
		timer_automatic_output_enable(TIMER_BLDC);
		//DEBUG_LedSet(hall_c == 0,0)
  }

The PWM is still present and the wheels can spin as normally.

JochenKr avatar Feb 18 '24 11:02 JochenKr

Maybe SetEnable() is what you want:

https://github.com/RoboDurden/Hoverboard-Firmware-Hack-Gen2.x-GD32/blob/839d1ab7ff600f73b3853bb75097d5406cfda1bf/HoverBoardGigaDevice/Src/main.c#L513

RoboDurden avatar Feb 18 '24 12:02 RoboDurden

I tried to use SetEnable(RESET); with the same method as above. but still no impact on PWM outputs visible :-(

in main.c I've commented SetEnable(enable); out, to make sure that this one doesn't turn on the PWM again.

JochenKr avatar Feb 18 '24 13:02 JochenKr

I still do not know what you want to achieve. I think it is normal that you have full pwm running with speed at zero. The hi-side and low-side mosfets are inverse so no current flowing.

If you want pure silence you may have to study void PWM_init(void) in setup.c

RoboDurden avatar Feb 18 '24 13:02 RoboDurden

Ok, I'll check. My target is to save energy during idle. With 4 motors the 24 Mosfets have significant switching losses also if no current is involved. These I would like to eliminate

JochenKr avatar Feb 18 '24 13:02 JochenKr

mosfet do not need current to stay on gate driver need less then 1w

ghost avatar Feb 18 '24 13:02 ghost

Correct, Mosfets do not need current to stay on. Charging and discharging of capacitors e.g. gate charge Cg mainly generate losses. My setup is far beyond 1W

JochenKr avatar Feb 18 '24 14:02 JochenKr

I also do not like this ever ongoing pwm. I have lots of signal noise on my i2c bus ...

RoboDurden avatar Feb 18 '24 14:02 RoboDurden

actually i do not understand what the problem is

ghost avatar Feb 18 '24 14:02 ghost