Hello,
I'm using the new SDK 2.1 since this morning.
Until the new sdk (using the SDK 2.0), I was able to use the light sleep mode by doing this :
void fpm_wakup_cb(void)
{
wifi_fpm_close(); // disable force sleep function
wifi_set_opmode(STATION_MODE); // set station mode
wifi_station_connect(); // connect to AP
os_timer_arm(&s_Timer, TIMER_TIME_MS, 1);
uart_rx_intr_enable(UART1);
os_printf("WakeUp !\n");
}
void ICACHE_FLASH_ATTR prepare_to_sleep(void)
{
int8_t err;
os_timer_disarm(&s_Timer);
LED_OFF;
os_printf("Go to sleep mode...\n\n");
uart_rx_intr_disable(UART1);
wifi_station_disconnect();
//wifi_set_opmode(NULL_MODE); // set WiFi mode to null mode.
wifi_set_opmode_current(NULL_MODE);
wifi_fpm_set_sleep_type(LIGHT_SLEEP_T); // light sleep
wifi_fpm_open(); // enable force sleep
wifi_fpm_set_wakeup_cb(fpm_wakup_cb); // Set wakeup callback
UART_CheckOutputFinished(UART1, 1000000);
wifi_fpm_do_sleep(30 * 1000 * 1000);
}
Each time I call function prepare_to_sleep, the ESP enter sleep mode and wake up after 30s.
But, since the new SDK 2.1, it doesn't work...
Sometimes the wakeup is done juste after the sleep, like if sleep timeout is 1us, and sometimes no wakeup from sleep...
Maybe I do something wrong...
Thanks for your help,
Best regards
SDK 2.1 ligth sleep mode
-
- Posts: 7
- Joined: Mon Jan 15, 2018 6:34 pm
-
- Posts: 7
- Joined: Mon Jan 15, 2018 6:34 pm
Re: SDK 2.1 ligth sleep mode
Postby JulienInnovel » Thu Feb 08, 2018 9:12 pm
Hi,
Here is the function :
Here is the function :
Code: Select all
bool ICACHE_FLASH_ATTR
UART_CheckOutputFinished(uint8 uart_no, uint32 time_out_us)
{
uint32 t_start = system_get_time();
uint8 tx_fifo_len;
uint32 tx_buff_len;
while(1){
tx_fifo_len =( (READ_PERI_REG(UART_STATUS(uart_no))>>UART_TXFIFO_CNT_S)&UART_TXFIFO_CNT);
if(pTxBuffer){
tx_buff_len = ((pTxBuffer->UartBuffSize)-(pTxBuffer->Space));
}else{
tx_buff_len = 0;
}
if( tx_fifo_len==0 && tx_buff_len==0){
return TRUE;
}
if( system_get_time() - t_start > time_out_us){
return FALSE;
}
WRITE_PERI_REG(0X60000914, 0X73);//WTD
}
}
Who is online
Users browsing this forum: No registered users and 117 guests
Login
Newbies Start Here
Are you new to ESP8266?
Unsure what to do?
Dunno where to start?
Start right here!
Latest SDK
Documentation
Complete listing of the official ESP8266 related documentation release by ESPRESSIF!
Must read here!
- All times are UTC+08:00
- Top
- Delete all board cookies
About Us
Espressif Systems is a fabless semiconductor company providing cutting-edge low power WiFi SoCs and wireless solutions for wireless communications and Internet of Things applications. We are the manufacturer of ESP8266EX.