Presto - WiFi fails to connect

I’ve been having problems getting the WiFi on the Presto to connect using the cwy43_driver from the SDK.

cyw43_arch_init() seems to work fine, as does cyw43_arch_enable_sta_mode(). However, cyw43_arch_wifi_connect_timeout_ms() fails every time.

I’ve tried running the same code on a Pico 2W, and it works without a problem.

I’d really appreciate any guidance/help that anyone can offer.

The following is the output I’m getting in the Visual Studio serial monitor:-

---- Opened the serial port /dev/ttyACM0 ----
Wi-Fi init ok
Version: 7.95.49 (2271bb6 CY) CRC: b7a28ef3 Date: Mon 2021-11-29 22:50:27 PST Ucode Ver: 1043.2162 FWID 01-c51d9400
[CYW43] error: hdr mismatch 0100 ^ ffff
[CYW43] error: hdr mismatch 0100 ^ ffff
[CYW43] error: hdr mismatch 040e ^ fffb
[CYW43] Bus error condition detected 0x2002
[CYW43] do_ioctl(2, 263, 1008): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] CLM load failed
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
Warning. No mac in otp. Generating mac from board id
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
cyw43 loaded ok, mac 00:00:00:00:00:00
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
clmver
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
Wi-Fi enabled

Connecting to Wi-Fi…
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
[CYW43] STALL(0;1-1): timeout
connect status: joining
failed to connect.

I’ve done a bit more digging of my own, and am beginning to wonder whether this problem may simply be caused by my choice of PICO_BOARD.

I’d used the presto-boilerplate project code as a model for the project I’m working on, and this has a PICO_BOARD setting of pimoroni_pico_plus2_rp2350. The problem with this is that it didn’t build the cyw43 drivers, so I had changed PICO_BOARD to pico2_w. However, having looked deeper into the Pico SDK I have found a possible PICO_BOARD setting of pimoroni_pico_plus2_w_rp2350, so I am going to give this a try to see if it makes a difference.

Unfortunately I won’t be able to check this today, but I’ll report back as soon as I get the chance to try it out.

Update. I have tried setting PICO_BOARD to pimoroni_pico_plus2_rp2350, but this makes no difference to the problem that I have been getting. I am still getting the CYW43 hdr mismatch and CYW43 stall messages, and the WiFi fails to connect every time I try it.

I’m not sure what else I can try in order to get this working, and am actually wondering whether it might be a hardware fault. Any suggestions would be gratefully received.

Further update - SOLVED:

The Presto Boilerplate project, on which my project is based, had the line:-

set_sys_clock_khz(240000, true);

at the beginning of the main program code. I experimented with changing the frequency.

I have found that using a frequency value of 120000 causes my problem to go away. I’ve yet to see if this might cause me other issues, but for now I have at least got the WiFi to connect successfully.