Skip to content

Conversation

@paulober
Copy link
Collaborator

@paulober paulober commented Dec 11, 2025

Overview

This PR updates the WiFi example so it builds and runs correctly on current Zephyr versions.
It fixes broken POSIX usage, missing headers, DNS memory leaks, and API changes introduced upstream.

  • POSIX API cleanup

    • Correct use of Zephyr’s POSIX layer (getaddrinfo, socket, connect, etc.)
    • Added required headers and cleaned include order.
    • Removed unused headers.
  • prj.conf updates

    • Added CONFIG_POSIX_API=y to enable POSIX declarations.
  • Memory leak fix

    • Added freeaddrinfo() in all exit paths.
    • Ensured sockets are properly closed on errors.
  • Networking updates

    • Updated ICMP/ping code to current APIs.
    • WiFi example now sets correct PSK, band, and parameters.
    • Pin used wifi band and dropped unused enterprise settings
  • General cleanup

    • Some minor issues.
    • Improved code formatting.
    • Removed unused or outdated code.

Result

The full example now builds cleanly on Zephyr ≥ 4.3 and successfully performs WiFi connection, DHCP, DNS, HTTP GET/POST, JSON parsing, and ICMP ping on Raspberry Pi Pico 2 W.

@paulober paulober force-pushed the fix-zephyr-wifi-example branch from 1508c63 to 331c70e Compare December 11, 2025 20:25
@paulober paulober requested a review from will-v-pi December 11, 2025 20:25
@jancumps
Copy link

This pull request mixes code changes with reformatting of unchanged code. Makes it harder to understand what's fixing problems.

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.

3 participants