GPIO Input Interrupt

Introduction

This example configures a GPIO pin in input mode and configures it to generate interrupt on rising edge. The application waits for 5 key presses, prints the number of times the keys are pressed and exits.

SK-AM62P-LP does not contain any push button connected to MCU GPIOs. This example is using MCU_GPIO0_15 pin in the MCU_HEADER(J11) for generating GPIO interrupt. Key presses can be done by connecting followed by disconnecting MCU_GPIO0_15(Pin 10 of J11) to ground (Pin 27 of J11) in the SK-AM62P-LP. Please note that number of key presses will be higher than actual as we are manualy connecting the ground using jumpers.

Attention

MCU GPIO interrupt is used by Linux running on A53. To run this example, mcu_gpio0 and mcu_gpio_intr entries to be removed from /arch/arm64/boot/dts/ti/k3-am62p-mcu.dtsi file of linux kernel source. A new linux image to be generated with this change and SoC initialization to done following SOC Initialization Using SPL . Without this change in the linux image, this example will not work.

Supported Combinations

Parameter

Value

CPU + OS

mcu-r5fss0-0 nortos

CPU + OS

wkup-r5fss0-0 freertos

Toolchain

ti-arm-clang

Board

am62px-sk

Example folder

examples/drivers/gpio/gpio_input_interrupt/

Steps to Run the Example

  • When using CCS projects to build, import the CCS project for the required combination and build it using the CCS project menu (see Using SDK with CCS Projects).

  • When using makefiles to build, note the required combination and build using make command (see Using SDK with Makefiles)

Attention

As the wake-up R5 is the device manager, it needs to be started by the SBL. So it can not be loaded through CCS. It should be flashed and booted through SBL.

See Also

GPIO

Sample Output

Shown below is a sample output when the application is run,

GPIO Input Interrupt Test Started ...
GPIO Interrupt Configured for Rising Edge ...
Press pushbutton SW5 to trigger a GPIO interrupt
Key is pressed 0 times
Key is pressed 0 times
Key is pressed 0 times
Key is pressed 1 times
Key is pressed 2 times
Key is pressed 3 times
Key is pressed 3 times
Key is pressed 4 times
Key is pressed 5 times
GPIO Input Interrupt Test Passed!!
All tests have passed!!