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
PWM1_Enable();
PWM2_Enable();
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.
(~/.platformio/packages/framework-arduinoasrmicro650x/cores/asr650x/lora/system/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…

cheers,
Jay

Hi Jay,

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

Hi @peterm,
i did a bit of research and decided to go with this one… https://store.rakwireless.com/products/wisduo-lpwan-module-rak3172?variant=40014759297222 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:

cheers,
Jay

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

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


can be ordered from here: https://oshpark.com/shared_projects/Ss2INNiR

cheers,
Jay

The same problem with AB02s. Solution is - start function after lowPowerHandler:
void pwmEnable()
{
uint8 enableInterrupts;
enableInterrupts = CyEnterCriticalSection();
PWM2_BLOCK_CONTROL_REG |= PWM2_MASK;
CyExitCriticalSection(enableInterrupts);
enableInterrupts = CyEnterCriticalSection();
PWM2_COMMAND_REG = ((uint32)(PWM2_MASK << PWM2_CMD_START));
CyExitCriticalSection(enableInterrupts);
}

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).

Hello,

I am using the CubeCell GPS-6502 (HTCC-AB02S) and am having the same problem with waking the device.

Could possibly please help by explaining:

  1. Where to locate these libraries PWM1.h & PWM2.h
  2. How to modify the sketch - I used this one - https://github.com/HelTecAutomation/CubeCell-Arduino/tree/master/libraries/LoRa/examples/LoRaWAN/LoRaWAN_Sensors/LoRaWan_OnBoardGPS_Air530Z

I am sorry for asking such detailed questions and support, but I am really struggling to get this to work.

Thanks

Hi, Can you help with where to get the libraries and how to modify the sketch?

Many thanks for any help you can provide