espressif / esp-idf

Espressif IoT Development Framework. Official development framework for Espressif SoCs.
Apache License 2.0
13.45k stars 7.25k forks source link

Make Wi-Fi Target Wake Time settable (IDFGH-12927) #13884

Open corrado113 opened 4 months ago

corrado113 commented 4 months ago

Is your feature request related to a problem?

I am playing with my ESP32-C6 and the iTWT example. I noticed that many parameters can be set to setup a TWT session, however, the exact target wake time value can not be set. My understanding is that the TWT is derived automatically by the driver according to the time instant when the _esp_wifi_sta_itwtsetup() function is called. Specifically, the TWT is set equal to the next TBTT.

Describe the solution you'd like.

The programmer should arbitrarily set the target wake time. The struct _wifi_twt_setup_configt should contain an additional field to specify the target wake time, such that the STA is able to wake up in other moments than the TBTT. This is a fundamental feature when energy consumption and latency are critical.

Describe alternatives you've considered.

No response

Additional context.

No response

xuxiao111 commented 4 months ago

Hi @corrado113, Thank you for your suggestion. In the current design, the target wakeup time is based on a multiple of the TBTT. This allows us to wake up and receive the beacon information to synchronize our own TSF, ensuring we wake up at the correct time next time. We also provide an API to modify the target wakeup time offset: esp_err_t esp_wifi_sta_itwt_set_target_wake_time_offset(int offset_us). However, the actual target wakeup time is determined by the AP (Access Point). As a Station, we can only suggest a target wakeup time.