Step 8: Build and Run the Application
Note: It is not required to adjust the Baud rate as you are using a USB connection.
Remove the SD card from the IO1 Xplained Pro board.
Press the switch SW1 again. That will stop the log.
Safely remove the SD card media from the Host machine.
Insert the SD card into the microSD slot of the IO1 Xplained Pro board.
Reset the PIC32 WFI32E Curiosity Board using the MLCR button.
Press the switch SW1 to start the log.
Note: You can find the solution of the Lab 3 in the folder: <your unzipped folder path>\getting_started_pic32_wfi32e\Lab3\solution.
You should be able to verify the temperature logs were successfully recorded into the SD card.
In this lab, you have successfully enhanced the application to run in an RTOS environment. The new application writes the temperature sensor values along with current system time to a file on the SD card using the File System interface. The SDSPI Driver with the SPI2 Peripheral Library was used to perform operations on the SD card. The RTC Peripheral Library was used to get the current system time. The File System service was used to write the current system time along with temperature sensor values received from the Sensor Task to a file created on the SD card using the SDSPI Driver.
Three RTOS Threads were created:
- I2C sensor application reads the temperature value, notifies the SD card Thread using the SD card message queue, and goes to sleep for 1 second.
- SD card application is waiting to receive data in the SD card queue. Once the queue is filled, the application logs the temperature value to a file.
- USB application handles the messages to print on the USB console with the help of another message queue.
In the next lab, you will add an HTTP Web Server to visualize data.
In this lab, you have successfully developed a full-fledged MPLAB Harmony application. This gives you a fair idea of how MPLAB Harmony helps application development. If you need FreeRTOS support for any of your existing applications, this lab can be used as a reference. This can also be a starting point for your IoT applications.