In the Wi-Fi Fundamentals Course, Lesson 2, Exercise 2 (step 7.2) I found that it is necessary to clear the bssid parameter in the wifi_connect_req_params structure. If it is not cleared and happens to have a non-zero value, then the Wi-Fi stack will assume it is a valid requested BSSID and only connect to an Access Point with a matching BSSID (MAC address). That makes it never connect unless you are lucky and the bssid bytes were cleared. I added the `memset` line to fix the problem:
/* STEP 7.2 - Populate the rest of the relevant members */ params->channel = WIFI_CHANNEL_ANY; params->security = WIFI_SECURITY_TYPE_PSK; params->mfp = WIFI_MFP_DISABLE; params->timeout = SYS_FOREVER_MS; params->band = WIFI_FREQ_BAND_UNKNOWN; // This is required. If a random non-zero bssid is set, then it will think we require an AP with that MAC/BSSID memset(params->bssid, 0, sizeof(params->bssid));