PWM&Servo do not work after lower power sleep

PWM (analogWrite) and SERVO do not work after the call of the function onSleep from the example LowerPower_WakeUpByTimer.ino.
How to correctly restore the timer?

I have the same problem. PWM works after reset, but after fist call of function “lowPowerHandler()” PWM (analowWrite) stops working. (CubeCell HTCC-AB01 board)

I found a solution to this problem
Use libraries PWM1.h and PWM2.h
Only these files had to be moved to my sketch folder
Why are there no examples for this?
Well, the support service from Haltec is very bad.
Simple things are not solved or solved for a very long time.
I think it’s time to use STM32WL

Hi @sav59, @kurya,

The timer doesn’t seem to be the problem, but the power saving mode.

The example LowerPower_WakeUpByTimer.ino calls lowPowerHandler which puts the MPU into deep-sleep by calling CySysPmDeepSleep.

In deep-sleep the PWM units stop working:

Try sleep mode instead of deep-sleep by changing CySysPmDeepSleep() to CySysPmSleep() in low_power.c.

I work with battery powered devices
Sleep mode is too energy intensive for me
In deep sleep mode, all timer processing is disabled, and after recovery it is not enabled back on.
PWM_Enable() completely solves this problem

Hi sav@59,
Thanks for sharing the solution.

Also I do agree with your remarks:
Looks as if Heltec tech support team has left the building some time ago…
STM32WL has superior specs (but is it supported by PIO already…)

can you guys please share a link to a board that is battery powered and in similar range of pricing as heltec (cubecell) but using the STM32WL, i would like to follow where this wagon is heading as I’m too getting tired of the minimal support from heltec team…


Hi Jay,

Came across this one: LoRa-E5-mini
(Very little about development support - only STM32Cube Programmer is mentioned).

Hi @peterm,
i did a bit of research and decided to go with this one… a much better documentation and supports LoRawan 1.03 as well.
it’s Chinese lunar year right now so i won’t see it on my desk for another Month :frowning:


Hi @jayjay,
Great choice, but RAK3272S Breakout Board doesn’t bring out all pins I need - too limited as real dev board.

Hi @peterm,
yes indeed and that’s why I’m eying this one :slight_smile:

can be ordered from here:


The same problem with AB02s. Solution is - start function after lowPowerHandler:
void pwmEnable()
uint8 enableInterrupts;
enableInterrupts = CyEnterCriticalSection();
enableInterrupts = CyEnterCriticalSection();

Hello Sav,
I’m having the same problem, I don’t understand how to use the PWM2_Enable() function.
I imported the PWM2.h library
That is the error that I receive when I execute the code
undefined reference to `PWM2_Enable()’
collect2.exe: error: ld returned 1 exit status
exit status 1
Errore durante la compilazione per la scheda CubeCell-Board(HTCC-AB01).