Using GPIO intrrupt with freeRTOS on IMXRT 1176

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

Using GPIO intrrupt with freeRTOS on IMXRT 1176

1,722 Views

Hello ,
I have referred sample code provided with SDK/NXP/EVKMIMXRT1170/boards/evkmimxrt1170/driver_examples/gpio/input_interrupt/cm7. This is for bare metal.
In my project, I am using freeRTOS and with implementing similar changes, not able to get any kind of GPIO interrupt triggered.
Before scheduler starts, I am performing below steps

const gpio_pin_config_t Button_config = {kGPIO_DigitalInput,0,kGPIO_IntRisingEdge};
EnableIRQ(GPIO13_Combined_0_31_IRQn); // -----> This line makes my code stuck
GPIO_PinInit(GPIO13,EXAMPLE_SW_GPIO_PIN,&Button_config);
GPIO_PortEnableInterrupts(GPIO13, 1U << EXAMPLE_SW_GPIO_PIN);
NVIC_SetPriority(GPIO13_Combined_0_31_IRQn, 2);

Observations are :
It does not execute further at all if I include EnableIRQ(... ) line. In case I comment that line, execution proceeds but no GPIO interrupt is triggered.

My intention is to implement similar example as of gpio_interrupt , in my sample code having freeRTOS.

Please let me know If I am missing anything ?

0 Kudos
10 Replies

1,608 Views

 You may be right. Could you please email the zip on akshay.kulkarni@faurecia.com in case possible ?

I do not see any other way at moment. Thanks.

0 Kudos

1,634 Views
evkmimxrt1170_freertos_hello_cm7.zip
 is corrupted. Please upload again.
0 Kudos

1,616 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
It seems a bit weird, I already reupload the file.
In my opinion, the issue may be related to the extracted software, sometimes, the firewall of the network may terminate the download process, which causes can't get complete data on the local drive.
Have a great day,
TIC

-------------------------------------------------------------------------------
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

1,652 Views

Hello,
I tried to unzip this file but seems some issue while uploading. Provided zip is showing of size 1.8KB on my system. Could you please double check and upload it again.

Additionally, how would I be able to compile this source file ?

0 Kudos

1,639 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
The size of the zip file is about 1.8 MB and you can open the project via the MCUXpresso IDE after extracting it.
Have a great day,
TIC

-------------------------------------------------------------------------------
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

1,660 Views

Hello,

Sorry for delayed reply. I am yet to test the source you have provided. I will reply back on this thread as soon as I test it on my side. I believe there should be some difference between source files.

Until then, I request to keep this thread open. Thanks.

0 Kudos

1,671 Views

Hello jeremyzhou,

Thanks for your quick response. Sorry, I was not able to confirm the zip that you have shared. I will try to run this one on IMX EVK and will try to find the difference between two projects if it works.. Until then, I would request to keep this thread open.

Thanks.

Akshay K.

0 Kudos

1,712 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
According to your statement, it's hard to jump to a conclusion about the root cause and I think I need more information, so I was wondering if you can demonstrate the steps of creating the above FreeRTOS demo.
Looking forward to your reply.
Have a great day,
TIC

-------------------------------------------------------------------------------
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

1,705 Views

EVAL : IMXRT1176DVMAA

I have a sample code using freeRTOS. In main.c below steps are performed.

//------------------------main.c -----------------------

int main(void)
{
/* Init board hardware. */
BOARD_ConfigMPU();
BOARD_InitPins();
BOARD_InitCustomPins();
BOARD_BootClockRUN();
BOARD_InitDebugConsole();

/* Init logging */
configureLog();

/* Initialize necessary hardware */
funcInitCustomeData(custome_task_PRIORITY);

/* Start the scheduler */
vTaskStartScheduler();

/* The program should never run the following lines */
PRINTF("FATAL: Scheduler failed!\r\n");
return 0;
}

 

//-----------------------------custom.cpp--------------------------------

/*!
* @brief Interrupt service fuction of switch.
*/
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;   // This flag is used in custome_task just to print some log.
    SDK_ISR_EXIT_BARRIER;
}

void funcInitCustomeData(int8_t task_priority)
{
   const gpio_pin_config_t Button_config = {kGPIO_DigitalInput,0,kGPIO_IntRisingEdge};

   NVIC_SetPriority(GPIO13_Combined_0_31_IRQn, 2);
   EnableIRQ(GPIO13_Combined_0_31_IRQn); // -----> This line makes my code stuck
   GPIO_PinInit(GPIO13,EXAMPLE_SW_GPIO_PIN,&Button_config);
   GPIO_PortEnableInterrupts(GPIO13, 1U << EXAMPLE_SW_GPIO_PIN);

   if (xTaskCreate(custome_task, "custome_task", configMINIMAL_STACK_SIZE + 100, NULL,       task_priority, NULL) != pdPASS)
  {
     LOGI("Custome task creation failed!.");
     while (1)
        ;
   }
}

Explanation :

Compilation - OK, Execution - NOK : execution stuck at EnableIRQ call

With above implementation, when I keep doing step over, it works till vTaskStartScheduler gets called from main.c. Next to that it goes to DefaultISR and I can see below stack trace.

akshaykulkarnifaurecia_1-1640761336610.png

Do I needs to disable some interrupt for EVK or configure clock for GPIO interrupt. Not sure, please help.

I hope this gives more detailed information.

 

0 Kudos

1,693 Views
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I've integrated the evkmimxrt1170_freertos_hello_cm7 demo with evkmimxrt1170_igpio_input_interrupt_cm7 demo, and it works well and you can refer to it to correct your demo.
Have a great day,
TIC

-------------------------------------------------------------------------------
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