I am working on some kind of sensor device with RTOS SDK, of cause, backed by battery power.
The device is designed to fall in deep sleep and wakeup every few seconds. In wakeup time, it only sends a broadcast packet (< 100bytes) and go back to deep sleep.
The time between wakeup and next sleep should be very short (< 20ms) in theory.
But, by measuring the time different between GPIO2 first rise and last fall, it takes about 250ms.
That's much longer than my expectation.
Does anyone know how to cut the additional 200+ ms or where does it come?
my program looks like this
void tm_func(void *arg)
{
static int i=0;
if(i == 1)
send_mydata()
if(i == 2)
system_deep_sleep(1000*1000*5);
i++;
}
void user_init(void)
{
int i;
os_timer_disarm(&tm);
os_timer_setfn(&tm, (os_timer_func_t *)tm_func, NULL);
os_timer_arm(&tm, 2, 1);
os_printf("SDK version:%s\n", system_get_sdk_version());
system_deep_sleep_set_option(0);
}