2016-09-22 07:11 AM
Using latest CubeMX and HAL libs.
As far as i can see, HAL doesn't support a method for enabling the TIMx complimentary CHxN outputs.In this case i want to use TIM1 CH1N and CH2N for PWM output.Thanks.2016-09-22 07:37 AM
Hi MWP,
Did you configured that in CubeMx and the generated code does not output signal or the configuration does not exist on the CubeMx tool ? please share further your .ioc file. -Hannibal-2016-09-22 09:41 AM
The configuration exists in the CubeMX tool, but the HAL libraries don't support it.
The HAL library enables CH1 & CH2 not CH1N & CH2N as configured in CubeMX.I can share the IOC, but not publicly (can i email it somewhere?).BTW.... can you pleeeeease fix the login process for this forum.Its so incredibly broken.2016-09-22 09:55 AM
To be more specific...
This should work:HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1); //enable CH1NHAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2); //enable CH2N... but instead of enabling CH1N and CH2N, it enables CH1 and CH2 instead.Ive looked thorough the HAL library source, and it appears there is no method available to enable CH1N and CH2N.To work around the problem i have to do this:__HAL_TIM_DISABLE(&htim1);TIM1->CCER = 0; //all offTIM1->CCER |= 0x44; //=CC2NE | CC1NE//normal enable__HAL_TIM_MOE_ENABLE(&htim1);__HAL_TIM_ENABLE(&htim1);2016-09-23 04:52 AM
Hi MWP,
You are not implementing the right function to start the complimentary output. You should enable the CH1 and then enable CH1N (not the same function indeed) like below:/* Start CH1 */
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
/* Start CH2N */
HAL_TIM_PWMN_Start(&htim1, TIM_CHANNEL_1);
-Hannibal-
2016-09-26 03:06 AM
HAL_TIM_PWMN_Start() ... no such function exists.
I gather you meanHAL_TIMex_PWMN_Start()?
Why is it in the TIMex library section?Did the dev's forget that the N channels exist, so had to add it in a separate library later?The more i use HAL, the more i dislike it.For a library that's meant to simplify use across stm32's it's doing a pretty bad job of it.2016-09-26 04:33 AM
So this brings up the question... what is the ''correct'' way to find these functions?
Is there a big index with peripheral name vs function calls somewhere?2016-09-30 08:57 AM
HI MWP,
You should check the user manual ''Description of STM32F4xx HAL driver''.This user manual is structured as follows:- Overview of the HAL drivers- Detailed description of each peripheral driver: configuration structures, functions, and how to usethe given API to build your application.To see all the Timer driver APIs , go to part ''63.2 TIMEx Firmware driver API description ''.-Hannibal-