2016-10-17 05:28 PM
I'm trying to start/stop a PWM signal to an LED (simple test!!). Using HAL_TIM_PWM_Start() starts the PWM output, HAL_TIM_PWM_Stop() stops the PWM but leaves the output in a random state rather than the (expected) inactive state. This means my LED stays on constantly sometimes without pulsing.
Should I expect HAL_TIM_PWM_Stop() to do this or should I be turning a PWM output on/off a different way?2016-10-19 01:30 AM
Hi frackers,
As mentioned in the timer driver, the function just stop the generation of PWM from the Timer peripheral module and does not change the configuration of the GPIO, in order in case of second recall of PWM start function the generation will be in return and the PWM is on output directly. You can add a GPIO write function then to force the IO state.-Hannibal-2016-10-23 04:21 AM
I can't just add a GPIO write without changing the Alternate Function of the port from PWM output to PushPull or Open Drain output - to start PWM again then requires re-initialise of the timer with HAL_TIM_PWM_Init() and HAL_TIM_PWM_ConfigChannel().
If the Pulse register is set to either 0 or 0xffff does this set the output to a guaranteed steady state and can this be done through the HAL some way other than using HAL_TIM_PWM_ConfigChannel() ?2016-10-25 01:57 AM
Hi frackers, ,
You can use the ''HAL_TIM_PWM_DeInit()'' function that disable Timer and call the HAL_TIM_PWM_MspDeInit() that you should create and define in the ''STM32Fxx_hal_msp.c'' file. Inside this function, you configure the GPIO as analog for example or other configuration you want. In case you want to back again just call HAL_TIM_PWM_Init() and your GPIO is reconfigured for PWM output.-Hannibal-2016-10-25 08:53 PM
Hi frackers,
Use the internal pull-up or down.
It canbe set through the CubeMX TIMx Configuration.