Getting Started Training Module Using MCC: Step 3

Last modified by Microchip on 2023/11/10 12:39

Configure Switch Button Pin with External Interrupt Controller (EIC)

SAM E51 Curiosity Nano Evaluation Kit switch documentation

The switch button will be configured as per the design schematic of the SAM E51 Curiosity Nano Evaluation Kit.

Select the Pin Settings tab of MPLAB® Code Configurator (MCC) and then scroll down to the Pin Number 32 and configure the PORT pin PA15 as an external interrupt pin for switch functionality. The internal pull-up is enabled to avoid false edge detection as there is no external pull-up on the SAM E51 Curiosity Nano Evaluation Kit.

MCC pin settings EIC

MCC add EIC

Select the Project Graph tab.

Under the left side tab, Resource Management (MCC), go to Device Resources and expand Libraries > Harmony > Peripherals > EIC. Click on the green plus symbol green plus beside the EIC to add the EIC module to the project graph.

MCC EIC configuration
Configure the EIC block to generate an interrupt every time the user presses the switch SW0 and enable debounce functionality to avoid debouncing on the switch pin.
Configure LED Pin

The user LED will be configured as per the design schematic of the SAM E51 Curiosity Nano Evaluation Kit.

SAM E51 Curiosity Nano Evaluation Kit LED documentation

Select the MCC Pin Settings tab and scroll down to the Pin Number 31. Configure the PORT pin PA14 as an output pin for LED functionality.

MCC LED configuration

Note: The LED on the SAM E51 Curiosity Nano Evaluation Kit is active low. Configure the LED in default OFF state by configuring the latch value to logic High.

Rename the Default Main File

Rename main file name

Under the Project Graph tab, click on System, and give a name of your liking to the default template main file generated by MCC.

Note: The name of the default main.c is changed to main_sam_e51_cnano.c to indicate that the referred main.c is for the SAM E51 CNano getting started training module.