This is an exercise to turn LED on and off from remote site using TCP protocol. The PC runs as a TCP Client and the WIZwiki board runs as a TCP Server. User can learn how to control the component (LED) connected to WIZwiki board using the TOE (TCP/IP Offload Engine) of W7500.
- USB cable
- LAN cable
- Hub switch (Router with DHCP function)
No special circuit.
Connect the PC and the router (with DHCP function) with LAN cable. Connect the router and the WIZwiki board with LAN cable. Connect the PC and the WIZwiki board with USB cable.
- Terminal program
- EX) Teraterm, Hercules, Hyperterminal, etc.
- It is for serial port message checking
- Refer to the next link for the serial port example
- TCP/IP Client Server terminal program
- EX) Hercules, etc.
- It is for transmitting message using the TCP/IP Client Server terminal
Use the example code in the page below. 🌎https://developer.mbed.org/teams/WIZnet/code/TCP_LED_Control-WIZwiki-W7500/
Execute serial terminal in PC. First press the Reset button of WIZwiki board and check messages. User can see that Server IP Address (ex: 192.168.0.8) is assigned by DHCP function.
Execute Hercules program in PC. Select TCP Client menu and configure the IP and Port. If user types the target Server IP Address (ex: 192.168.0.8) and clicks the Ping button, this image will be shown.
The output message made by TCP server is shown in Terterm. User can know the Client (PC) is connected to Server (WIZwiki board). (ex: Connection from: 192.168.0.6)
Now let's control the LED on the WIZwiki board. When the TCP Client of the PC sends "LED_ON" message to the WIZwiki board (TCP Server), then the LED turns on. Click the "Send" button on the red part in the figure below.
If the LED_ON message is parsed (translated) at the TCP Server side, then LED turns on. Check the LED light on the blue circle turns on.
Besides the LED turn on, the other message is shown The TCP Client sends message to WIZwiki board (TCP Server), then WIZwiki board sends reversed message to TCP Client. Check the message returned back from Server on Teraterm in the figure below.
If "Any messsage"(ex: TEST) except the "LED_ON" message to the WIZwiki board (TCP Server), then the LED turns off.
Besides the LED turn off, the other message is shown The TCP Client sends message to WIZwiki board (TCP Server), then WIZwiki board sends reversed message to TCP Client. Check the message returned back from Server on Teraterm in the figure below.
Check the LED light on the blue circle turns off.
The WIZnet team page in the ARM mbed provides mbed libraries and examples for WIZnet products.
There are mbed libraries below which are used for Hardware TCP/IP chip (W5500) and WIZnet TCP/IP Offload Engine (W7500).