Skip to content

Add basic WiFi support for CYW43 driver#777

Merged
mattnite merged 6 commits intoZigEmbeddedGroup:mainfrom
tom-dudley:cyw43-sdpcm-minimal
Dec 24, 2025
Merged

Add basic WiFi support for CYW43 driver#777
mattnite merged 6 commits intoZigEmbeddedGroup:mainfrom
tom-dudley:cyw43-sdpcm-minimal

Conversation

@tom-dudley
Copy link
Contributor

@tom-dudley tom-dudley commented Dec 23, 2025

This is my attempt at getting WiFi working for the CYW43 (e.g. Raspberry Pi Pico 2 W), building on #489. It adds AP scanning and AP connection (the unhappy path may not be as thoroughly tested..I was mainly concerned with getting a network stack working in principle.)

Some notes:

  • Similar to CYW43xx driver - part 1 #489 this relies heavily on embassy-rs and the upstream Infineon wifi-host-driver
  • I've left the runner as it is but the semantics might want to be changed. The Rust code uses async for handling but we're not using async so..unsure if it makes sense to have the runner.
    • runner.run() return a bool indicating if a frame is ready. to be read; runner.get_rx_frame() is used to read it. Maybe that's redundant and we should just use the null from get_rx_frame.
  • Given that the RPI Pico 2 W has the LED wired up to the chip, I've made it so that wifi.gpio_set(0, true) can set that pin. I'm unsure if this is the best place to make this work (it does work for enabling/disabling the LED).
  • It's at the point where ethernet frames can be sent/received - see examples.
  • I think the side_set in the pio/spi code should be using the clk_pin - so there's a bug fix for that too.
  • I've copied/tweaked the blinky example for this board as it requires slightly different setup. The README should explain all this. For reference: https://github.com/raspberrypi/pico-examples/blob/master/pico_w/wifi/blink/picow_blink.c .
  • There's a wifi_scan.zig and wifi_connect.zig examples. Note I've only tested these (and the blinky example) on the Pico 2 W, not the Pico W. I assume it 'just works' as it's the same wireless chip.

@Grazfather
Copy link
Collaborator

Could you add an example to the repo?

@arkadiuszwojcik
Copy link
Contributor

arkadiuszwojcik commented Dec 23, 2025

Very nice! I was actually waiting for Zig 0.16 and the new IO stuff to add this, but you were faster ; ) I will definitely take a look but probably during weekend. If this works, it will be a great base for the I/O rewrite when we switch to Zig 0.16. Btw @tom-dudley I am also C# programmer ; )

@tom-dudley
Copy link
Contributor Author

Thanks folks! I've added examples for WiFi scanning, joining and turning the LED on and off :)

Copy link
Contributor

@mattnite mattnite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great patch! just have some naming nits

@tom-dudley tom-dudley requested a review from mattnite December 23, 2025 22:07
@tom-dudley
Copy link
Contributor Author

@mattnite I'm not sure why CI didn't get kicked off with the latest commits (ignoring merge commits perhaps?) If you retrigger it should be back to everything passing.

@mattnite mattnite force-pushed the cyw43-sdpcm-minimal branch from e42f043 to b49c7be Compare December 24, 2025 07:12
@mattnite mattnite merged commit 5dfb8ea into ZigEmbeddedGroup:main Dec 24, 2025
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants