NXP IMXRT 1052 - Registering interrupt handler

cancel
Showing results for 
Search instead for 
Did you mean: 

NXP IMXRT 1052 - Registering interrupt handler

234 Views
Contributor II

Hello,

I have following queries regarding registering the interrupt handler on NXP i.MXRt 1052 processor - 

1. Which APIs are required to write code for registering an interrupt handler?

2. Is there any SDK example avaiable for that?

10 Replies

21 Views
NXP TechSupport
NXP TechSupport

Hi Suhel Mulla ,

    About the interrupt handler register, you can refer to the SDK interrupt code.

  1. Please download the SDK from this link:

   Welcome | MCUXpresso SDK Builder 

  2. Take RT1050 SDK gpio interrupt as an example.

 \SDK_2.8.0_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\gpio\input_interrupt

   From the startup_MIMXRT1052.s, you can find the real handler name:

pastedImage_5.png

Board.h, you can find:

#define BOARD_USER_BUTTON_IRQ_HANDLER GPIO5_Combined_0_15_IRQHandler

gpio_input_interrupt.c

#define EXAMPLE_GPIO_IRQHandler BOARD_USER_BUTTON_IRQ_HANDLER

So, at last, you will find it is processing:

void EXAMPLE_GPIO_IRQHandler(void)
{
/* clear the interrupt status */
GPIO_PortClearInterruptFlags(EXAMPLE_SW_GPIO, 1U << EXAMPLE_SW_GPIO_PIN);
/* Change state of switch. */
g_InputSignal = true;
SDK_ISR_EXIT_BARRIER;
}

It finishes the interrupt handler register.

BTW, you also need to enable the related IRQ:

 EnableIRQ(EXAMPLE_SW_IRQ);

GPIO interrupt is just a simple example, you also can check other interrupt code in the SDK driver folder.

Wish it helps you!

If you still have questions about it, please kindy let me know.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

21 Views
Contributor II

Thanks for the reply.

I know this procedure of enabling and using the interrupt.

I want to know about registering the interrupt. Can you share the procedure about that?

0 Kudos

21 Views
NXP TechSupport
NXP TechSupport

Hi Suhel Mulla,

  Do you want to know to register the callback interrupt?

  I am not very clear about your issues.

  If you want to use the interrupt, you can use the interrupt handler in the .s file directly.

  but if you want to use the callback to register the handler, please refer to this SDK code:

SDK_2.8.0_EVKB-IMXRT1050\boards\evkbimxrt1050\driver_examples\qtmr\inputcapture_outputpwm_dma

edma_handle_t g_EDMA_Handle;

EDMA_CreateHandle(&g_EDMA_Handle, EXAMPLE_QTMR_DMA, 0);
EDMA_SetCallback(&g_EDMA_Handle, EDMA_Callback, NULL);

/* User callback function for EDMA transfer. */
void EDMA_Callback(edma_handle_t *handle, void *param, bool transferDone, uint32_t tcds)
{
if (transferDone)
{
g_Transfer_Done = true;
}
}

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

21 Views
Contributor II

Thanks for the reply.

As per you said, I will explain my query in detail as below :

-> I am working on NXP i.MXRT 1050 EVK board.

-> I have configured  GPIO1.11 pin as external edge triggered interrupt.

My queries are as below -

-> I want to know about how to register the callback interrupt for external interrupt pin.

-> I am in search of APIs similar to the EDMA APIs you mentioned but for my GPIO1.11 external interrupt pin.

    Can you suggest the required APIs for it?

0 Kudos

21 Views
NXP TechSupport
NXP TechSupport

Hi Suhel Mulla,

   Thanks for your confirmation.

   Please check the gpio.h and igpio_adapter.cin the SDK folder:SDK_2.8.0_EVKB-IMXRT1050\components\gpio

   You will find the gpio call back API functions.

   /*!
* @brief Installs a callback and callback parameter.
*
* This function is used to install the callback and callback parameter for GPIO module.
* When the pin state interrupt happened, the driver will notify the upper layer by the installed callback
* function. After the callback called, the GPIO pin state can be got by calling function #HAL_GpioGetInput.
*
* @param gpioHandle GPIO handle pointer.
* The handle should be 4 byte aligned, because unaligned access doesn't be supported on some devices.
* @param callback The callback function.
* @param callbackParam The parameter of the callback function.
* @retval kStatus_HAL_GpioSuccess Successfully install the callback.
*/
hal_gpio_status_t HAL_GpioInstallCallback(hal_gpio_handle_t gpioHandle,
hal_gpio_callback_t callback,
void *callbackParam);




hal_gpio_status_t HAL_GpioInstallCallback(hal_gpio_handle_t gpioHandle,
hal_gpio_callback_t callback,
void *callbackParam)
{
hal_gpio_state_t *gpioStateHandle;

assert(gpioHandle);

gpioStateHandle = (hal_gpio_state_t *)gpioHandle;

gpioStateHandle->callbackParam = callbackParam;
gpioStateHandle->callback = callback;

return kStatus_HAL_GpioSuccess;
}

Please check the related driver and the API description at first.

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

21 Views
Contributor II

Hello Kerry,

Thanks for your quick reply. Your reply solved many problems I had earlier.

These are the the same APIs which I was looking for.

The only doubt I have is as below - 

1. Can you suggest any example in SDK where these APIs are used?

2. In which sequence these APIs should be called so that GPIO interrupt handler for port pin (GPIO 1.11 pin) is properly registered?

0 Kudos

21 Views
Contributor II

Hello Kerry,

Thanks for the reply.

I will have gone through the project you mentioned in your reply. It might be difficult for me to implement the technique used in USB example in my project.

Is there any project in SDK or somewhere else on internet (e.g. github etc.) in which only a simple GPIO pin is programmed as extarnal interrupt using interrupt registration method and no other extra functionality (like USB in above example) is provided?

0 Kudos

21 Views
NXP TechSupport
NXP TechSupport

Hi Suhel Mulla,

  I mean, you can refer to that project, just refer to the related GPIO code, learn how to use the API.

  Then, you totally can copy it to the simple project, and register it.

  There no other project which can support this type HAL API.

  In fact, normally, the sample GPIO even don't need to use this type code, just use the GPIO ISR directly.

  But if you want to use it, you can refer to the USB code which have that API and give you the examples.

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos

21 Views
Contributor II

Thanks for the reply.

I downloaded SDK SDK_2.8.0_EVKB-IMXRT1050from the link you have mentioned. But it does not have evkbimxrt1050_om13588 folder. So I can't acces the example you have mentioned.Do I need to add any component specifically while building the SDK from the link?

0 Kudos

21 Views
NXP TechSupport
NXP TechSupport

Hi Suhel Mulla,

  No, you download the wrong SDK, you need to download SDK_2.8.0_EVKB-IMXRT1050-OM13588, it unders the Kit item, not the board, please check it again, it is not the controlled access, so you should can download it.

pastedImage_1.png

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

 

-------------------------------------------------------------------------------
Note:
- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored
Please open a new thread and refer to the closed one, if you have a related question at a later point in time.
-------------------------------------------------------------------------------

0 Kudos