Wiznet makers

Grace_Koo

Published November 22, 2024 ©

0 UCC

5 WCC

0 VAR

0 Contests

0 Followers

0 Following

Exploring TFTP Client Example on W55RP20-EVB-PICO

Running a TFTP Client in C on Visual Studio Code

COMPONENTS Hardware components

WIZnet - W55RP20-EVB-Pico

x 1


PROJECT DESCRIPTION

https://github.com/WIZnet-ioNIC/WIZnet-PICO-C/tree/main/examples/ftp

In this WCC, an example for the TFTP Client is covered. If you're looking for an example for FTP, you can find examples for both the Server and Client here.

 

TFTP (Trivial File Transfer Protocol) and FTP (File Transfer Protocol) are both file transfer protocols, but they have several important differences.

TFTP vs FTP

Complexity:

  • TFTP is a very simple protocol, supporting only file read and write operations.
  • FTP provides rich file management features, including directory navigation, file deletion, and permission management, in addition to file transfer.

Underlying Protocol:

  • TFTP uses UDP, enabling fast transfers but with less reliability.
  • FTP uses TCP, ensuring reliable transfers by setting up a connection and retransmitting data in case of errors.

Security:

  • TFTP lacks security features and does not support authentication or encryption.
  • FTP does not encrypt by default, but secure versions such as FTPS and SFTP provide encryption and authentication.

Use Cases:

  • TFTP is mainly used for small file transfers between network devices, network booting, and firmware updates.
  • FTP is suitable for general file transfers, file sharing between servers and clients, and transferring large files.

Hardware Requirements

  • W55RP20-EVB-PICO
  • Desktop or Laptop
  • USB Type-C Cable

Software Tools

  • Visual Studio Code
  • Serial Terminal : Tera Term
  • TFTP Server : SolarWinds TFTP

Setup board

To run this example, you need to apply the 0002_iolibrary_driver_tftp.patch file as follows:

git apply ./patches/0002_iolibrary_driver_tftp.patch

And need to set up the board in the 'WIZnet-PICO-PING-C/CMakeLists.txt' file.

Activate the 8th line in this file by setting 'set(BOARD_NAME W55RP20_EVB_PICO)'.

WIZnet-PICO-C/CMakeLists.txt

 

If you want to view log messages via USB serial, modify the following file as shown below.

WIZnet-PICO-C\examples\tftp\CMakeLists.txt

Setup Network Info

Set up the desired network information.

WIZnet-PICO-C\examples\tftp\ w5x00_tftp_client.c

The IP address of the server to test and the name of the file to be read should be changed according to your environment at the following location.

WIZnet-PICO-C\examples\tftp\ w5x00_tftp_client.c

If you want to change the port setting for the TFTP server to test in the example, you can modify it as follows.

WIZnet-PICO-C\libraries\ioLibrary_Driver\Internet\TFTP\tftp.h

If the target system does not use a storage device, you need to comment this part in '#define F_STORAGE' in the 'libraries\ioLibrary_Driver\Internet\TFTP\tftp.h' directory. In this example, since the storage is not used, this part has been commented.

WIZnet-PICO-C\libraries\ioLibrary_Driver\Internet\TFTP\tftp.h

Run

The TFTP server used for testing in this example can be found here.

After launching the server, navigate to the File tab in the upper-left corner and select the Configure menu to set the file path that the client will read from.

TFTP server configure

Then, create the file to be read in the configured path.

The following is the example execution screen.

When the read request succeeds.
TFTP Server

The following is the screen when the read request fails.

When the read request fails.

The TFTP read request process, based on the captured Wireshark screen, is as follows.

  1. The server receives the request and sends the first data block to the client.
  2. The client acknowledges the data block by sending an ack packet.
  3. The server then sends the next data block.
  4. The transfer ends when the last data block is smaller than 512 bytes, indicating the end of the file.
Wireshark capture screen during the execution of the TFTP client example.

 

 

Thank you for reading !

Documents
  • WIZnet-PICO-C

Comments Write