MatrixPortal Wifi GET requests extremely unreliable

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
lmurdock12
 
Posts: 4
Joined: Tue Jun 21, 2022 1:34 am

MatrixPortal Wifi GET requests extremely unreliable

Post by lmurdock12 »

Hi everyone,

I am trying to utilize my new MatrixPortal M4 using the SAMD chip to make some GET requests and then do useful things with that data.

Currently I am having a lot of trouble being able to consistently make successful requests.

I am seeing the following error constantly:

Code: Select all

  File "code.py", line 28, in <module>
  File "adafruit_portalbase/network.py", line 505, in fetch
  File "adafruit_requests.py", line 864, in get
  File "adafruit_requests.py", line 710, in request
  File "adafruit_requests.py", line 563, in _get_socket
RuntimeError: Sending request failed
I am using the adafruit_matrixportal.network library to manage my connections, but I am wondering if there is a better more reliable approach.

Here is the test code I am using:

Code: Select all

import board

from src.NetworkManager import NetworkManager
from src.ota_updater import OTAUpdater
from adafruit_matrixportal.network import Network
# Get wifi details and more from a secrets.py file

from secrets import secrets

print("Currently stored secrets:",secrets)

net = Network(status_neopixel=board.NEOPIXEL)
net.connect()
print(net._wifi.is_connected)

TEXT_URL = "http://wifitest.adafruit.com/testwifi/index.html"

JSON_GET_URL = "https://api.github.com/repos/adafruit/Adafruit_CircuitPython_MatrixPortal/releases/latest"

res = net.fetch(TEXT_URL)
print(res)
res.close()


res = net.fetch(JSON_GET_URL)
print(res)


res = net.fetch(TEXT_URL)
print(res)


res = net.fetch(JSON_GET_URL)
print(res)

res = net.fetch(TEXT_URL)
print(res)


res = net.fetch(JSON_GET_URL)
print(res)


res = net.fetch(TEXT_URL)
print(res)
Example output:

Code: Select all

Retrieving data...<Response object at 0x20004480>
Retrieving data...<Response object at 0x20004490>
Retrieving data...<Response object at 0x20004730>
Retrieving data...Traceback (most recent call last):
  File "code.py", line 37, in <module>
  File "adafruit_portalbase/network.py", line 505, in fetch
  File "adafruit_requests.py", line 864, in get
  File "adafruit_requests.py", line 710, in request
  File "adafruit_requests.py", line 563, in _get_socket
RuntimeError: Sending request failed
Is there anything that can be done to fix this?

Currently running Circuitpython Adafruit CircuitPython 7.2.5 (EDIT: Also tested with 7.3.1 with no improvement)

User avatar
lmurdock12
 
Posts: 4
Joined: Tue Jun 21, 2022 1:34 am

Re: MatrixPortal Wifi GET requests extremely unreliable

Post by lmurdock12 »

Update:

Running esp32 firmware version 1.7.4.

I have also tried using the 4A powersupply from Adafruit and still ran into the same issues.

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: MatrixPortal Wifi GET requests extremely unreliable

Post by danhalbert »

We have made some improvements to the adafruit_requests and adafruit_esp32spi libraries, which -may- improve things. Try the latest versions of these libraries, but install them in CIRCUITPY instead of in CIRCUITPY/lib, so that they override the frozen modules. The frozen modules will be updated in 7.3.2.

User avatar
danhalbert
 
Posts: 4649
Joined: Tue Aug 08, 2017 12:37 pm

Re: MatrixPortal Wifi GET requests extremely unreliable

Post by danhalbert »

CircuitPython 7.3.2 is now released.

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”