Objective and Overview

MPLAB Harmony v3 is now configurable through MPLAB Code Configurator (MCC). Although the instructions in this tutorial are for the MHC, the flow and experience of creating a project, configuring peripherals, and generating code using MCC are similar. Refer to the links below for specific instructions to use MPLAB Harmony v3 with MCC.

 Objective

MPLAB Harmony v3 is a flexible, fully integrated embedded software development framework for 32-bit microcontrollers (MCUs) and microprocessors (MPUs).

MPLAB Harmony v3 includes the MPLAB Harmony Configurator (MHC) tool, a set of modular peripheral libraries, drivers, system services, middleware, and numerous example applications, all of which are designed to help you quickly and easily develop powerful and efficient embedded software for Microchip’s 32-bit PIC® and SAM devices.

This tutorial shows you how to use MHC to create a simple Webserver Application and will help you get started on developing Wi-Fi®-based applications for a PIC32 WFI32E MCU using the MPLAB Harmony v3 software framework.

Figure 1 is a screenshot of this training module application's output:

sta_logview.png
Figure 1: Temperature log output

The training module application makes use of the PIC32 WFI32E Curiosity Board and the I/O1 Xplained Pro Extension Kit (sold separately).

This application reads the current room temperature from the AT30TSE758A temperature sensor chip on the I/O1 Xplained Pro every second using I²C. Further, it also writes and logs these temperature values into an SD card using a File System. The final application uses an RTOS to serve and run the applications as separate RTOS threads. The output is made available through the PIC32 WFI32E Curiosity Board's USB Power port by configuring it as a USB CDC class device. Through a Wi-Fi connection, the application exposes an HTTP web server to interact with the board and visualize the data over a graph.

The application you create will utilize the following Harmony v3 components:

  • I²C Driver (I2C1) to fetch the temperature on the AT30TSE758A.
  • Timer System Service (Core Timer) to periodically sample temperature sensor data every second.
  • Debug System Service and Console System Service using CDC Function Driver of the USB Device Stack (FS USB) for printing the temperature over a serial terminal.
  • Asynchronous SDSPI Driver (SPI2) to write temperature log to an SD card.
  • File System Service interfaced with SDSPI Driver to perform file operations on the SD card.
  • RTC Peripheral Library (RTCC) to capture temperature log time.
  • FreeRTOS
  • Wi-Fi System Service and Wi-Fi Provisioning Service which include PIC32MZW1 Drivers, TCP/IP Stack, Netconfig, Crypto Library, BA414E, wolfSSL Library, and the requested dependencies
  • HTTP NET module (from the TCP/IP Stack) to parse the web page directly and process the commands through custom_http_net_app.c

The name of the peripheral used by a driver or library (as per the device datasheet) is mentioned in brackets for reference.

Two Ways to Use This Tutorial

  1. Create the project from scratch:
    • Use the provided source files and follow the step-by-step instructions provided below.
  2. Use the attached project as an example:
    • Build the attached project and program the PIC32 WFI32E Curiosity Board to observe the output.

Lab Objectives

  1. Create an MPLAB X IDE Harmony v3 project for a PIC32 WFI32E microcontroller from scratch.
  2. Use MHC to configure and generate code for the Harmony TIME System Service.
  3. Use MHC to configure and generate code for the Harmony I²C Driver and USB Device Stack Middleware (CDC Function Driver).
  4. Use MHC to configure and generate Harmony Peripheral Libraries for SPI and RTC.
  5. Use the Harmony Driver, System Service, Middleware, and Peripheral Library APIs to implement the application.

 Materials

Hardware Tools

Tool About Purchase
board-50px.png
PIC32 WFI32E Curiosity Board
Evaluation Kit
io1-xpro-extension-50px.png
I/O1 Xplained Pro
Extension Kit
ICD4-50px.png
MPLAB® ICD 4
In-Circuit Debugger
AC164110-50px.png
AC164110
RJ-11 to ICSP Adapter

For programming or debugging, the ICD4 connects to the host PC through the ICSP connector (J206) on the PIC32 WFI32E Curiosity Board.

Hardware Connection Setup

lab1_step11_01.png
Figure 2: Hardware Setup

