Home/Support/Support Forum/PM_MODE_WAIT not working as described and how to cyclic wake up < 1sec.

PM_MODE_WAIT not working as described and how to cyclic wake up < 1sec.

0 votes

i want to make use of CPU PM_MODE_WAIT.

According library documentation:
PM_MODE_WAIT to set the CPU in wait mode (CPU is shutdown but the system clocks are running and the full regulation is maintained)

but in pm.c
/* Wait LP is not supported, so... just wait */

In fact, the CPU continues to run. 'wait()' translates as 'asm(wait;)'.
So, documentation is wrong or the function is not properly implemented.

What I am trying to archive is, that the CPU wakes up every 250ms in order to read an SPI sensor.
Only if a certain condition is met, the radio has to wake up and transmit a message.

I activated the RTC periodic task, which calls void rtc_periodic_task(void) every 252ms.
But, while in PM_MODE_STOP_2 or 3, it takes approx a second until rtc_periodic_task(void) is called.

Another attempt was using a timer, but here the ISR is not called when sleeping, since the clocks are down.

So, what's the strategy to wake up cyclic with intervals < 1s?

Any idea is appreciated.

asked Jul 18, 2017 in XBee Programmable Development by mick New to the Community (1 point)

Please log in or register to answer this question.

1 Answer

0 votes

I was able to help myself.
I have commented out 'rtc_config_slow();' in pm.c.
Now, the rtc periodic task fires with the required accuracy while CPU is sleeping.
imho, the SDK should provide a function for this.


/* Enable IRCLK in stop3 mode so RTC can wake up the CPU */
/* The CPU is going to sleep, but before the system tick frequency is
* reconfigured to 2 seconds, to sleep longer and minimize the power
* consumption. Later, its needed to differentiate the system tick
* interrupts, from the real wakeup interrupts. This is done in the
* RTC interrupt handler.
seconds_to_wakeup = sleep_seconds ? uptime + sleep_seconds : WAIT_INFINITE;
//below is causing the RTC to wake up with delay.
answered Jul 27, 2017 by mick New to the Community (1 point)