Link Search Menu Expand Document

Getting Started Extended Application on PIC32MK MCM Curiosity Pro Development Board

Download


Description

This application demonstrates an LED toggle (LED1 toggles when the switch SW1 is pressed and LED3 toggles when switch SW3 is pressed) on a timeout basis and prints the LED toggling rate on the serial terminal. The periodicity of the timeout will change from 500 milliseconds to one second, two seconds, four seconds, and back to 500 milliseconds every time you press the switch SW1 or SW3 on the PIC32MK MCM Curiosity Pro Development Board. The periodicity will not change while switching between SW1 to SW3 or vice versa.

The demo application has extended functionality to print the current room temperature periodically when the MikroBus socket is plugged with MikroElectronika Weather Click Board.

Modules/Technology Used:

  • Peripheral Modules
    • SPI
    • Timer
    • Core Timer
    • GPIO
    • UART
    • DMA

Hardware Used:

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/pic32mk_mcm_curiosity_pro

  • Refer the Release Notes to know the MPLAB X IDE and MCC Plugin version. Alternatively, Click Here.
  • Any Serial Terminal application like Tera Term terminal application.

Because Microchip regularly update tools, occasionally issue(s) could be discovered while using the newer versions of the tools. If the project doesn’t 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

Hardware Setup 1:

  • Connect the Type-A male to Micro-B USB cable to the Micro-B USB to UART port (J400) on the PIC32MK MCM Curiosity Pro Development Board for logs
  • Connect the Type-A male to Micro-B USB cable to Micro-B USB DEBUG port (J500) to power and debug the PIC32MK MCM Curiosity Pro Development Board

Hardware Modification:

  • The MikroElectronika Weather click board supports both I²C and SPI protocols to communicate with the BME280 temperature sensor. It provides jumpers (resistors) to choose a communication interface between I²C and SPI. By default, I²C is selected as the communication interface. The PIC32MK MCM Curiosity Pro Development Board does not have I²C lines routed to the MikroBus socket; therefore, SPI is chosen as the communication interface to communicate with the temperature sensor. The hardware modification on the MikroElectronika Weather click board is shown in the figure below.

Hardware Setup 2:

  • Connect the Type-A male to Micro-B USB cable to the Micro-B USB to UART port (J400) on the PIC32MK MCM Curiosity Pro Development Board for logs
  • Connect the Type-A male to Micro-B USB cable to Micro-B USB DEBUG port (J500) to power and debug the PIC32MK MCM Curiosity Pro Development Board
  • To test the extended functionality, connect the MikroElectronika Weather click board to the MikroBus socket (J300) on the PIC32MK MCM Curiosity Pro Development Board. Ensure the above hardware modification before connecting the Weather click board

Programming hex file:

The pre-built hex file can be programmed by following the below steps

Steps to program the hex file

  • 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, Step 1 - Create Prebuilt Project, click the “Browse” button to select the prebuilt hex file.
  • Select Device has “PIC32MK1024MCM100”
  • Ensure the proper tool is selected under “Hardware Tool”
  • Click on “Next” button
  • In the “Import Image File” window, Step 2 - Select Project Name and Folder, select appropriate project name and folder
  • Click on “Finish” button
  • In MPLAB X IDE, click on “Make and Program Device” Button. The device gets programmed in sometime.
  • Follow the steps in “Running the Demo” section below

Programming/Debugging Application Project:

  • Open the project (pic32mk_mcm_curiosity_getting_started_ext/firmware/pic32mk_mcm_curiosity_pro.X) in MPLAB X IDE
  • Ensure “Curiosity/Starter Kits (PKOB4)” 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:

  • Perform Hardware Setup 1 steps mentioned above, if not done already.
  • Open the Tera Term terminal application on your PC (from the Windows® Start menu by pressing the Start button).
  • Set the baud rate to 115200.
  • Reset or power cycle the device. LED1 toggles for every 500 milliseconds during power cycle.
  • An LED (LED1) on the PIC32MK MCM Curiosity Pro Development Board toggles on every timeout basis and the default periodicity of the timeout is 500 milliseconds.
  • And also, the LED toggling rate is displayed on the serial terminal.
  • Press the switch SW1 on the PIC32MK MCM Curiosity Pro Development Board to change the periodicity of the timeout to one second.
  • Every subsequent pressing of the switch SW1 on the PIC32MK MCM Curiosity Pro Development Board changes the periodicity of the timeout to 2 seconds, 4 seconds, 500 milliseconds, and back to 1 second in cyclic order.
  • Press the switch SW3 on the PIC32MK MCM Curiosity Pro Development Board to switch the toggling LED from LED1 to LED3.
  • Every subsequent pressing of the switch SW3 on the PIC32MK MCM Curiosity Pro Development Board changes the periodicity of the timeout to 2 seconds, 4 seconds, 500 milliseconds, and back to 1 second in cyclic order.
  • Press the switch SW1 on the PIC32MK MCM Curiosity Pro Development Board to switch back the toggling LED from LED3 to LED1.
  • See the following figure for the output.

  • To Test the Extended functionality using MikroElectronika Weather Click Board:
    • First perform the Hardware Modification shown above, if not done already.
    • Then perform Hardware Setup 2 steps mentioned above, if not done already.
    • Reset or power cycle the device. LED1 toggles for every 500 milliseconds during power cycle.
    • The switch SW2 is used to switch between the printing of LED toggling rate or the temperature.
    • Press the switch SW2 on the PIC32MK MCM Curiosity Pro Development Board to read and print the Temperature from the MikroElectronika Weather click board.
    • The temperature read is displayed on a serial console on a periodical basis.
    • Press the switch SW1 (toggles LED1) on the PIC32MK MCM Curiosity Pro Development Board to change the periodicity of the temperature values displayed on the serial console. The periodicity will be changed between 500 milliseconds, one second, two seconds, four seconds, and back to 500 milliseconds every time the user presses the switch SW1 on the PIC32MK MCM Curiosity Pro Development Board.
    • Press the switch SW3 (toggles LED3) on the PIC32MK MCM Curiosity Pro Development Board to change the periodicity of the temperature values displayed on the serial console. The periodicity will be changed between 500 milliseconds, one second, two seconds, four seconds, and back to 500 milliseconds every time the user presses the switch SW3 on the PIC32MK MCM Curiosity Pro Development Board.
    • Finally, Press the switch SW2 on the PIC32MK MCM Curiosity Pro Development Board to switch back to print the LED toggling rate.
    • See the following figure for the output.
  • Note:
    • The periodicity will not change while switching between SW1 to SW3 or vice versa.

Comments:

Revision:

  • v1.6.0 - Regenerated and tested the application.
  • v1.5.0 - Released demo application


Copyright © 2020 Microchip Technology.