Configuring TWT on FreeRTOS (IoT-SDK)
Features > Target Wake Time (TWT)
General Configuration
The following guidance is provided for setting the TWT parameters.
TWT Wake Interval (us) - The current default is 30 seconds. The minimum value is recommended to be longer than the beacon interval (default beacon interval is 100ms) at a minimum, and probably a multiple of beacon intervals.
Minimum Wake Duration (us) - can be configured between 1 and 65280us, with the default being the maximum value. Values below 32640 have shown unreliable behaviour in field testing.
Setup command - note that only request and response are currently supported, though demand is also defined in the 802.11 standard.
This guidance doesn’t account for any duty cycle related restrictions that apply in some regions.
FreeRTOS (IoT-SDK)
TWT can be configured in the MM-IoT-SDK using the mmwlan API, see the reference manual and mmwlan.h for more details.
TWT configurations are added by invoking the mmwlan_twt_add_configuration() function, an example of which is shown below. TWT configurations should be added after WLAN initialization (mmwlan_init()), but before connecting to the AP (mmwlan_sta_enable()).
static void add_twt_configuration(void)
{
enum mmwlan_status status;
struct mmwlan_twt_config_args twt_config = MMWLAN_TWT_CONFIG_ARGS_INIT;
twt_config.twt_mode = MMWLAN_TWT_REQUESTER;
twt_config.twt_setup_command = MMWLAN_TWT_SETUP_REQUEST;
twt_config.twt_wake_interval_us = 300000000;
twt_config.twt_min_wake_duration_us = 65280;
status = mmwlan_twt_add_configuration(&twt_config);
if (status == MMWLAN_SUCCESS)
{
printf("Successfully added TWT configuration\n");
}
else
{
printf("Failed to set TWT configuration\n");
}
}