← index #16290Issue #16305
Related · high · value 2.209
QUERY · ISSUE

[regression] WiFi stops working on with pico W

openby GM-Script-Writer-62850opened 2024-11-23updated 2025-03-03
bugport-rp2

Port, board and/or hardware

picow

MicroPython version

v1.24.0 (2024-10-25)

Reproduction

Connect to wifi and suddenly start getting connection aborted errors (103) when making outbound request

When this happens isconnected() returns true, my ubiquity logs shows the device is still connected and i am not able to load the diagnostic data over http and the pico does not see the connection attempt

Expected behaviour

Wifi works indefinitely

Observed behaviour

wifi stops working within 6 hours of uptime (could take less than 5 minutes)

  • Note that my AP and Pico W are less than 30cm apart

Additional Information

v1.23.0 (2024-06-02) .uf2 - no issues, it just works
v1.24.0 (2024-10-25) .uf2 - why is this not working

Archive.zip - my simple script
The PICO just sits around waiting for input to report to my server and periodically reports sensor data to my server

Related discussion: https://github.com/orgs/micropython/discussions/16288 - may have useful notes

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

Pico W urequests POST requests fail on firmware version 1.24 but work on 1.22.1

closedby fadiiiiiiiiiiopened 2024-11-26updated 2024-11-26
bug

Port, board and/or hardware

Raspberry Pi Pico W

MicroPython version

Working Firmware Version: sysname='rp2', nodename='rp2', release='1.22.1', version='v1.22.1

Non-Working Firmware Version:sysname='rp2', nodename='rp2', release='1.24.0', version='v1.24.0

Description:
The urequests.post() function fails when sending HTTPS POST requests on MicroPython firmware version 1.24. The issue does not occur on firmware version 1.22.1, where the same code executes without errors.

The error returned is:

Failed to send data: <!DOCTYPE html>
<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 400 (Bad Request)!!1</title>
...

Steps to Reproduce:

Steps to Reproduce:

  1. Install firmware version 1.24 on the Raspberry Pi Pico W.
  2. Run the following MicroPython script:

import network
import urequests

Wi-Fi credentials

SSID = 'your_wifi_ssid'
PASSWORD = 'your_wifi_password'

Google Apps Script URL

GOOGLE_SHEET_URL = "https://script.google.com/macros/s/YOUR_DEPLOYMENT_ID/exec"

JSON payload

data = {
"timestamp": "11/25/2024 09:47:38",
"sensor_1_depth": "72.39",
"sensor_2_depth": "70.53"
}

Connect to Wi-Fi

def connect_to_wifi():
wlan = network.WLAN(network.STA_IF)
wlan.active(True)
wlan.connect(SSID, PASSWORD)
while not wlan.isconnected():
pass
print("Connected to Wi-Fi:", wlan.ifconfig())

Send data to Google Apps Script

def send_data():
headers = {"Content-Type": "application/json"}
try:
response = urequests.post(GOOGLE_SHEET_URL, json=data, headers=headers)
print("Response code:", response.status_code)
print("Response content:", response.text)
except Exception as e:
print("Request failed:", e)

Main script

connect_to_wifi()
send_data()

Expected behavior

The Google Apps Script receives and processes the data successfully, returning an HTTP 200 response.

Observed behavior

The urequests.post() function fails with an HTTP 400 Bad Request error on firmware version 1.24.
Failed to send data: <!DOCTYPE html>

<html lang=en>
<meta charset=utf-8>
<meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
<title>Error 400 (Bad Request)!!1</title>
...

Troubleshooting Steps Taken:

  1. Tested the code on firmware 1.22.1, where it worked flawlessly.
  2. Upgraded to firmware 1.24, where the error consistently occurred.
  3. Tested the same code with a GET request to https://www.google.com:
  4. This also failed on firmware 1.24, suggesting an issue with HTTPS handling.
  5. Swapped Pico W boards and reproduced the issue on multiple devices running firmware 1.24.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied