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-AM62A-LP does not contain any push button connected to MCU GPIOs.
MCU-R5 example is using MCU_GPIO0_15 pin in the MCU_HEADER(J9) for generating GPIO interrupt. Key presses can be done by connecting followed by disconnecting MCU_GPIO0_15(Pin 10 of J9) to ground (Pin 27 of J9) in the SK-AM62A-LP. Please note that number of key presses will be higher than actual as we are manualy connecting the ground using jumpers.
C75 example is using GPIO1_22 pin in the user expansion connector(J3) for generating GPIO interrupt. For this, the interrupt has to be routed thorugh MAIN_GPIOMUX_INTROUTER0 instance 15. But it is allocated to TISCI_HOST_ID_A53_2 in source/drivers/sciclient/sciclient_default_boardcfg/am62ax/sciclient_defaultBoardcfg_rm.c file as,
{
.num_resource = 16,
.type = TISCI_RESASG_UTYPE (TISCI_DEV_MAIN_GPIOMUX_INTROUTER0, TISCI_RESASG_SUBTYPE_IR_OUTPUT),
.start_resource = 0,
.host_id = TISCI_HOST_ID_A53_2,
},
So replace the above code with the following lines in source/drivers/sciclient/sciclient_default_boardcfg/am62ax/sciclient_defaultBoardcfg_rm.c file. This will allocate the 15th instance of MAIN_GPIOMUX_INTROUTER0 to c75 core.
{
.num_resource = 15,
.type = TISCI_RESASG_UTYPE (TISCI_DEV_MAIN_GPIOMUX_INTROUTER0, TISCI_RESASG_SUBTYPE_IR_OUTPUT),
.start_resource = 0,
.host_id = TISCI_HOST_ID_A53_2,
},
{
.num_resource = 1,
.type = TISCI_RESASG_UTYPE (TISCI_DEV_MAIN_GPIOMUX_INTROUTER0, TISCI_RESASG_SUBTYPE_IR_OUTPUT),
.start_resource = 15,
.host_id = TISCI_HOST_ID_C7X_0_0,
},
Then rebuild the boardconfig and SBL using the steps mentioned in SYSFW Board Config Generation . Key presses can be done by connecting followed by disconnecting GPIO1_22(Pin 15 of J3) to ground (Pin 27 of MCU_HEADER(J9)) in the SK-AM62A-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 and MAIN GPIO interrupt is used by Linux running on A53.
-
A GPIO bank interrupt can be routed to only one core at a time. For example if a gpio interrupt is routed to Linux A53 core, the same cannot be routed to other cores (C75/R5).
-
To run this example, mcu_gpio0, mcu_gpio_intr entries, main_gpio1 and main_gpio_intr has to be removed from /arch/arm64/boot/dts/ti/k3-am62a7-sk.dtsi file of linux kernal 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.
-
A GPIO bank interrupt can be routed to only one core at a time. For example if a gpio interrupt is routed to A53 core, the same cannot be routed to other cores (C75/R5).
Supported Combinations
Parameter | Value |
CPU + OS | mcu-r5fss0-0 nortos |
a53ss0-0 nortos |
Toolchain | ti-arm-clang |
arm.gnu.aarch64-none |
Board | am62ax-sk |
Example folder | examples/drivers/gpio/gpio_input_interrupt/ |
Steps to Run the Example
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!!