How to create a simple TCP/IP connection?

After all the installation, it is the time for showing how to create a simple TCP connection

In general Software protocol, engineers needs to have a fully understanding about TCP/IP protocol to make it functional. This even required using a lot of space and workload for the processor (MCU) to work with this protocol.

WIZnet’s solution had help user to reduce this kind of pain for developing a functional network feature for you.

Users only need to simply understand the process stage of the Chip and collect the data will be fine.

For coding the Raspberry PI PICO, it required only few steps to activate this progress.

  1. Import libraries – wiznet5k and WIZnet’s socket
  2. Activate and set the GPIO pins for SPI communication and reset pin
  3. Set the network settings
  4. Set your PICO into TCP server
  5. TCP Connection and start communicate with your PICO

For more details, please refer the Git-Hub links below.

The provided example code is an Echo TCP example, the coming post will show you how the received sensor data using TCP to communicate.

Links:

  1. WIZnet Ethernet HAT library and examples – https://github.com/Wiznet/RP2040-HAT-CircuitPython
  2. WIZnet offical blog about TCP connection on Ethernet HAT with Raspberry Pi Pico – https://maker.wiznet.io/2021/10/21/wiznet-ethernet-hatrp2040-loopback/
  3. WIZnet networking official samples – RP2040-HAT-CircuitPython/W5x00_Echo_Demo_TCP.py at master · Wiznet/RP2040-HAT-CircuitPython · GitHub
  4. WIZnet HK version samples (include status identification) – https://github.com/ronpang/WIZnet-HK_Ron/blob/main/TCP/TCP%20server.py
  5. How to setup WIZnet Library into Raspberry Pi Pico – https://www.iwiznet.cn/2021/12/13/how-to-install-wiznet-library-into-raspberry-pi-pico/

Used software:

  1. Hercules software: https://www.hw-group.com/software/hercules-setup-utility
  2. Thonny: https://thonny.org/
Step 1: Import Library
Step 2: GPIO setup for SPI and Reset
Step 3: Network Setting
Step 4: Create a TCP server
Step 5: Communication Procedure
Serial Display in Thonny
Received data and return it back to TCP terminal
TCP results