2017-11-02 02:08 AM
Is it possible to set LPTIM to have interrupt every ms?
I did try some examples, and got PWM working with LPTIM on PB2.
I can do that with TIM2, but then I got problem with system wake up, and I do not want that...
2017-11-02 03:16 AM
You did not tell us what model you have in mind, but yes, LPTIM generally can trigger an interrupt, and 1ms is well within its capabilities, if there's a reasonable clock source. In the LPTIM chapter in RM there's a LPTIM interrupts subchapter, read that.
I don't understand the rest of your question: interrupt *means* processor wakeup, how else would you service that interrupt?
JW
2017-11-02 03:32 AM
It is STM32L082
Im using cubemx code for lora .
Im trying to add some interrupt without messing to much with code and state machine.
So LPTIM will act the same and wake processor if I use interrupt like TIM2 does?
I just want to some simple stuff in that interrupt, toggle led and add counter.
Now with TIM2 I need to use HAL_PWR_EnableSleepOnExit to go back into SLEEP/STOP mode after finishing interrupt
I just want to do the same with maybe lower power consumption.
I will check RM again.
2017-11-02 11:36 AM
Using an STM32L072 (ie 082 less AES), that looks to support an LPTIM interrupt, you might have to play games with the clock sources so they don't power down, but I'd imagine WFI will work the same for LPTIM as it would with TIM2.
And presumably there is also SysTick..
2017-11-03 09:56 AM
Yes it needs playing
Yes I did source clock from LSE, and divider is set to 128.
I did manage to get interrupts that does not mess with LoRa state machine, but it is working strange.
I have tested LP PWM and when I use it to generate PWM it consumes 4uA.
If I use it as LP PWM_IT it consumes 200uA and generate IT every 10ms.
If I connect PWM pin (in my case PB2) to other pin that has RISING edge interrupt I get all I need (10ms interrupt) and consumptions is 4uA - 5uA.
So maybe Im doing something wrong or LP IT is doing something strange.
Anyway for now I working solution with 2 pins extra ...