0

Adafruit Feather m4 with featherwing esp32 problem while upd
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Adafruit Feather m4 with featherwing esp32 problem while upd

by Racoon14 on Sat Sep 18, 2021 4:38 pm

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 | TOGGLE FULL SIZE
### 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



Racoon14
 
Posts: 1
Joined: Sat Sep 18, 2021 4:33 pm

Please be positive and constructive with your questions and comments.