A tool to help visualize the state of hardware sockets on WIZnet5k chipsets in CircuitPython using Adafruit's WIZnet5k driver.
Written by Edward Wright (fasteddy516).
Available at https://github.com/fasteddy516/CircuitPython_Wiznet5k_Socket_Visualizer
Socket Visualizer is a CircuitPython script that was created to help test the WIZnet5k driver provided by Adafruit. It creates a simple server that listens for TCP connections and displays a table in the serial console containing hardware socket status information ('reservation' state, status and connected client) as connections are made and broken. When clients connect, the server sends a string indicating which hardware socket the client is connected to. While the client is connected, the server sends out 'heartbeat' strings every 2 seconds.
Below is an example of the Socket Visualizer's output:
You will need the following CircuitPython drivers to run this script:
-
Adafruit_CircuitPython_Wiznet5k
The easiest way to install these drivers on your CircuitPython device is using Adafruit's circup tool.
-
Colors and unicode characters are used in the console output, so be sure to use a terminal application that supports these features.
-
While these aren't exactly dependencies, it should be noted that this tool was developed and tested using CircuitPython 8.2.0 and Adafruit_CircuitPython_Wiznet5k driver version 3.0.0 on a Raspberry Pi Pico attached to a WIZnet Ethernet Hat with a w5100s chipset. Output was verified in the SimplySerial terminal application running in PowerShell on Windows 11.
This tool accesses private variables/properties (
socket._socknum
,socket._status
, andWIZNET5K._sockets_reserved
) which are not part of the official driver API and may be changed in driver versions beyond 3.0.0 which would break this tool.
-
Install the dependencies listed above on your CircuitPython device
-
Copy main.py from this repository to your CircuiytPython device.
If there is already a
code.py
file on your device, you will need to delete or rename it to allowmain.py
to run. -
Make sure the variables in the
CONFIGURATION
section (near the top of the script just after all theimport
statements) are set appropriately for your device/environment. -
Connect to the CircuitPython serial console and restart the script.
-
Use a tool like PuTTy to connect to your CircuitPython device and watch the socket status update in the serial console.