3.5.4.2 Secure IoT Gateway Application Client on PIC32CM LS60 Curiosity Pro Evaluation Kit
Description
This project demonstrates the good-client side implementation of the secure IoT gateway application.
The PIC32CM LS60 Client reads the sensor data from the temperature and light sensors on the I/O1 Xplained Pro board connected to the EXT2 Xpro connector. The client waits for the host to initiate the authentication process. Once the authentication is completed successfully, the sensor data is sent to the host through the USART. The MAC calculation and SERCOM transmission are placed securely in the secure region of the PIC32CM LS60.
Modules/Technology Used
- Peripheral Modules
- Non-Secure SERCOM0 (SPI)
- Non-Secure SERCOM3 (SPI)
- Non-Secure SERCOM1 (I2C-ATECC608)
- Non-Secure SERCOM5 (I2C-IO1 Xplained Pro)
- Secure SERCOM2 (USART)
- Non-Secure TC0
- Non-Secure DMAC
- Non-Secure RTC
- Non-Secure ADC
- NVMCTRL
- EVSYS
- Systick
- EIC
- GPIO
- PM
- TC1
- Harmony Core
- Drivers
- SPI
- WINC
- LE SPI 4-line
- Crypto
- ATECC608
- System Services
- Time
- Input
- Graphics
- GFX Core Legato
Hardware Used
Software/Tools Used
This project has been verified to work with the following versions of software tools:
- For LS60 Client, refer Manifest for Secure and NonSecure projects present in harmony-manifest-success.yml under the project folder firmware/pic32cm_ls60_cpro_sg_client/{Secure or NonSecure}/firmware/src/config/pic32cm_ls60.
- Refer the Release Notes to know the MPLAB X IDE and MCC Plugin version.
- Any Serial Terminal application such as Tera Term terminal application.
- Trust Platform Design Suite v2.3.5 or above Click Here.
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).
Hardware Setup
- Connect the MIKROE OLED C Click to the mikroBUS extension in the PIC32CM LS60 Curiosity Pro Evaluation Kit.
- Connect the I/O1 Xplained Pro Extension Kit to the EXT2 in the PIC32CM LS60 Curiosity Pro Evaluation Kit.
- Connect the jumper wires from PA22/PA23 for SERCCOM UART RX/TX to communicate with the host.
- Connect the PIC32CM LS60 Curiosity Pro Evaluation Kit to the Host PC as a USB Device through a Type-A male to micro-B USB cable connected to Micro-B USB (Debug USB) port.

Demo Setup
For complete Secure IoT Gateway application demo setup, refer to demo readme inside the project directory (pic32cm_ls60_secure_iot_gateway).
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 PIC32CM5164LS60100.
- 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 (pic32cm_ls60_secure_iot_gateway/firmware/pic32cm_ls60_cpro_sg_client) in MPLAB X IDE.
- Open both Secure and NonSecure projects inside the project group and set the NonSecure as the main project.
- Ensure PIC32CM LS60 Curiosity Pro is selected as hardware tool to program/debug the application.
- Build the code and program the device by clicking on the Make and Program button in MPLAB X IDE tool bar.
- Follow the steps in Running the Demo section below.
- Windows OS has a maximum path length of 260 characters and a command-line limitation for Windows OS of 8191 characters. For details, see Path, File and Folder Name Restrictions section in MPLAB® X IDE User’s Guide.
- The TrustZone based project come with long path name, hence the project build may fail due to exceeding Windows maximum path length.
- Workaround: Move the project folder to C:/ drive to reduce the project path length then open in MPLAB X IDE to build the project.
Running the Demo
- Once the device is programmed, the I/O1 Xplained Pro Extension Kit sensor values will be read and displayed in the MIKROE OLED C Click display board.
- The client will wait for the random number from the host side. The MAC digest will be sent to the host.
- Once authentication success is acknowledged, the sensor values will be sent through the USART.
- Successful authentication is ensured if the Host device gets the values displayed in the MIKROE OLED C Click.



Comments
- PIC32CM LS00/LS60 Security Reference Guide (DS00003992).
- 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, should 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