espressif / esp-at

AT application for ESP32/ESP32-C2/ESP32-C3/ESP32-C6/ESP8266
Apache License 2.0
836 stars 698 forks source link

How does modem wake up from light sleep mode. #832

Open EdwardRyu opened 1 month ago

EdwardRyu commented 1 month ago

Answers checklist.

General issue report

Hello,

Our product is using below version.

HW :
[ESP32-WROVER-E]

SW IDF-v4.4.4 ADF-V2.5 AT-v2.4.0.0

I have a couple of questions about sleep mode as follows.

  1. Can device wake up from light sleep mode by receiving AT commands from application processor?
  2. Can device wake up from light sleep mode when receiving packets from any of Ethernet or Wi-Fi?

Thanks, Edward

ustccw commented 1 month ago

@EdwardRyu

  1. No, this is the wakeup mode by uart. esp-at doesn't support it now. please refer to AT+SLEEPWKCFG for more details.
  2. Yes, device will auto wake up from light sleep, and do ESP-AT Message Reports, MCU can receive network data. please refer to Sleep AT Examples for more details.
ustccw commented 1 month ago

@EdwardRyu Of course, you can use any unused GPIO with input capability as the wakeup GPIO. maybe you can refer to your module datasheet for more details.

EdwardRyu commented 1 month ago

Hi,

I have issued following commands in order to put modem to light sleep mode.

Right after issuing those at commands, I could see some drops of current consumptions by modem from 120 mA to 48 mA.

In this sleep mode,

Questions are :

Q1) I am not sure whether if modem entered in light sleep mode or not. Could you guide how to check if modem is in light sleep mode or not? As you can see, below log snippets below, I couldn't see any sleep specific AT response from modem after AT+SLEEP=2. https://cdn-shop.adafruit.com/product-files/3384/esp32-wrover_datasheet_en.pdf image

Q2) After it enters this mode, I mean the state where the modem consumes around 48 mA, sometimes the current consumption is varying from 48 to 80 mA, sometimes it keep lower values around 50mA. I wonder what makes the current consumption jumping/fluctuating.

Q3) What is the range of current consumption by modem in light sleep mode? When I look into data sheet from below link it mentioned between 0.8 mA. But the gap between our measure and the data in data sheet is far different. Could you tell me more about this?

Q4) In this mode, when I send AT command from MCU to modem, I could get response from modem as usual. I wonder if modem will be getting into sleep mode again automatically or not after getting AT response from modem. Or do we have to issue any AT+SLEEP command to modem again?

Q5) Regarding GPIO wakeup configuration, regardless of any GPIO number. Do you have any specific requirement for selecting GPIO for wakeup signal?

I (416114) UART_TASK: at_port_write_data - len 22, data - at+SLEEPWKCFG=2,28,0

I (416115) UART_TASK: at_port_write_data - len 9, data - ERROR

I (569871) UART_TASK: at_port_write_data - len 22, data - at+SLEEPWKCFG=2,12,0 E (569872) gpio: gpio_install_isr_service(449): GPIO isr service already installed I (569873) UART_TASK: at_port_write_data - len 9, data - ERROR

[2024-05-24 16:33:28.735] [0] [ATT][MODM] AT+CWMODE=1 [2024-05-24 16:33:28.735] [2024-05-24 16:33:28.766] [2] [ATR][19,0x200004fc] [2024-05-24 16:33:28.766] AT+CWMODE=1 [2024-05-24 16:33:28.766] [2024-05-24 16:33:28.766] OK

[2024-05-24 16:33:34.032] [2] [ATT][MODM] AT+CWJAP=,,,,,3 [2024-05-24 16:33:34.032] [2024-05-24 16:33:34.079] [4] [ATR][55,0x200004fc] [2024-05-24 16:33:34.079] AT+CWJAP=,,,,,3 [2024-05-24 16:33:34.079] WIFI DISCONNECT [2024-05-24 16:33:34.079] +MQTTDISCONNECTED:0

[2024-05-24 16:33:34.110] [8] [ATR][16,0x200004fc] [2024-05-24 16:33:34.110] WIFI CONNECTED [2024-05-24 16:33:35.128] [7] [ATR][19,0x200004fc] [2024-05-24 16:33:35.128]
[2024-05-24 16:33:35.128] OK [2024-05-24 16:33:35.128] WIFI GOT IP

[2024-05-24 16:35:35.220] [0] [ATT][MODM] AT+SLEEP=2 [2024-05-24 16:35:35.220] [2] [ATR][18,0x200004fc] [2024-05-24 16:35:35.236] AT+SLEEP=2 [2024-05-24 16:35:35.236] [2024-05-24 16:35:35.236] OK

--> after this, we can issue any AT command and modem responds back as normal. --> I wonder if the modem goes into light sleep mode again automatically or not after receiving response from modem. --> The current consumption is still same.

Thanks, Edward

ustccw commented 6 days ago

@EdwardRyu May i know which firmware you use? and would you mind trying to compile your firmware based on master branch.

In generally:

Q1

If the average current of your module is less than 5mA, it should have entered in light-sleep. During light-sleep, AT is not able to respond the AT commands normally. Have you read the this document before, I am not sure how you measure the current, are you sure using the module, rather than a development board?

Q2

I don't think your module have entered light-sleep mode.

Q3

We did not provide a guarantee for a range of average current values. But as a test, during the light-sleep, the average current should be less than 5mA. The data about auto light-sleep, you can refer to this doc, see the auto light Sleep column.

0.8mA is the chip current, not the module current. Moreover, esp-at uses the auto light-sleep to keep the Wi-Fi connection and network connection, rather than the normal light-sleep that datasheet mentioned.

Q4

esp-at does not respond to any AT commands during light-sleep. I don't think your module have entered light-sleep mode. If the Wi-Fi module enters light-sleep, there is no need to send the AT+SLEEP command again. The device will automatically sleep and wake up based on the wake-up config (AT+SLEEPWKCFG) and network status.

Q5

You can use any unused GPIO with input capability as the wakeup GPIO.

~

EdwardRyu commented 2 days ago

Hello,

Thanks for your feedback.

Our test environment is like attached snap shot. We cut the board and connected two points as described as your post. image

When I test the original ESP-AT V2.4 over our development board, I could see light sleep current is less than 2mA. After enabling ETHERNET feature with below option, however, then CPU cannot go into light sleep mode. As you can see, it is above 25 mA although 'AT+SLEEP=2' returned OK.

CONFIG_AT_ETHERNET_SUPPORT=y CONFIG_PHY_RTL8201=y

Could you please check and let me know what the problem is here?

Ethernet cable was not even plugged in yet, but the device cannot enter the light sleep mode.

Thanks, Edward