pico-sdk icon indicating copy to clipboard operation
pico-sdk copied to clipboard

Long connect time with Zyxel AP when power saving is on

Open maxnet opened this issue 2 years ago • 9 comments

Even when the mesh setting is disabled, I am continuing to experience that it often (but not always) takes unacceptable long to join the network when using a Zyxel VMG8825-T50 access point. Which is a pretty common router in Europe, as T-mobile (which has millions of customers) provides it to their clients.

Attached wifi capture .pcapng files (done on a laptop with Realtek chipset and wifi set to monitoring mode) of when it connects reasonable well in 4 seconds, and when it takes 10 seconds. Using latest daily micropython build (rp2-pico-w-20220708-unstable-v1.19.1-113-g9af6a275d), but as I believe the problem is not limited to micropython, I am creating an issue here.

screenshot-10second-join

When it takes a long time, you can see that the AP sends an "Association response" like it should, but it seems like the Pico is not taking notice of it, as the Pico does nothing for 3 seconds, and then restarts the joining process from the start with "Probe requests". And also the same problem of the Pico not responding to packets happens a second time with a reassociation response .

When I disable power saving with "wlan.config(pm = 0xa11140)" it does seem to connect reliably in 3-4 seconds. So perhaps make that the default?

pico-wifi-capture.zip

maxnet avatar Jul 09 '22 11:07 maxnet

cc @peterharperuk

kilograham avatar Jul 09 '22 13:07 kilograham

I don't suppose you could tell me how it behaves if you set the PM value to 0xa11142?

peterharperuk avatar Jul 11 '22 10:07 peterharperuk

42 NOT good. 7 seconds to connect.

maxnet avatar Jul 11 '22 11:07 maxnet

Can you try one more? 0x111022

peterharperuk avatar Jul 11 '22 11:07 peterharperuk

@peterharperuk We should get these PM values documented at some point.

aallan avatar Jul 11 '22 11:07 aallan

Can you try one more? 0x111022

0x111022 not good either. "Got wifi, took 7 seconds"

Not sure if I understand the PM values though. Wouldn't that make it to go to power saving even faster, reducing time before it goes to sleep from 200 ms (second last digits 14 hex), to 20 ms (second last digits 02) ?

https://github.com/georgerobotics/cyw43-driver/blob/5614e2750e019b0ffa14a50e3c92045b952e2634/src/cyw43.h#L523

Or am I misunderstanding "pm2_sleep_ret_ms The maximum time to wait before going back to sleep for CYW43_PM2_POWERSAVE_MODE mode" ? Or is the comment wrong and is it the maximum time it can sleep?

maxnet avatar Jul 11 '22 11:07 maxnet

Yes - I think you might be right. I'm not sure we've got CYW43_AGGRESSIVE_PM and CYW43_PERFORMANCE_PM the right way around.

Do you see any difference when using 0xa11c82?

peterharperuk avatar Jul 11 '22 12:07 peterharperuk

Do you see any difference when using 0xa11c82?

Hard to tell if it is any better. Seeing 6 and 7 seconds connection time, mixed with the good 4 seconds (which you do get reliably without power saving, with pm values ending on 0).

Wondering if power saving can be temporarily disabled just during authentication, as I think during that phase messages are not resend when you miss one, while that do may be the case with normal traffic... And the PM options also mention "Wake interval sent to the access point". In case the PM logic is expecting some kind of cooperation on timings and such from the AP, I do not think it is very likely that has been negotiated at the authentication stage yet either....

maxnet avatar Jul 11 '22 12:07 maxnet

Yes. I might send you something to test if that's ok?

peterharperuk avatar Jul 11 '22 13:07 peterharperuk

This got stuck waiting for this change https://github.com/georgerobotics/cyw43-driver/pull/10 We could probably fix it in the sdk by disabling power management until a connection succeeds?

peterharperuk avatar Feb 13 '23 17:02 peterharperuk

what is the current state of this?

kilograham avatar May 26 '23 14:05 kilograham

It's a driver issue https://github.com/georgerobotics/cyw43-driver/pull/10 Not fixed. I guess we could close this.

peterharperuk avatar May 26 '23 15:05 peterharperuk

ha, i guess i should look at my labels!

kilograham avatar May 27 '23 15:05 kilograham

Not an sdk issue. See https://github.com/georgerobotics/cyw43-driver/pull/10

peterharperuk avatar May 21 '24 08:05 peterharperuk