Adafruit Feather m4 with featherwing esp32 problem while upd

For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Racoon14
 
Posts: 1
Joined: Sat Sep 18, 2021 4:33 pm

Adafruit Feather m4 with featherwing esp32 problem while upd

Post by Racoon14 »

I lifted a feather with a esp32 co processor. The esp is connected via spi and I create a socket with this library "adafruit_esp32spi.adafruit_esp32spi_socket". Normally I receive minimum 200 packages, but at some point, it stops working. With socket.recv(1500) I read out the buffer, but it is always empty. The m4 is still running and there is no spi fault. Did you guys have similar problems?

If it matters: I am receiving 25fps in a art-net protcol to control a led matrix

I shorted the code, but the problem stays...

Code: Select all

### configuration ###
TIMEOUT = 5  # time out socket
HOST = "192.168.4.1"  # listing for this host
PORT = 1030  # listing on this port from the host

### imports ###
import time
import board
from digitalio import DigitalInOut
from adafruit_esp32spi import adafruit_esp32spi
import adafruit_esp32spi.adafruit_esp32spi_socket as socket
import udp_decoder
import neopixel


# Get wifi details and more from a secrets.py file
# adafruit standard
try:
    from secrets import secrets
except ImportError:
    print("WiFi secrets are kept in secrets.py, please add them there!")
    raise


### wired pins ###
# to esp32
spi = board.SPI()
esp32_cs = DigitalInOut(board.D13)
esp32_ready = DigitalInOut(board.D11)
esp32_reset = DigitalInOut(board.D12)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)


connected = 0
while not connected:
    try:
        # connect to wifi AP (RPI)
        esp.connect(secrets)
        print(connected)
        connected = 1
    except:
        print("Tryng to connect again")

print("My IP address is", esp.pretty_ip(esp.ip_address))
# test for connectivity to server
print("Server ping:", esp.ping(HOST), "ms")


# create the socket
socket.set_interface(esp)
socketaddr = socket.getaddrinfo(HOST, PORT)[0][4]
s = socket.socket(type=socket.SOCK_DGRAM)
s.settimeout(TIMEOUT)

s.connect(socketaddr, conntype=esp.UDP_MODE)


ii = 0

while 1:
    print("looping")#see if still alive
    # amount = s.available() # also not vorking

    amount = s.recv(1500)
    if amount:
        # here would be my code
        print(ii)
        ii += 1
        time.sleep(0.0025) #estimated time for neopixel control of my matrix



User avatar
tcweller
 
Posts: 12
Joined: Mon Oct 26, 2020 10:45 am

Re: Adafruit Feather m4 with featherwing esp32 problem while

Post by tcweller »

I had a similar problem. You can view my post here:

viewtopic.php?f=53&t=171694

I never found a solution with the WifiNina library. But moving to the WINC1500 an the Wifi101 library fixed the problem. My understanding is that there is a bug somewhere in the UDP implementation that dies after a seemingly random number of UDP packets are received. If someone else knows a fix for this -- on ESP32 hardware, I'd love to hear it!

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

Return to “Wireless: WiFi and Bluetooth”