Skip to main content
MTros.1
Associate II
September 14, 2020
Solved

TIMER OC output using LL

  • September 14, 2020
  • 6 replies
  • 2902 views

I ran timer OC mode on PA8 (TIM1_CH1) on STM32f407VGT6 using HAL and it works fine. Then I decided to set up it by means of LL and there is not any output on PA8. I checked my code with Example_LL projects of STM32F411RE-Nucleo in ST F4 repository. It seems that I have done any thing it needs! My project files are attached. Now please I have two questions:

  1. Why does not my code work?
  2. Are the Example_LL projects reliable?

Thanks.

This topic has been closed for replies.
Best answer by TDK
TIM2 doesn’t have an MOE bit. Only advanced timers do.

6 replies

waclawek.jan
Super User
September 14, 2020

Read out and check/post content of TIM and relevant GPIO registers.

JW

TDK
September 14, 2020

Is the MOE bit set?

"If you feel a post has answered your question, please click ""Accept as Solution""."
MTros.1
MTros.1Author
Associate II
September 15, 2020

Your answer was to the point. I employed this LL service to do it.

LL_TIM_EnableAllOutputs(TIM1);

can you please tell me from where I can find the step by step procedure to set up a peripheral in STM32F4? until now I have considered HAL Examples as a guider to find a step by step recipe to set up a peripheral by HAL. Yet it seems to me that LL Examples are not reliable! please guide me.

TDK
September 15, 2020

There are some LL examples available in the CubeMX repository. If you're dead set on using LL, I'd look at those. If you're not dead set on using LL, use direct register access and use the reference manual for how to set up peripherals.

Which example are you saying doesn't work? The only relevant example I see is "TIM_PWMOutput" which uses TIM2, not TIM1, so that can't be it..

"If you feel a post has answered your question, please click ""Accept as Solution""."
MTros.1
MTros.1Author
Associate II
September 15, 2020

Actually I had to migrate from HAL to LL since HAL has considerable overhead (sometimes 1us(=HAL) vs 100ns(=Direct register access)!!!). Therefore I decided to give LL a shot and get rid of overhead time.

I used "TIM_OutputCompare". Yes TIM2 is employed and PA5 as output waveform pin. I did not download this example into any MCU. I only considered it as a guider

and did anything it did. However I reckon that MOE bit is not set anywhere!!! Is it???

TDK
TDKBest answer
September 15, 2020
TIM2 doesn’t have an MOE bit. Only advanced timers do.
"If you feel a post has answered your question, please click ""Accept as Solution""."