Skip to content

Wifi on Zephyr + TCP socket primitives - #394

Merged
MaartenS11 merged 28 commits into
mainfrom
feat/zephyr-wifi
Jul 16, 2026
Merged

Wifi on Zephyr + TCP socket primitives#394
MaartenS11 merged 28 commits into
mainfrom
feat/zephyr-wifi

Conversation

@MaartenS11

@MaartenS11 MaartenS11 commented Jul 14, 2026

Copy link
Copy Markdown
Member

This PR adds primitives to connect and disconnect from wifi networks + tcp socket primitives.

The following primitives have been added.

  • wifi_connect(ssid, ssid_len, password, password_len
  • wifi_disconnect()
  • wifi_localip(buf_ptr)
  • socket_create(ip_addr, ip_len, port
  • socket_create_server(port)
  • socket_accept(socket)
  • socket_send(socket, msg_addr, msg_len)
  • socket_receive(socket, buf_addr, buf_len)
  • socket_close(socket)

Tested on both the Raspberry Pi Pico W and ESP 32 C3 Super Mini.

Is on by default but can be configured with KConfig:
Screenshot 2026-07-16 at 11 23 00

Seems to cause a connection to return -22?
Credentials will be part of the wasm module in WARDuino
Seems to work, mostly just have to add three primitives now!
By actually disconnecting, re-connecting later becomes much easier since the wifi network knows that the device is gone and doesn't wait for some timeout.
This way there is no garbage in this fields which can confuse the driver.
TODO: Reading from a socket
This now makes it possible to for example create an echo server, among many other possibilities!
If you want retry you can always just run the socket function in a loop yourself.
@MaartenS11
MaartenS11 marked this pull request as ready for review July 15, 2026 12:42
We also don't use any Zephyr code in this file so technically we could also use it in the emulator to have real socket support!
@MaartenS11
MaartenS11 force-pushed the feat/zephyr-wifi branch 2 times, most recently from 1cf6055 to 6050518 Compare July 16, 2026 08:24
@MaartenS11
MaartenS11 force-pushed the feat/zephyr-wifi branch 2 times, most recently from 5266676 to 50c338d Compare July 16, 2026 09:38
Also fixed stm32 overlay not working
…g primitives

This way you don't have to configure a bunch of Kconfig options to turn it on or off but just one!
… as the other platforms

Returning the actual size is a useful thing. The second argument is not really that useful, it seems like all platforms ignore it.
@MaartenS11
MaartenS11 merged commit 5486eb8 into main Jul 16, 2026
19 checks passed
@MaartenS11
MaartenS11 deleted the feat/zephyr-wifi branch July 16, 2026 12:24
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.

1 participant