The following example is for a typical application Application Programming Interface (API).
If shared antenna use case, set CONFIG_COEX_SEP_ANTENNAS=n in the prj.conf file
Initialization -
/* Reset the coexistence hardware */
if(nrf_wifi_coex_hw_reset()){
LOG_ERR(“Error resetting coex hardware”);
return -1;
}
/* This enables the proper antenna configuration.
* It can be called anytime independent of other coexistence APIs
*/
if(nrf_wifi_config_sr_switch(antenna_mode)){
LOG_ERR(“Error switching antenna mode”);
return -1;
}
/* One time initialization of register in the coex control
* logic around PTA
*/
if(nrf_wifi_coex_config_non_pta(antenna_mode)){
LOG_ERR(“Error in non-pta coex config”);
return -1;
}
....
....
/* Connect Wi-Fi to an Access Point. Get wlan_band once connected */
...
...
In appropriate function/task of application code -
/* Configure the PTA coexistence table based on whether Wi-Fi
* is in 2.4GHz or 5GHz band
*/
if(nrf_wifi_coex_config_pta(wlan_band, antenna_mode)){
LOG_ERR(“Error in pta coex config”);
return -1;
}
During Wi-Fi shutdown mode –
/* Put Wi-Fi in shutdown mode */
....
....
/* Disable SR coex */
mpsl_cx_nrf700x_set_enabled(false);
....
/* continue with Bluetooth®
LE/IEEE 802.15.4 operation */
....
/* Power up Wi-Fi */
....
/* Enable SR coex */
mpsl_cx_nrf700x_set_enabled(true);
/* Normal concurrent Wi-Fi, Bluetooth LE/IEEE 802.15.4 operation with coex enabled */
....
....