Skip to content

Conversation

peterharperuk
Copy link
Collaborator

@peterharperuk peterharperuk commented Jul 12, 2022

cyw43_wifi_join queries the PM value and saves it, before clearing the PM mode. This is then restored when the connection has completed with success or failure.

@peterharperuk
Copy link
Collaborator Author

Note: This has a dependency on #8

@peterharperuk peterharperuk linked an issue Jul 14, 2022 that may be closed by this pull request
@peterharperuk peterharperuk requested a review from dpgeorge July 14, 2022 17:20
@peterharperuk peterharperuk requested a review from kilograham July 14, 2022 17:20
@dpgeorge
Copy link

Is this the right way to solve the problem? Is there any precedence for this in the Broadcom/Cypress/Infineon driver?

I'm concerned that by disabling PM during join, it won't send the AP the correct DTIM values and the sleep mode won't work correctly when PM is enabled (after joining). Did you test that power saving still works with this patch?

@peterharperuk
Copy link
Collaborator Author

IIs there any precedence for this in the Broadcom/Cypress/Infineon driver?

I don't think there's a precedent, but I'm not sure the Infineon example will be very well tested.

Did you test that power saving still works with this patch?

No - I just checked that the pm2_sleep_ret value was restored. I'll have to have a think about how to check if power management is affected.

@dpgeorge
Copy link

No - I just checked that the pm2_sleep_ret value was restored. I'll have to have a think about how to check if power management is affected.

The way have done this in the past is to attach a current/power measuring device to the target board and set the DTIM high (eg 5, or even 9) and monitored the power usage over time when it's connected to the AP. You need a relatively quiet WiFi network to see it go into low power mode.

@peterharperuk peterharperuk force-pushed the disable_pm_for_join branch 5 times, most recently from ef28a70 to acc810a Compare July 21, 2022 14:30
@peterharperuk
Copy link
Collaborator Author

Apologies - I got confused a few times and pushed the wrong version. It should be correct now. I've done some testing. Disabling power management makes a big difference of around 8-10mA. I tried messing around with dtim and do see a small difference if I use a large value for dtim - maybe 0.5mA. As far as I can tell the power values are as expected after the pm is restored after a join so the change looks ok as far as I can tell.

@kilograham
Copy link
Collaborator

I have a slight concern based on WiFi actually being down for a period, and that running batteries down.

I think maybe at least this should be optional (many don't have problems joining WiFi), and maybe should be periodically applied

@peterharperuk
Copy link
Collaborator Author

The caller can set the pm value themselves to disable power management already. It would be useful if they had the function to query the value if we expected them to do that.

@dpgeorge
Copy link

I have a slight concern based on WiFi actually being down for a period, and that running batteries down.

I think maybe at least this should be optional (many don't have problems joining WiFi), and maybe should be periodically applied

This is a good point.

Maybe an alternative solution to disabling PM during join is to just increase the pm2_sleep_ret value? Eg to it's maximum of 2000ms. That would keep the 4343 awake for longer between periods of inactivity and might be all that is needed to successfully join the APs that are giving trouble.

Do we know which APs have trouble when PM is enabled? If I can source one of these APs then I could test the fix.

@peterharperuk
Copy link
Collaborator Author

Original report is here raspberrypi/pico-sdk#912
So that's Zyxel VMG8825-T50

I believe I asked Floris (Maxnet) to test with 2000ms and it didn't seem to improve things.

@dpgeorge
Copy link

So that's Zyxel VMG8825-T50

It doesn't look like I can easily obtain one of those.

I believe I asked Floris (Maxnet) to test with 2000ms and it didn't seem to improve things.

OK... Looking at some WICED examples, they do disable PM briefly during DHCP. Also PM is not enabled until after connecting to WiFi, it seems.

@peterharperuk
Copy link
Collaborator Author

Shall I close this as "not going to fix"? No one's moaned at me about it recently, so it can't be that important. Power management can be disabled by the caller if required.

Had a few reports that joining wifi can be very slow. Disabling power
management seems to fix the problem. The PM mode is cleared when a join
is started and restored when complete on success or failure.

Fixes georgerobotics#9
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.

Disable power management while joining wifi

3 participants