Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers/atwinc15x0: disconnect when sleeping #17889

Merged
merged 3 commits into from
May 18, 2022

Conversation

benpicco
Copy link
Contributor

@benpicco benpicco commented Mar 30, 2022

Contribution description

Don't try to re-connect when the interface is in SLEEP state.
Also disconnect before entering sleep.

Testing procedure

This prevents an issue where the devices sleep state would get out of sync with the requested sleep state. The device would try to re-connect even though it should be asleep.

Issues/PRs references

follow-up to #17854

@github-actions github-actions bot added the Area: drivers Area: Device drivers label Mar 30, 2022
@benpicco benpicco added the Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) label Mar 30, 2022
@benpicco benpicco requested a review from gschorcht March 30, 2022 17:10
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 30, 2022
@benpicco benpicco force-pushed the drivers/atwinc15x0-fix_sleep branch from e909eda to 85b739b Compare March 31, 2022 14:50
@benpicco benpicco removed the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Mar 31, 2022
@benpicco benpicco requested a review from aabadie March 31, 2022 14:53
@benpicco benpicco added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 1, 2022
@benpicco benpicco requested review from fjmolinas and dylad April 24, 2022 20:09
@benpicco benpicco added this to the Release 2022.07 milestone May 3, 2022
@benpicco benpicco requested a review from kfessel May 10, 2022 08:28
Copy link
Contributor

@kfessel kfessel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes seem reasonable,

even though I cloudn't find another netdev initiating a disconnect when switching to SLEEP or STANDBY (most devices are less infrastructure driven than wifi)

test is missing

benpicco added 3 commits May 12, 2022 00:29
Don't try to re-connect when the interface is in SLEEP state.
Also disconnect before entering sleep.
@benpicco benpicco force-pushed the drivers/atwinc15x0-fix_sleep branch from 7be9ccf to 37159fe Compare May 11, 2022 22:29
@benpicco
Copy link
Contributor Author

master, WiFi does not go to sleep

2022-05-18 12:06:07,043 - INFO # RIOT network stack example application
2022-05-18 12:06:07,046 - INFO # All up, running the shell now
2022-05-18 12:06:08,009 - INFO # > [atwinc15x0] WiFi connected
ps
2022-05-18 12:06:20,900 - INFO # ps
2022-05-18 12:06:20,900 - INFO # 
2022-05-18 12:06:20,908 - INFO # 	pid | name                 | state    Q | pri | stack  ( used) ( free) | base addr  | current     
2022-05-18 12:06:20,917 - INFO # 	  - | isr_stack            | -        - |   - |    512 (  256) (  256) | 0x20000000 | 0x200001c8
2022-05-18 12:06:20,926 - INFO # 	  1 | main                 | running  Q |   7 |   1536 (  684) (  852) | 0x20000938 | 0x20000d04 
2022-05-18 12:06:20,934 - INFO # 	  2 | pktdump              | bl rx    _ |   6 |   1536 (  240) ( 1296) | 0x20003a14 | 0x20003f24 
2022-05-18 12:06:20,943 - INFO # 	  3 | ipv6                 | bl rx    _ |   4 |   1024 (  456) (  568) | 0x20001054 | 0x200012ac 
2022-05-18 12:06:20,952 - INFO # 	  4 | udp                  | bl rx    _ |   5 |   1024 (  256) (  768) | 0x20004664 | 0x20004964 
2022-05-18 12:06:20,960 - INFO # 	  5 | atwinc15x0           | bl anyfl _ |   2 |   1024 (  812) (  212) | 0x200018c4 | 0x20001b84 
2022-05-18 12:06:20,969 - INFO # 	  6 | sam0_eth             | bl anyfl _ |   2 |   1024 (  480) (  544) | 0x20001df8 | 0x200020bc 
2022-05-18 12:06:20,975 - INFO # 	    | SUM                  |            |     |   7680 ( 3184) ( 4496)
ifconfig 5 set state sleep
2022-05-18 12:06:28,971 - INFO # > ifconfig 5 set state sleep
2022-05-18 12:06:28,971 - INFO # 
2022-05-18 12:06:28,978 - INFO # success: set state of interface 5 to SLEEP
 # not sleeping
2022-05-18 12:07:02,143 - INFO # > # not sleeping

with this patch the WiFi goes to sleep and stays asleep

2022-05-18 12:07:30,374 - INFO # main(): This is RIOT! (Version: 2022.04-devel-1053-g37159-drivers/atwinc15x0-fix_sleep)
2022-05-18 12:07:30,377 - INFO # RIOT network stack example application
2022-05-18 12:07:30,380 - INFO # All up, running the shell now
 # not sleeping2022-05-18 12:07:32,341 - INFO # > [atwinc15x0] WiFi connected
ifconfig 5 set state sleep
2022-05-18 12:07:35,084 - INFO # ifconfig 5 set state sleep
2022-05-18 12:07:35,084 - INFO # 
2022-05-18 12:07:35,091 - INFO # success: set state of interface 5 to SLEEP
2022-05-18 12:07:35,109 - INFO # > [atwinc15x0] WiFi disconnected
# WiFi is sleeping
2022-05-18 12:09:16,344 - INFO # > ifconfig 5 set state idle
2022-05-18 12:09:16,345 - INFO # 
2022-05-18 12:09:16,351 - INFO # success: set state of interface 5 to IDLE
2022-05-18 12:09:17,642 - INFO # > [atwinc15x0] WiFi connected

@benpicco benpicco merged commit 5fd88e1 into RIOT-OS:master May 18, 2022
@benpicco benpicco deleted the drivers/atwinc15x0-fix_sleep branch May 18, 2022 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants