- nRF connection Desktop v5.2.0
- Toolchain Manager v1.6.0
- Visual studio cade v2.9.2
- Windows 11 pro Platform
Hi,
What access point are you using? It could be that the access point does not support TWT.
Can you share device logs when enabling TWT? You can also try the Wi-Fi TWT sample.
Best regards,
Marte
Hi,
We are currently using a FreeBox Access Point, which supports TWT (Target Wake Time) power save mode. In the packet capture, we can see both the TWT Request and Accept frames. However, the client is still not entering power save mode.
TWT enabling logs:-
uart:~$ wifi twt setup 0 0 2 2 0 1 1 1 2000 60000
TWT operation TWT setup with dg: 2, flow_id: 2 requested
TWT response: TWT accept
== TWT negotiated parameters ==
TWT Dialog token: 2
TWT flow ID: 1
TWT negotiation type: TWT individual negotiation
TWT responder: true
TWT implicit: true
TWT announce: true
TWT trigger: true
TWT wake interval: 2048 us
TWT interval: 60000 us
For your reference Pcap screenshot attached below.
Thanks & regards,
Naveen P

Hi,
First, the TWT interval is in microseconds, so setting it to 60000 equals 0.06 seconds. This interval is the total TWT interval, i.e., both wake-up time and sleeping time. I would recommend increasing it, for example, to 6000000 instead.
Can you verify that the device does not enter sleep mode by measuring the power consumption or checking the sleep state using NET_EVENT_WIFI_TWT_SLEEP_STATE? You can see examples of how to check the sleep state in the TWT sample (see https://github.com/nrfconnect/sdk-nrf/blob/v2.9.2/samples/wifi/twt/src/main.c#L306) and in Lesson 6 exercise 2 - Enabling TWT with notification in our Wi-Fi Fundamentals course on DevAcademy. The latter also shows how to measure power consumption.
Best regards,
Marte
Hi Marte,
Apologies for the delayed response. I did try setting the interval to 6000000 as you suggested, but unfortunately, the client still does not enter the sleep state. It continues to stay awake
For your reference I had attached the pcaps below.
https://drive.google.com/file/d/19-B2L2V7YFyelTCId7S2xmWr-m4ONEEM/view?usp=drive_link
Hi,
Please verify that the device does not enter sleep state by measuring the power consumption or checking the sleep state using NET_EVENT_WIFI_TWT_SLEEP_STATE as I mentioned in my previous reply.
Best regards,
Marte
Hi,
As you advised, we followed the link https://academy.nordicsemi.com/courses/wi-fi-fundamentals/lessons/lesson-6-wifi-fundamentals/topic/lesson-6-exercise-2-2/nk, but we are still facing the same issue.
Thanks & Regards,
Naveen
Hi Naveen,
Did you test by measuring the power consumption and/or checking the sleep state using NET_EVENT_WIFI_TWT_SLEEP_STATE?
Best regards,
Marte
Hi Naveen,
Did you test by measuring the power consumption and/or checking the sleep state using NET_EVENT_WIFI_TWT_SLEEP_STATE?
Best regards,
Marte
Hi Marte,
As you advised, we followed the link https://github.com/nrfconnect/sdk-nrf/blob/v2.9.2/samples/wifi/twt/src/main.c#L306, However, we were unable to find a solution to our issue.
Kindly provide a clear and proper process to resolve the issue.
Thanks & Regards,
Naveen P
Hi Marte,
Please find the attached screenshot for your reference .

Hi Naveen,
If you add logging inside NET_EVENT_WIFI_TWT_SLEEP_STATE you should be able to see if it enters sleep state. For example, you can add this line after retrieving the twt_state:
LOG_INF("TWT sleep state: %s", *twt_state ? "awake" : "sleeping" );
So the full function will look like this:
static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb,
uint32_t mgmt_event, struct net_if *iface)
{
switch (mgmt_event) {
case NET_EVENT_WIFI_CONNECT_RESULT:
handle_wifi_connect_result(cb);
break;
case NET_EVENT_WIFI_DISCONNECT_RESULT:
handle_wifi_disconnect_result(cb);
break;
case NET_EVENT_WIFI_TWT:
handle_wifi_twt_event(cb);
break;
#ifdef CONFIG_SCHEDULED_TX
case NET_EVENT_WIFI_TWT_SLEEP_STATE: {
int *twt_state;
twt_state = (int *)(cb->info);
LOG_INF("TWT sleep state: %s", *twt_state ? "awake" : "sleeping" );
if (*twt_state == WIFI_TWT_STATE_SLEEP) {
traffic_gen_pause(&tg_config);
} else if (*twt_state == WIFI_TWT_STATE_AWAKE) {
traffic_gen_resume(&tg_config);
} else {
LOG_INF("UNKNOWN TWT STATE %d", *twt_state);
}
}
break;
#endif
default:
break;
}
}
With this, you should see log similar to this, which shows that the device enters sleep state:
TWT sleep state: sleeping TWT sleep state: awake TWT sleep state: sleeping TWT sleep state: awake TWT sleep state: sleeping
However, the best way to test whether it goes into sleep mode is to measure power consumption. If you have a PPK2 or another tool for measuring power consumption, I recommend doing so. The power consumption should look similar to this if it enters sleep mode:

Best regards,
Marte
Hi Marte,
As you advised, we followed the steps to collect the logs, but we are still not able to see the logs as expected.Please find the attached screenshot for your reference.

Additionally, we do not have a PPK2 device available to measure power consumption.
Thanks & Regards,
Naveen P
Hi Naveen,
The ifdef for CONFIG_SCHEDULED_TX should not have been included in the previous function, so I apologize for that.
Please try this instead:
static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb,
uint32_t mgmt_event, struct net_if *iface)
{
switch (mgmt_event) {
case NET_EVENT_WIFI_CONNECT_RESULT:
handle_wifi_connect_result(cb);
break;
case NET_EVENT_WIFI_DISCONNECT_RESULT:
handle_wifi_disconnect_result(cb);
break;
case NET_EVENT_WIFI_TWT:
handle_wifi_twt_event(cb);
break;
case NET_EVENT_WIFI_TWT_SLEEP_STATE: {
int *twt_state;
twt_state = (int *)(cb->info);
LOG_INF("TWT sleep state: %s", *twt_state ? "awake" : "sleeping" );
if (*twt_state == WIFI_TWT_STATE_SLEEP) {
traffic_gen_pause(&tg_config);
} else if (*twt_state == WIFI_TWT_STATE_AWAKE) {
traffic_gen_resume(&tg_config);
} else {
LOG_INF("UNKNOWN TWT STATE %d", *twt_state);
}
}
break;
default:
break;
}
}
You can also remove the traffic_gen_pause() and traffic_gen_resume() functions. The most important part is to log the sleep state:
static void wifi_mgmt_event_handler(struct net_mgmt_event_callback *cb,
uint32_t mgmt_event, struct net_if *iface)
{
switch (mgmt_event) {
case NET_EVENT_WIFI_CONNECT_RESULT:
handle_wifi_connect_result(cb);
break;
case NET_EVENT_WIFI_DISCONNECT_RESULT:
handle_wifi_disconnect_result(cb);
break;
case NET_EVENT_WIFI_TWT:
handle_wifi_twt_event(cb);
break;
case NET_EVENT_WIFI_TWT_SLEEP_STATE: {
int *twt_state;
twt_state = (int *)(cb->info);
LOG_INF("TWT sleep state: %s", *twt_state ? "awake" : "sleeping" );
}
break;
default:
break;
}
}
Best regards,
Marte