Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
3 tasks done
EdwardRyu opened this issue May 13, 2024 · 6 comments
Open
3 tasks done

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

EdwardRyu opened this issue May 13, 2024 · 6 comments
Labels
Status: Awaiting Response awaiting a response from the author

Comments

@EdwardRyu
Copy link

Answers checklist.

  • I have read the documentation ESP-AT Programming Guide and the issue is not addressed there.
  • I have used the latest released firmware or have updated my ESP-AT branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

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
Copy link
Collaborator

ustccw commented May 17, 2024

@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
Copy link
Collaborator

ustccw commented May 20, 2024

@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
Copy link
Author

EdwardRyu commented May 27, 2024

Hi,

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

  • AT+CWMODE=1
  • AT+CWJAP=,,,,,3
  • AT+SLEEP=2

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,

  • I am able to send and receive AT commands properly.
  • I could receive packets from internet as well.
  • Current consumption is still less than before entering light sleep mode, but it is fluctuating.

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
Copy link
Collaborator

ustccw commented Jul 1, 2024

@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.

  • AT+SLEEPWKCFG=2,28,0 returned ERROR, because of GPIO28 is not a available GPIO to users.
  • AT+SLEEPWKCFG=2,12,0 returned GPIO isr service already installed, it seems that you have already sent this command before. Could you please provide a complete log if issue still exists.

~

@EdwardRyu
Copy link
Author

EdwardRyu commented Jul 4, 2024

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

@ustccw ustccw added the Status: Awaiting Response awaiting a response from the author label Oct 10, 2024
@ustccw
Copy link
Collaborator

ustccw commented Oct 10, 2024

@EdwardRyu We sincerely apologize that esp-idf has not yet optimized the power consumption for Ethernet usage. This means that when Ethernet is enabled, the module may not be able to enter light-sleep, resulting in relatively higher power consumption.

If this feature is essential for your product, we kindly suggest submitting detailed requirements to esp-idf issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Awaiting Response awaiting a response from the author
Projects
None yet
Development

No branches or pull requests

2 participants