1.2 Adding and Configuring the MPLAB Harmony Components
To add and configure the MPLAB Harmony components using MCC, follow these steps:
- In the MCC window, in the Plugins drop-down list (highlighted green in the above Figure 1.5), select the required Configuration Window.
- Select Clock Configuration in the drop-down list to open the Clock Easy View window and verify that the Main Clock is set to 48 MHz.
- Under the Device Resources, select Peripherals > SERCOM > SERCOM3 and observe that the SERCOM3 Peripheral Library block is added in the Project Graph Window.
- In the left pane, select SERCOM3
Peripheral Library in the Project Graph, and in the Configuration Options
right pane, configure it as follows to print the LED toggling rate on the Serial
Console.
- For Receive Pinout, from the
drop-down list, select SERCOM PAD[1] and leave the remaining parameters with
the default setting as shown in the figure below.
Figure 1-6. MPLAB Code Configurator – SERCOM3 Configuration Window
- For Receive Pinout, from the
drop-down list, select SERCOM PAD[1] and leave the remaining parameters with
the default setting as shown in the figure below.
- Configure DMA Channel 0 to transmit
application buffer to the USART TX register. The DMA transfers one byte from the
user buffer to USART transmit buffer on each trigger.
Figure 1-7. DMA Configuration - From the Device Resources add RTC
Peripheral Library to generate a compare interrupt every 500 milliseconds.
Figure 1-8. RTC PLIB Configuration - Add EIC PLIB from Device
Resources and configure EIC as secure pins.
Figure 1-9. Enable EIC Channel 12 -
Expand Enable EIC Channel 12, and configure by selecting the options as shown below.
Figure 1-10. MPLAB Code Configurator – EIC PLIB Configuration - Open the Trust Zone
Configuration window from the Plugins drop-down list and check Memory
Configuration for Secure and Non-Secure regions of the application.
Figure 1-11. Arm Trust Zone Memory Configuration Window Note: The markers can be used to configure the memory if there are any changes needed in memory configuration. It is recommended not to change the default configuration for this application. - Open Peripheral Configuration
and select the SERCOM3 and DMAC boxes as Non-Secure peripherals. Upon
selection the box color will change from green to orange.
Figure 1-12. SERCOM3 and DMAC Peripheral Configuration Note: SERCOM3 and DMA peripheral libraries are configured as Non-Secure, these libraries obtain the LED toggling rate from the Secure application through NSCs (Non-Secure Callable) APIs to print the LED toggling rate on a Serial Console running on a PC. - Open the Pin Configuration Window
from the Plugins drop-down list and configure the required pins as shown below:
Figure 1-13. SERCOM3 Pin Configuration Figure 1-14. Switch and LED Pin Configuration