---
title: "Exploring TFTP Client Example on W55RP20-EVB-PICO"
url: "https://maker.wiznet.io/Grace_Koo/projects/exploring-tftp-client-example-on-w55rp20-evb-pico/"
markdown_url: "https://maker.wiznet.io/Grace_Koo/projects/exploring-tftp-client-example-on-w55rp20-evb-pico/md"
type: "WCC: WIZnet Created Content"
author: "Grace"
author_url: "https://maker.wiznet.io/Grace_Koo/"
original_author: "Grace Koo"
published: "2024-11-22"
language: "en"
tags: ["C/C++", "W55RP20"]
hardware: ["WIZnet W55RP20-EVB-Pico"]
likes: 0
views: 1317
comments: 0
source: "WIZnet Makers (https://maker.wiznet.io/)"
---

# Exploring TFTP Client Example on W55RP20-EVB-PICO

> Running a TFTP Client in C on Visual Studio Code

Original author: Grace Koo

## Components

- **WIZnet W55RP20-EVB-Pico** x 1 ([docs](https://wiznet.io/products/powered-by-raspberry-pi/w55rp20-evb-pico))

## Documents and links

- [WIZnet-PICO-C](https://github.com/WIZnet-ioNIC/WIZnet-PICO-C.git) (code)

## Article

> <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](https://github.com/WIZnet-ioNIC/WIZnet-PICO-C/tree/main/examples/ftp).

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:

```plaintext
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)'.

![](https://maker.wiznet.io/upload/ckeditor5/469704619%5F1727275748.png)

*WIZnet-PICO-C/CMakeLists.txt*

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

![](https://maker.wiznet.io/upload/ckeditor5/468771093%5F1731493428.png)

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

#### Setup Network Info

Set up the desired network information.

![](https://maker.wiznet.io/upload/ckeditor5/468771093%5F1731490778.png)

*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.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732283106%2Epng)

*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.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732281617%2Epng)

*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.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732275126%2Epng)

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

#### Run

The TFTP server used for testing in this example can be found [here](https://www.solarwinds.com/free-tools/free-tftp-server).

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.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732286774%2Epng)

*TFTP server configure*

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

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732285007%2Epng)

The following is the example execution screen.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732284753%5F2%2EPNG)

*When the read request succeeds.*

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732284753%2EPNG)

*TFTP Server*

The following is the screen when the read request fails.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732284753%5F3%2EPNG)

*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.

![](https://maker.wiznet.io/upload/ckeditor5/962122213%5F1732285154%2Epng)

*Wireshark capture screen during the execution of the TFTP client example.*

*Thank you for reading !*

---

Source: https://maker.wiznet.io/Grace_Koo/projects/exploring-tftp-client-example-on-w55rp20-evb-pico/
