I am trying to migrate my project (for a custom nrf5340/nrf7002 board) from NCS2.9.0 to NCS 3.1.1, to hopefully get the wifi WPA Enterprise functionality to work.
This is an existing project, already in pre-production, that builds and works for wifi WPA2-PSK under NCS2.9.0.
My code (taken from the wifi sta sample) does this to start connection:
memset(&(ctx->cnx_params), 0, sizeof(struct wifi_connect_req_params));
ctx->cnx_params.security = WIFI_SECURITY_TYPE_WPA_AUTO_PERSONAL; // 1; allows WPA/WPA2/WPA3 PSK security.
// Note : this timeout does not seem to have any effect, the connect timeout in the WPA is always 10s (but we have a connect timer to shorten it if required)
// But don't set it less than the 10s as the wpa_supp doesn't like being disconnected while its still trying...
ctx->cnx_params.timeout = wvmgr_get_item_as_int("devcfg.wifi.connect_timeout_seconds", 30)* 1000; //SYS_FOREVER_MS;
/* Defaults */
ctx->cnx_params.band = WIFI_FREQ_BAND_2_4_GHZ; // WIFI_FREQ_BAND_UNKNOWN;
ctx->cnx_params.channel = WIFI_CHANNEL_ANY;
ctx->cnx_params.mfp = WIFI_MFP_OPTIONAL;
/* SSID */
// SSID, wpa2 pass can be set as specific to this network defn, or as a global AP setting
ctx->cnx_params.ssid = ssid;
ctx->cnx_params.ssid_length = strlen(ctx->cnx_params.ssid);
ctx->cnx_params.psk = wpa2_pass;
ctx->cnx_params.psk_length = strlen(ctx->cnx_params.psk);
if ((ret=net_mgmt(NET_REQUEST_WIFI_CONNECT, ctx->iface,
&ctx->cnx_params, sizeof(struct wifi_connect_req_params)))!=0) {
log_cpwrn("netwifi: Connection request WPA2-PSK failed (%d) to AP[%s][%s]; reset wifi", ret, ctx->cnx_params.ssid, ctx->cnx_params.psk);
ctx->connect_requested = false;
_wifi_reset(ctx);
return false;
}
With 3.1.1, I get a rapid response on the callback registered for wifi mgmt events:
- there the event mgmt_event = NET_EVENT_WIFI_CONNECT_RESULT, status=WIFI_STATUS_CONN_SUCCESS
- the connection works, I get an IP, and can then use the network connection with sockets etc.
What has changed in 3.1.1 that means the connection attempt no longer works?