MicroPython does spend some time garbage collecting but not too much, usually tens of milliseconds, a lot less than the seconds of lag I have been seeing. I also don't think it is a garbage collection issue as my test regime is fairly consistent so should always see lag if it were.Garbage collected language slowing down over time is a classical symptom of a heap leak. I haven't reviewed your code so I don't want to assume but that's where I'd start looking.
All my code has a 'wlan.config(pm=0xA11140)' which I believe disables power saving modes, ensures maximum responsiveness.So it could be a power saving behavior.
I became aware of the lack of adding that in a previous adventure - viewtopic.php?t=365691 - where ping times varied without that. The latency was however just a 100 ms or so, not the many tens of seconds of lag I have experienced.
I still remain convinced it's an issue with CYW43 drivers or LwIP, that something gets out of sync and it struggles to get it back in sync.
I don't think it's necessarily what is being done in my own adventures which borks it but perhaps some other traffic on the network which does, making it a somewhat random issue. Or maybe it's even a router bug, has the problems I am accusing the Pico W of having.
Turning packet tracing on and not seeing that show the packets as they should have been suggests something isn't right. Even if it is simply a case of incorrect coding the trace reports it suggests the possibility of errors elsewhere.
Unfortunately CYW43 drivers, LwIP, MicroPython networking and sockets, are still black boxes to me. I've only tinkered on the edges, don't understand most of how it works, how the parts interact with each other. Without an insight into what is happening under the hood it is like it being impossible to know why mail normally arrives the day after posting but can sometimes be a week late.
Statistics: Posted by hippy — Sat Jul 27, 2024 6:04 pm