WizNet5k Module Usage Help/Advice

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
seanfcarney
 
Posts: 20
Joined: Sun Mar 06, 2022 9:05 pm

WizNet5k Module Usage Help/Advice

Post by seanfcarney »

Equipment: Adafruit RP2040 Feather + Ethernet Featherwing AND Raspberry Pi400
Circuit Python Version: 8.0.0 Alpha-1

TLDR: I am trying to use the Adafruit Feather + Featherwing to collect sensor data and broadcast it via UDP to my Pi400. Both devices will be static IP and on same LAN subnet (not broadcasting over WAN). I am looking for some general tips / process on how to accomplish this.

I will include my code below. This is on the RP2040 side.

I am confused on how to implement this. My intention was to open a UDP socket on the RP2040 side. Then the rp2040 would send out its data to IP:Port#. The Pi400 will then wait for data in the recieve buffer - read it in and then process it.

Can anyone provide a link to something similar I can review? I have never done this network programming before so I am sort of lost in the sauce :) .

Code: Select all

import board
import time
import busio
import digitalio
import adafruit_mpu6050 as mpu6050
from adafruit_wiznet5k.adafruit_wiznet5k import WIZNET5K
import adafruit_wiznet5k.adafruit_wiznet5k_socket as socket

print("Beginning of script.")

# Chip Select for Adafruit Ethernet FeatherWing SPI connection 
cs = digitalio.DigitalInOut(board.D10)

# Enable SPI bus
spi_bus = busio.SPI(board.SCK, MOSI=board.MOSI, MISO=board.MISO)

# Setup your network configuration below
IP_ADDRESS = (192, 168, 10,    20)
SUBNET_MASK = (255, 255, 0, 0)
GATEWAY_ADDRESS = (192, 168, 0, 1)
DNS_SERVER = (8, 8, 8, 8)

# Initialize ethernet interface
eth = WIZNET5K(spi_bus, cs, is_dhcp=False)

# Set network configuration
eth.ifconfig = (IP_ADDRESS, SUBNET_MASK, GATEWAY_ADDRESS, DNS_SERVER)

print("Chip Version:", eth.chip)
print("MAC Address:", [hex(i) for i in eth.mac_address])
print("My IP address is:", eth.pretty_ip(eth.ip_address))
print("Sockets available:", eth.max_sockets)

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

Return to “Adafruit CircuitPython”