Arm® TrustZone® Technology Getting Started Application on PIC32CM LS60: Step 3

Last modified by Microchip on 2024/06/26 12:46

 

Configure the User Button 0 and User Button 1 with the Secure External Interrupt Controller (EIC) to Generate an Interrupt.
In this step, the switch button will be configured as per the SW0 and SW1 shown in the PIC32CM LS60 Curiosity Pro Evaluation Kit schematic. See Figure 1.

USER BUTTON 0: SW0 is configured to change the LED Sampling rate.

USER BUTTON 1: SW1 is configured to toggle between the display of LED Sampling rate and Temperature sampling rate, and vice-versa.

PIC32CM LS60 Curiosity Pro Evaluation Kit schematic

Figure 1

In MPLAB® Code Configurator (MCC), select the Pin Settings tab and then scroll down and configure the pins as follows:

  • Enable EIC_EXTINT12 on PC20 (Pin #60) as Secure mode.
  • Enable EIC_EXTINT4 on PC28 (Pin #86) as Secure mode.
EIC pin configuration

Figure 2

Note: Internal pull-up is enabled to avoid false edge detection as there is no external pull-up on the PIC32CM LS60 Curiosity Pro Evaluation Kit.

Select the Project Graph tab.

Under the Device Resources tab, expand Harmony > Peripherals > EIC.

Select and double-click on EIC to add the EIC module to the project.
 

Resource Management tab

Figure 3

 

Configure the EIC block to generate an interrupt every time the user presses the switch SW0 and switch SW1. Switch SW0 press changes the periodicity of the LED toggling rate or the Temperature sampling rate. Switch SW1 press toggles from Basic Functionality to Extended Functionality and vice-versa. Enable filter functionality to avoid electrical noise on the switch pin as shown in the following image.

Configuration Options pane

Figure 4

Back to Top


Configure LED Pin in Secure Mode.

In this step, the user LED0 and user LED1 will be configured as shown in the PIC32CM LS60 Curiosity Pro Evaluation Kit schematic. See Figure 5.

User LED0: LED0 is configured to notify either the periodicity of the LED toggling rate or the periodicity of the temperature sampling rate as per Switch SW0 press.

User LED1: LED1 is configured to notify whether the last five temperatures are fetched from EEPROM and displayed on the terminal.

User LED Schematic

Figure 5

In MCC, select the Pin Settings tab and then scroll down and configure the following:

  • Enable GPIO on PC19 (Pin #59) as Secure mode and add a Custom Name as "LED0".
  • Enable GPIO on PC27 (Pin #85) as Non-Secure mode and add a Custom Name as "LED1".

Both of the pins are configured as an output pin for LED functionality. See Figure 6.

LED Pin configuration

Figure 6

Note:

  • The LED0 and LED1 on the PIC32CM LS60 Curiosity Pro Evaluation Kit is active low. Configure the LEDs in the default OFF state by configuring the latch value to logic High.
  • As per the application project design, the User LED0 must be configured in Secure mode, and by default, this pin is configured as a Secure mode pin by MCC.
  • As per the application project design, the User LED1 must be configured in Non-Secure mode, and by default, this pin is configured as a Secure mode pin by MCC.

Back to Top