Content-Length: 314009 | pFad | http://github.com/micropython/micropython/issues/17621

7D GitHub · Where software is built
Skip to content

Raspberry Pico W: Hangs after WLAN deinit() #17621

@SmokeyBrandie

Description

@SmokeyBrandie

Port, board and/or hardware

pico w

MicroPython version

MicroPython v1.25.0 on 2025-04-15; Raspberry Pi Pico W with RP2040

Reproduction

import network
import time
from time import sleep
import urequests
import gc

WLAN_SSID = 'MYSSID'
WLAN_PASSWORD = '123'

wlan = network.WLAN(network.STA_IF)

counter = 1
while True:
    print('Start round {}'.format(counter))

    wlan.active(True)
    wlan.connect(WLAN_SSID, WLAN_PASSWORD)

    for i in range(20):
        if wlan.isconnected():
            break
        print('Trying to connect... Status is: ', wlan.status())
        time.sleep(1)

    if wlan.isconnected():
        response = urequests.get('https://www.google.com')
        response.close()

    print('Deactivate WLAN...')
    print('Memory alloc {}'.format(gc.mem_alloc()))
    print('Memory free {}'.format(gc.mem_free()))

    wlan.disconnect()
    wlan.active(False)
    wlan.deinit()

    print('Sleeping...')
    time.sleep(5)
    counter += 1

Expected behaviour

Should not hang

Observed behaviour

This script works approx. 10-30 times and then it suddenly hangs. It seems to be the
deinit() function which causes the freeze.

I tested several pico w hardware, but same problem.

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions









      ApplySandwichStrip

      pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


      --- a PPN by Garber Painting Akron. With Image Size Reduction included!

      Fetched URL: http://github.com/micropython/micropython/issues/17621

      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy