3.11.5 File Transfer Protocol Application on SAM E70 Xplained Ultra Evaluation Kit
Description
This application demonstrates creating ethernet bootloader where an FTP client downloads a binary file from the FTP server, which in turn is used to program the microcontroller. The FAT-FS File System with SDCARD as storage media is used in the application and the FTP client will write to and read from this FS.
Modules/Technology Used
- Peripheral Modules:
- USART1
- Timer (TC0)
- HSMCI
- System Services:
- DEBUG
- Command
- File System
- Time
- Console
- Middleware libraries:
- TCP/IP Stack
Hardware Used
- SAM E70 Xplained Ultra Evaluation Kit
- LAN8740 PHY daughter board
Note: The link above points to LAN8720A PHY Daughter Board.
The user can procure the PIC32MZ Embedded Connectivity with FPU (EF) Starter Kit and remove the LAN8740 PHY Daughter board on it and use it for this demo.
Software/Tools Used
This project has been verified to work with the following versions of software tools:
Refer Project Manifest present in harmony-manifest-success.yml under the project folder firmware/src/config/default.
- Refer the Release Notes to know the MPLAB X IDE and MCC Plugin version.
- Any Serial Terminal application, such as Tera Term terminal application.
Because Microchip regularly updates tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project does not seem to work and version incompatibility is suspected. It is recommended to double-check and use the same versions that the project was tested with. To download original version of MPLAB Harmony v3 packages, refer to document How to Use the MPLAB Harmony v3 Project Manifest Feature (DS90003305).
Setup
- Ensure the ERASE (J400) jumper is Open on SAM E70 Xplained Ultra Evaluation Kit.
- Open the J805 Jumper which on the
ETHERNET PHY MODULE.
- Insert the LAN8740 PHY daughter board on the ETHERNET PHY MODULE header.
- Connect the micro USB cable from the computer to the DEBUG USB connector on the SAM E70 Xplained Ultra Evaluation Kit.
- Establish a connection between the router/switch with the SAM E70 Xplained Ultra Evaluation Kit through the RJ45 connector.
- Copy test.bin from ftp_bootloader/utilities to microSD.
- Insert the microSD card into the
microSD card slot on the backside of the hardware board.
- Go to Ethernet Settings.
- Make below settings
Programming Hex File
The pre-built hex file can be programmed by following the below steps.
- Open MPLAB X IDE
- Close all existing projects in IDE, if any project is opened.
- Go to File -> Import -> Hex/ELF File.
- In the Import Image File
window,
- Create Prebuilt Project,
- Click the Browse button to select the prebuilt hex file.
- Select Device as ATSAME70Q21B.
- Ensure the proper tool is selected under Hardware Tool and click on Next button.
- Select Project Name and Folder,
- Select appropriate project name and folder and click on Finish button
- Create Prebuilt Project,
- In MPLAB X IDE, click on Make and Program Device button to program the device.
- Follow the steps in Running the Demo section below.
Programming/Debugging Application Project
- Open the project (ftp_bootloader\firmware\sam_e70_xult.X) in MPLAB X IDE
- Ensure SAM E70 Xplained Ultra is selected as hardware tool to program/debug the application
- Build the code and program the device by clicking on the Make and Program Device button in MPLAB X IDE tool bar
- Follow the steps in Running the Demo section below
Running the Demo
- Before running the FTP client application, an FTP server should be setup. For this demonstration, the FileZilla Server Interface is used as the FTP server running on the user PC. Refer to https://wiki.filezilla-project.org/Documentation for more information on this.
- FileZilla Server setup:
- Open the FileZilla server interface.
- In the pop-up window, enter a hostname, port and password for admin interface. Click Connect.
- Click on User icon User or go to Edit->User for adding client.
- In the User window, click
General. Add client by clicking Add option enable account and
password. This will be the username and password for connecting from the FTP
client.
- In Shared folders, add the path
of folder where the binary to be downloaded is located.
- From a terminal window application (such as Tera Term), connect to the COM port enumerated by SAM E70 Xplained Ultra board.
- Restart the application (i.e reset the SAM E70 Xplained Ultra board).
- The IP address will be displayed on
the terminal once it is ready. User can connect to the FTP server:
- Type ftpc connect
- Upon successful connection, enter the
login details:
- Type ftpc login
- Once logged in, use ftpc get command
to download a binary from the server:
- Type ftpc get -a -a <test.bin>
- After the binary is successfully downloaded it can be flashed to the MCU by using the boot command.
- MCU is reset automatically after the programming is complete and application code starts executing. Displaying the message: **** Executing Application code ****.
Output
- After MCU reset, the following message
gets printed:
Comments
- Reference Application Note: File Transfer Protocol using MPLAB Harmony v3 TCP/IP Stack (DS00003475).
- Getting Started Training Module: Getting Started with Harmony v3 Peripheral Libraries on SAM E70 MCUs.
- This application demo builds and
works out of box by following the instructions above in "Running the Demo" section. If
the user needs to enhance/customize this application demo, the user needs to use the
MPLAB Harmony v3 Software framework. Refer links below to setup and build the
applications using MPLAB Harmony.
- How to Setup MPLAB Harmony v3 Software Development Framework (DS90003232)
- How to Build an Application by Adding a New PLIB, Driver, or Middleware to an Existing MPLAB Harmony v3 Project (DS90003253)
- Video - How to Set up the Tools Required to Get Started with MPLAB® Harmony v3 and MCC
- Create a new MPLAB Harmony v3 project using MCC
- Update and Configure an Existing MHC-based MPLAB Harmony v3 Project to MCC-based Project