Open Claghorn opened 11 months ago
Revelation! The example program is fine, but the cmake stuff (which is totally obscure to me) does not manage to get the environment variables for WIFI_SSID and WIFI_PASSWORD all the way into the program as strings. If I add this near the top of the code, the program then compiles and works perfectly:
#undef WIFI_SSID
#define WIFI_SSID "ExampleSSID"
#undef WIFI_PASSWORD
#define WIFI_PASSWORD "ExamplePassword"
(Substituting the actual ssid and password in the real code).
I built the tcp_server example (the background version, not the poll version) with double and triple checked SSID and password and the connect always fails with a bad auth error. (I did modify the printf to print the error code, which is how I know it is bad auth).
If I set up a guest network with no security, the example works fine.
Then I tried the micropython code from https://projects.raspberrypi.org/en/projects/get-started-pico-w/2 and it has no problem connecting with WPA2/AES, so somewhere in micropython or picozero.py it knows something the tcp_server.c code doesn't know.
Sure be nice to have a working C code example.