Apart from the hardware tools listed above, the following cables are required:

  • One USB Type-A male to Micro-B male cable to power the board and exchange data over the USB CDC serial port.
  • I/O1 Xplained Pro is connected to the PIC32 WFI32E Curiosity Board using the XPRO Header (J203).
  • The serial terminal over the USB CDC interface is accessed via the TARGET USB Port.
  • The external debugger/programmer is connected over the ICSP connector (J206).

Hardware Configuration

lab1_hardware_connection.png
Figure 3: Hardware Configuration
  • Make sure the J202 jumper is connected to VBUS
  • Make sure J301 jumpers are open (Pins 1-2 open, Pins 3-4 open)

Software Tools

This project has been verified to work with the following versions of software tools:
MPLAB X IDE v5.50 and MPLAB XC32 Compiler v3.01

Because we regularly update our tools, occasionally you may discover an issue while using the newer versions. If you suspect that to be the case, we recommend that you double-check and use the same versions that the project was tested with.

Tool About Installers
Installation
Instructions
Windows Linux Mac OSX
MPLAB® X
Integrated Development Environment
MPLAB® XC32
C/C++ Compiler
For this lab, download the following packages using Harmony Content Manager:
Package Name Version Used Description
bsp v3.9.0 Board Support Package: Includes templates and configuration data for supported development boards.
CMSIS-FreeRTOS v10.3.1 FreeRTOS.
core v3.9.2 Includes Drivers and Services with simple to use abstractions of peripherals and shared resources.
crypto v3.7.3 Includes Cryptographic Module Library.
csp v3.9.1 Chip Support Package: Includes the Peripheral Libraries (PLIBs).
dev_packs v3.9.0 Describes all peripherals, memory, etc. of supported 32-bit devices.
mhc v3.8.0 Contains the current implementation of the MHC tool.
net v3.7.2 Network Library: Includes Drivers, Network presentation layer and TCP/IP stack.
usb v3.8.0 Includes USB Middleware and Drivers.
wireless_wifi v3.5.1 Wi-Fi Library: Includes the Drivers.
wireless_system_pic32mzw1_wfi32e01 v3.5.1 Wireless System Services for PIC32MZW1 and WFI32E01.
wolfssl v4.7.0 TLS/SSL Library implementation.

Overview

This lab shows you how to create an MPLAB X Harmony v3 project from scratch and configure/generate code for the following:

  • Harmony v3 Peripheral Libraries for RTCC, I²C, and SPI.
  • Harmony v3 Driver for I²C.
  • Harmony v3 SD Card Driver for SPI.
  • Harmony v3 USB Full-Speed Driver and USB Device Stack Middleware (CDC Function Driver).
  • Harmony v3 TIME System Service.
  • Harmony v3 File System Service.
  • Harmony v3 Core Service and FreeRTOS.
  • Harmony v3 TCP IP Stack.
  • Harmony v3 PIC32MZW1 Driver.
  • Harmony v3 Wi-Fi System Services.

Lab Source Files and Solutions

This ZIP archive contains the completed project for this lab. It also contains the source files needed to perform the lab step-by-step as per the section "Procedure" on this page.

You are free to extract the contents of the archive to any directory of your choice. See the notes below.

Note:

  1. The project location of a Harmony v3 project is independent of the location of the Harmony Framework path (i.e., you do not need to create or place a Harmony v3 project in a relative path under the Harmony v3 framework folder). The project can be created or placed in any directory of your choice. As a good practice, reduce as much as possible the path length.
  2. The MHC generates all of the required source files, header files, and libraries (if any) under your project folder.
  3. This is unlike older Harmony v2 projects that are required to be created in a location under the Harmony framework.


Extracting the ZIP archive creates the following folders:

  • getting_started_pic32_wfi32e contains the lab solution in the solution folder and source files in the dev_files folder.
    • dev_files contains the application source files and other support files (if any) required to perform the lab.
    • solution contains the completed lab solution project. You can directly build this project and program the hardware to observe the output.

Procedure

All steps must be completed before you will be ready to build, program, and run the application.

Lab Index

Lab 1: Create the Application

Lab 2: Log Data to SDCARD

Lab 3: Move Application into an RTOS

Lab 4: Add HTTP Web Server to Visualize Data

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.