MPLAB® Harmony v3 Peripheral Libraries on PIC32CM GV-VL (Arm® Cortex®-M0+) MCUs: Step 2
Configure RTC Peripheral Library
Click on the Device Resources tab on the left side of the MCC. In Device Resources, expand Libraries > Harmony > Peripherals > RTC.
Double-click or drag and drop RTC to add the RTC Peripheral Library (PLIB) to the project graph.
Open the Clock Configurator.
In the Clock Easy View, navigate to the 32 KHz Oscillators Controller and select the two checkboxes for the 32K High Accuracy Internal Oscillator. Go to GCLK Generator X, select the checkbox next to GCLK Generator X, and select OSC32K as the clock source for GCLK2. Ensure that the clock source for GCLK2 is set to 32.768 KHz.
Go to Peripheral Clock Selection and click on Peripheral Clock Configuration to open the Peripheral Clock Configuration dialog box, and select GCLK2 for RTC.
Click on the RTC in the Project Graph. In the Configuration Options, configure the RTC PLIB to generate a compare interrupt every 500 milliseconds.
Configure SERCOM 2 (USART) Peripheral Library, STDIO Extensions, and USART Pins
Under the Device Resources tab, expand Libraries > Harmony > Peripheral > SERCOM. Double-click on SERCOM2 to add the SERCOM instance 2 to the project.
Right-click the Yellow UART diamond icon in SERCOM2 and select STDIO from the Available Consumers to configure the USART. This setup enables functions like printf() to transmit data to the terminal, allowing the LED's periodic toggling rate to be displayed on the console.
Select the SERCOM2 Peripheral Library in the Project Graph and verify that the default SERCOM Operation Mode configuration is set as USART. Configure it as shown in the accompanying image. Verify the default baud rate is set to 115200 Hz.
Open the Pin Configuration tabs by clicking MCC > Project Graph > Plugins > Pin Configuration.
Select the MCC Pin Settings tab and sort the entries by Ports, as shown in the accompanying image.
Now, select the pin that is used for USART transmit.
- Enable USART_TX (SERCOM2_PAD0) on PA12 (Pin #29).
- Enable USART_RX (SERCOM2_PAD1) on PA13 (Pin #30).