AnsweredAssumed Answered

i.mx8mq M4 GPIO interrupt setting

Question asked by 家齊 林 on Dec 31, 2019
Latest reply on Feb 18, 2020 by 家齊 林

將GPIO2_PIN20設為Input,也有將中斷開啟,可以讀到輸入腳位接收到的狀態,但是進不了中斷,不清楚那邊有設錯或是沒有設定到。

void GPIO2_Combined_16_31_IRQHandler()
{
  PRINTF("\r\n Interrupt\r\n");
}

/*!
 * @brief Main function
 */
int main(void)
{
    gpio_pin_config_t led_config = {kGPIO_DigitalInput, 1, kGPIO_IntRisingEdge};
    BOARD_RdcInit();

    BOARD_InitPins();
    BOARD_BootClockRUN();
    BOARD_InitDebugConsole();
    BOARD_InitMemory();
    PRINTF("\r\n GPIO Driver example\r\n");
    PRINTF("\r\n The LED is blinking.\r\n");
    GPIO_PinInit(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, &led_config);
    GPIO_PinSetInterruptConfig(EXAMPLE_LED_GPIO, EXAMPLE_LED_GPIO_PIN, kGPIO_IntRisingEdge);
    GPIO_PortEnableInterrupts(EXAMPLE_LED_GPIO, 1u << EXAMPLE_LED_GPIO_PIN);

    while(1);

}

Outcomes