I agree with the majority of this. It very well may be something to do with my router. But I doubt that it is just my router. I have dozens of devices connected to my router, and none of them have this particular problem.My thinking would be, that if it keeps working when there is activity every 5 minutes, when there isn't activity for 5 minutes, it could be the Pico W wireless going into some sort of low power mode which then causes it not to behave as expected.Not sure why the testing priority is about power modes. ejschwar has already said the connection is stable if there is activity every 5 min.
My suggestion is to disable power saving to avoid the Pico W doing that, should it be the actual problem. Turning power saving off resolved some issues I had experienced with wireless.
The problem is we are dealing with a black box system so it's hard to tell what is going wrong, whether the issue is with the Pico W side of things, the router side of things, or some combination. The only thing we can do is try different things to see if those have any affect on an issue, reveal any problems or don't, try to replicate issues people are having.
This is not easy to solve so all information, 'works for me' included, is useful to have. What we need are rigorous tests to try and identify what's happening and not happening when things go wrong so I'd put power mode testing under that.
One problem I see is we don't have a robust framework which handles connection, loss of connection, reconnection, well. It's not clear to me what happens if the Pico W is waiting for a network connection and the Wi-Fi goes down for whatever reason. It feels to me that could easily create a classic deadlock situation; the Pico W waiting for a connection which will never come because the W-Fi is down, it not progressing beyond that, not allowing loss of network to be detected, recovery to be made.
If it does turn out that pinging the router every so often prevents the issue arising then how does one do that if the code is stuck waiting in an 'accept' or similar ?
It may need changes to be made to how 'accept' works, or some different approach other than using 'accept'.
That different approach has to be used anyway if running multiple servers, say an HTTP server and an MQTT server, maybe more. And when I have tried that I have sometimes run into issues, things not happening how I would have expected. It mostly works but I haven't had time nor the will to properly investigate when it doesn't.
My verdict is "networking can be flaky under MicroPython" but I am not sure where the problems lie, with MicroPython, LwIP, the CYW43 drivers, or what. I experienced problems when using a wired WIZnet-W5500-EVB-Pico so I believe there is more to it than just wireless and wireless router issues.
It could be that the OP's issue isn't actually a Wi-Fi or router issue.
I view networking like threading on the RP2; it may work, you may be able to find some way such that it appears to work or works for longer when it doesn't. But such bodging isn't resolving whatever underlying issues there may be, is just stepping round those, and that house of cards could come crashing down at any time.
Apart from putting time and effort into discovering what's actually happening, understanding why, I'm not sure what the resolution will be.
Keeping routers from causing problems if they don't think a device is active is something I see as a layer on top of that.
I'd like to discover what is actually happening and why. I know that I can just add a periodic ping to avoid the problem, but that's not really my style.
Statistics: Posted by ejschwar — Thu Dec 26, 2024 4:34 pm