set channel in sleep mode, fail and exit
Posted: Sun May 07, 2023 2:51 am
Hello,
I have been scouring the internet and have came up empty handed. I have an ESP-01 where I made a project to read a temp sensor and post to my mqtt broker. The program worked great after some tweaking and now I am trying to include a light sleep. I am unable to do deep sleep since I don't have access the the required pin (tried on one and ended up pulling a pad ).
I have successfully deployed the light sleep and the current drops to uA but I have this error popup when I try to wake and re-initialize wifi.
After a few tries and an error (is it reporting what is stored in the buffer?) it reconnects, sends the temp and continues on. After about 3-5 cycles of this, it finally errors out and stops running all together. It appears that wifi drivers are still asleep? I am not sure if channel refers to trying to connect to the scanned channel found or something else. I am using channel 11 on my router. I tried adding de-init to no success. Did not find any information on needing to wake up things once timer was done.
For the wifi init I am using the example code. Here is everything else I got in regards to sleep:
Sleep function:
Appreciate any guidance.
I have been scouring the internet and have came up empty handed. I have an ESP-01 where I made a project to read a temp sensor and post to my mqtt broker. The program worked great after some tweaking and now I am trying to include a light sleep. I am unable to do deep sleep since I don't have access the the required pin (tried on one and ended up pulling a pad ).
I have successfully deployed the light sleep and the current drops to uA but I have this error popup when I try to wake and re-initialize wifi.
After a few tries and an error (is it reporting what is stored in the buffer?) it reconnects, sends the temp and continues on. After about 3-5 cycles of this, it finally errors out and stops running all together. It appears that wifi drivers are still asleep? I am not sure if channel refers to trying to connect to the scanned channel found or something else. I am using channel 11 on my router. I tried adding de-init to no success. Did not find any information on needing to wake up things once timer was done.
For the wifi init I am using the example code. Here is everything else I got in regards to sleep:
Code: Select all
printf("MQTT CONNECT\n");
printf("MQTT SEND DATA\n");
mqtt_app_start();
printf("STOP MQTT\n");
mqtt_disconnect();
printf("STOP WIFI 2\n");
ESP_ERROR_CHECK(esp_wifi_disconnect());
ESP_ERROR_CHECK(esp_wifi_stop());
// ESP_ERROR_CHECK(esp_wifi_deinit());
printf("START TIMER\n");
sleep_mode();
printf("START wifi\n");
ESP_ERROR_CHECK(esp_event_loop_delete_default());
wifi_init_sta();
mqtt_connect();
Sleep function:
Code: Select all
void sleep_mode() {
esp_sleep_enable_timer_wakeup(TIMER_WAKEUP_TIME_US);
ESP_ERROR_CHECK(esp_light_sleep_start());
printf("WAKEUP!\n");
vTaskDelay(pdMS_TO_TICKS(1) / portTICK_RATE_MS);
}
Code: Select all
I (2238) tcpip_adapter: sta ip: 192.168.7.133, mask: 255.255.255.0, gw: 192.168.7.1
I (2242) wifi station: got ip:192.168.7.133
I (2246) wifi station: connected to ap
I (2253) system_api: Base MAC address is not set, read default base MAC address from EFUSE
I (2268) MQTT_EXAMPLE: Other event id:7
MQTT CONNECT
MQTT SEND DATA
I (2296) MQTT_EXAMPLE: MQTT_EVENT_CONNECTED
STOP MQTT
I (4061) MQTT_CLIENT: Client asked to disconnect
STOP WIFI 2
I (4213) wifi:state: 5 -> 0 (0)
START TIMER
WAKEUP!
START wifi
I (10531) system_api: Base MAC address is not set, read default base MAC address from EFUSE
I (10536) system_api: Base MAC address is not set, read default base MAC address from EFUSE
I (10549) wifi station: wifi_init_sta finished.
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
set channel in sleep mode, fail and exit
I (12593) wifi station: retry to connect to the AP
I (12596) wifi station: connect to the AP fail
set channel in sleep mode, fail and exit
E:RX 16b
rxbufbit:ffff
E:AC 1, 33, 52
CONF:b00b, PLCP:632da0, rf:50000000, rx:0,0, tx:10000
I (14652) wifi station: retry to connect to the AP
I (14655) wifi station: connect to the AP fail
I (14773) wifi:state: 0 -> 2 (b0)
I (14774) wifi:state: 2 -> 3 (0)
I (14776) wifi:state: 3 -> 5 (10)
I (14788) wifi:connected with Garden, aid = 5, channel 11, HT20, bssid = 68:72:51:7e:7b:c6
I (16534) tcpip_adapter: sta ip: 192.168.7.133, mask: 255.255.255.0, gw: 192.168.7.1
I (16538) wifi station: got ip:192.168.7.133
I (16542) wifi station: connected to ap
W (16549) event: handler already registered, overwriting
I (16558) MQTT_EXAMPLE: Other event id:7
MQTT CONNECT
MQTT SEND DATA
I (16592) MQTT_EXAMPLE: MQTT_EVENT_CONNECTED
STOP MQTT
I (18356) MQTT_CLIENT: Client asked to disconnect
STOP WIFI 2
I (18437) wifi:state: 5 -> 0 (0)
START TIMER
Appreciate any guidance.