2012-02-10 11:00 AM
Hello
STM32RBT6 should control 1 servo with PWM output. For all TIM2 - TIM4 I tested it seems to be OK, but for TIM1 Channel 1 which is one I need it is working only occasionally what is very strange.Sometime I just recompile same code and it is working correctly, until I recompile it again.Well, it works, but output is very laggy - cca 1 second shoots.It should control brushless regulator, it use same output as servos, so I testing it with some servos ..Here is my code There are 2 servos, one with TIM2 which works smoothly as expected, second with TIM1. Notice, that it is controlled by same code.I wonder TIM1 CH1 is used by something, but I can't find what, when throttle_init() is called right after RCC_APB2PeriphClockCmd() in main()..Next thing, TIM1 CH1 servo don't react at all without TIM_CtrlPWMOutputs (TIM1, ENABLE);Somebody know, where could be a problem ? #tim1-channel-1-pwm2012-02-11 04:46 PM
You are sure that ST lib does not compile with optimization 0? I am using Keil 4.6.1 and I did not have any problems - I tried quite many of the timer/ PWM examples of the ST4 Discovery peripheral kit, I usually always used opt level 0 - no problems. Just I do not like these lib functions, because their init functions do complete initialisation only for the simpler timers. The more complex timers like TIM1 and TIM8 need some further initialisation, which is very well hidden, if you use the lib functions (it is not possible, to run e. g. a TIM3 PWM example by exchanging ''TIM3'' to ''TIM1'' - usually a lib should be made such, that this works) - so I prefer to set all bits myself - in this case at least I had to read through all the timer config bits once completely, so I have a better understanding of the particularities of each timer.
2012-02-11 05:33 PM
I am using Keil 4.6.1
Tomas is using GNU GCC, I'm using Keil V4.1.0.894 [Evaluation], from uVision 4.232012-02-11 08:44 PM
Sorry for mixup - yes, my Keil version is the same as yours, Clive. Thanks for clarification.
2012-02-11 11:27 PM
I can compile std lib with 4.5.X at any optimization, but with 4.6.1 I am not able to compile it at all due to two lines of a assembly language.
2013-09-03 12:39 PM
What is the difference between GPIO_PartialRemap_TIM3 and GPIO_FullRemap_TIM3 as used in the GPIO_PinRemapConfig() call?
2013-09-03 01:46 PM
What is the difference between GPIO_PartialRemap_TIM3 and GPIO_FullRemap_TIM3 as used in the GPIO_PinRemapConfig() call?
Two vs Four channels?
2013-09-03 02:46 PM
Ahh! I searched the forum and google'd but I never thought to look in the datasheet. Doh!
Thank you, Clive! If one uses Full remap but PC6 is not set to Alternate Function, will PC6 still function as a general purpose I/O pin?2013-09-03 05:40 PM
Yes PC6 can remain as a GPIO, as can any channels you are not using, or ones which you are only using internally.
The F1 provides for peripheral/block remapping, the newer designs (L1, F2, F4) provide for a more flexible pin level remapping.