2018-04-03 01:46 AM
Using:
Truestudio for STM32 v9.0.0.0
STM32CubeMX v4.25.0
STM32F100C8
LL_drivers only
LL_Code generated by cube enables some devices, such as the USART:
LL_USART_Enable(USART1);
But for the TIMERS it doesn't.
(perhaps there is a good reason for this?)
Also, when you select a PWM output, it does not enable the output(s):
TIM_OC_InitStruct.OCMode = LL_TIM_OCMODE_PWM1;
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_DISABLE;Again, why?
(Leaving a hint in int main(void) might be an idea.)
For advanced TIMERS (TIM1) it may help people who want to use PWM when this is mentioned somewhere:
LL_TIM_EnableAllOutputs(TIM1);
(I found the MOE_bit to be rather hidden in the documentation in TIMx_BDTR)
Regards,
Wilko
Solved! Go to Solution.
2018-05-09 05:04 AM
Hi
Lunenburg.Wilko
,Thanks for your feedback and sorry for late response.
In fact, CubeMX allows only
the generation of C initialization code. In such a way
, it doesn’t set off the timer and PWM
. The user has the authority to start them in
any part of his program, depending on his application.
Hoping it helps you, please do not hesitate to contact me for further details.
thanks in advance for helping to complete this thread.
Best Regards,
Mohamed
2018-04-03 05:40 AM
Dear Wilko
I made the same remark as you by developing a code using an ADC triggered by a timer.
You need to enable Timer separately
Please, take a look to my project
https://community.st.com/0D50X00009bMM4uSAG
After choosing a Nucleo-L476RG, I reproduced that you reported
The two lines you mentioned are generated in MX_TIM1 function
TIM_OC_InitStruct.
OCMode
= LL_TIM_OCMODE_PWM1;TIM_OC_InitStruct.
OCState
= LL_TIM_OCSTATE_DISABLE;In stm32l4xx_ll_tim.h, I found the following comment in line 309 concerning OCState
This feature can be modified afterwards using unitary functions @ref LL_TIM_CC_EnableChannel() or @ref LL_TIM_CC_DisableChannel().*/
Best regards
JC
2018-04-03 08:44 AM
Dear Wilko
I agree with you. A correct documentation is missing.
To understand more deeply the HAL library, I bought the book written by Carmine
https://leanpub.com/mastering-stm32
On the other hand, I found no doc for LL drivers except some examples supplied by ST.
For people wishing to migrate from the SPL library to LL drivers based library, I found
a utility SPL2LL Converter v1.0.1 supplied by ST. But I did not check its robustness.
best regards
JC
2018-04-03 09:02 AM
Hello,
Have you followed the
User manual Description of STM32F1 HAL and Low-layer drivers?Best Regards,
Imen
2018-04-03 09:03 AM
Yeah, I found out there are many different ways of enabling the TIMERS, so it does make sense that ST have not selected just one and put it in STM32CubeMX. But it would be nice to have some (better) documentation for the LL (and HAL) drivers.
2018-04-03 09:28 AM
Dear Imen
Yes, I found it in exploring the ST site. Without wanting to hurt you, I do not consider that a file generated by Doxygen-like utility is a usable documentation.
For my job of teacher, in order to introduce STM32 devices to my students, I would have more pedagogical application notes and practical examples
using LL drivers.
Best Regards
JC
2018-04-03 12:29 PM
Hello Imen,
Yes I have, together with the STM32F100xE_User_Manual.chm file, which I think is a bit easier to use. And the Reference Manual (RM0041.pdf in my case).
The reference manual is the best to find out how a certain device works but of course it doesn't tell you what LL_functions to use to configure a device.
What would be great is a manual such as the Reference Manual but with the appropriate LL and HAL functions instead of (or together with) the Register Settings.
I too bought the 'Mastering STM32' book by Carmine Noviello, but as I have decided not to use the HAL_drivers but to use LL_drivers only it is less useful to me.
Regards,
Wilko
2018-04-17 03:29 AM
Dear Wilko,
Thanks for your feedback.
To formulate and to clarify more your situation, I propose to have more details about your code and your configuration in Cubemx. So, can you please share with me your ioc (project CubeMX) or inform me please about:
Please let me know about the code (function) that you think are missing in MX_TIMx_Init(void).
Thanks in advance for helping to complete this thread.
Best Regards,
Mohamed
2018-04-18 03:33 AM
Hi Mohamed,
Thanks for your reaction. What I missed was a simple
LL_TIM_EnableCounter(TIM2);
And
TIM_OC_InitStruct.OCState = LL_TIM_OCSTATE_ENABLE;
in function MX_TIM2_Init
But the real problem is the lack of clear documentation about the LL drivers. Now you have to gather all information from the Reference Manual together with files as STM32F100xE_User_Manual.chm and the User Manual Description of STM32F1 HAL and Low-layer drivers (UM1850), browsing through the driver code itself, and checking register settings with the debugger..
As I told Imen, what would be great would be a manual such as the Reference Manual but with the appropriate LL and HAL functions instead of just register settings.
You can close this question as the problems are resolved. Thanks again.
Regards,
Wilko
2018-05-09 05:04 AM
Hi
Lunenburg.Wilko
,Thanks for your feedback and sorry for late response.
In fact, CubeMX allows only
the generation of C initialization code. In such a way
, it doesn’t set off the timer and PWM
. The user has the authority to start them in
any part of his program, depending on his application.
Hoping it helps you, please do not hesitate to contact me for further details.
thanks in advance for helping to complete this thread.
Best Regards,
Mohamed