i.MX93 Flexio gpio interrupt issue.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

i.MX93 Flexio gpio interrupt issue.

195 Views
NZP
Contributor III

Hello experts,

I am working on i.mx93 cortex-m33 flexio, I am able to read HIGH/LOW status of pin, but when I configure my flexio pin interrupt on rising edge, and as soon as rising edge occurs cortex-m33 mcu just stuck up, so requesting to look into my problem.

/*
 * Copyright 2022 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "pin_mux.h"
#include "clock_config.h"
#include "board.h"
#include "fsl_debug_console.h"
#include "fsl_flexio.h"

#include "fsl_iomuxc.h"
/*******************************************************************************
 * Definitions
 ******************************************************************************/
#define BOARD_LED_FLEXIO     FLEXIO1
#define BOARD_LED_FLEXIO_PIN 24U

volatile int x = 0;

void FLEXIO1_IRQHandler(void)
{
    x++;
    SDK_ISR_EXIT_BARRIER;
}

int main(void)
{
    /* Define the init structure for the output LED pin*/
    flexio_gpio_config_t led_config = {
        kFLEXIO_DigitalInput,
        0U,
        kFLEXIO_InputInterruptEnable | kFLEXIO_FlagRisingEdgeEnable,
        // kFLEXIO_InputInterruptDisabled,
    };
    flexio_config_t fxioUserConfig;
    /* Board pin, clock, debug console init */
    /* clang-format off */
    const clock_root_config_t flexioClkCfg = {
        .clockOff = false,
	.mux = 0, /* 24MHz oscillator source */
	.div = 1
    };
    /* clang-format on */

    BOARD_InitBootPins();
    BOARD_BootClockRUN();
    BOARD_InitDebugConsole();

    CLOCK_SetRootClock(kCLOCK_Root_Flexio1, &flexioClkCfg);

    /* Print a note to terminal. */
    PRINTF("\r\n 4. FLEXIO PIN Driver example\r\n");
    PRINTF("\r\n The LED is taking turns to shine.\r\n");

    /* Init flexio, use default configure
     * Disable doze and fast access mode
     * Enable in debug mode
     */
    FLEXIO_GetDefaultConfig(&fxioUserConfig);
    /* Reset the flexio to clear register*/
    FLEXIO_Init(BOARD_LED_FLEXIO, &fxioUserConfig);

    /* Init output LED FLEXIO. */
    FLEXIO_SetPinConfig(BOARD_LED_FLEXIO, BOARD_LED_FLEXIO_PIN, &led_config);

    while (1)
    {
        uint32_t pinstate = FLEXIO_PinRead(BOARD_LED_FLEXIO,BOARD_LED_FLEXIO_PIN);
        PRINTF("x %d, pinstate %d\n\r", x, pinstate);
        SDK_DelayAtLeastUs(1000000U, SystemCoreClock);
    }
}

Above code works fine until input is low on this pin. As soon as when high voltage (rising edge) applied my program just stuck or I guess it is not coming out of ISR.

PS: If I read pin status without interrupt configuration, I am getting HIGH/LOW according to High/Low voltage on pin.

0 Kudos
1 Reply

130 Views
Alejandro_Salas
NXP TechSupport
NXP TechSupport

Hello @NZP 

I hope you are doing well.

 

That is happening because the register of PINSTAT is set to 1 in the flag of PIN 24:

Alejandro_Salas_0-1712768487615.png

 

You must clear the status flag by software. You can do it as below:

Alejandro_Salas_2-1712768583785.png

 

It is working for me.

 

Best regards.

 

Salas.

0 Kudos