2021-12-02 10:55 AM
I am using the low power timer (LPTIM), but i need to initialize the timer value to 30000 before start the counting.
Is it possible ?
Thank you!
2021-12-02 01:56 PM
Yes:
LPTIM1->CNT = 30000;
You can do this prior to using HAL_TIM_Base_Start() HAL_LPTIM_*_Start if you're using HAL since the function doesn't touch the counter.
2021-12-02 04:04 PM
hi @TDK
I had done
LPTIM1->CNT = 30000;
But, i hadnt used the HAL_TIM_Base_Start()!
I will try then tomorrow this sequence!
LPTIM1->CNT = 30000;
HAL_TIM_Base_Start(&s_TimerInstance);
Can i always repete this sequence in at any point in the program and repeat it ?
Because i will receive a LoRaWAN message that contains this LPTIM1 value.
I will have to change the LPTIM1 many times
Thanks
2021-12-02 05:03 PM
2021-12-02 06:55 PM
Did you see that is not writable the lptim counter ?
2021-12-03 03:14 AM
hi,
can you send a example setting the LPTIM1 counter value ?
Thanks!
2021-12-03 07:01 AM
My first reply does this...
2021-12-03 07:05 AM
If you are brand new, perhaps look at some examples which use the timer. Here are some results from searching:
https://github.com/STMicroelectronics/STM32CubeG4/search?q=MX_LPTIM1_Init
You need to use HAL_LPTIM_* functions to interface with LPTIM timers, not HAL_TIM_* as I wrote previously.
Good luck.
2021-12-03 07:31 AM
Hi, i had tried that but got compiler error!