IMXRT1050 external interrupt is not getting disable with the help of GPIO_PortDisableInterrupts()

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

IMXRT1050 external interrupt is not getting disable with the help of GPIO_PortDisableInterrupts()

2,199 次查看
pbhagat
Contributor I

Hi,

We are using IMXRT1050 EVBK SDK for our project development.

We have configured the external interrupt for rising/falling edge on one of the input signal for GPIO port 2(Pin23).

Now in interrupt handler of this external interrupt we have disabled the external interrupt on rising edge with the help of GPIO_PortDisableInterrupts() function. But what we observed is control goes into interrupt handler one more time even after disabling it.

However if we disable the external interrupt in the interrupt handler with the help of DisableIRQ() function after detection of rising edge interrupt the control does not go into interrupt handler again.

From what we understand the difference between these two function is, GPIO_PortDisableInterrupts() is disable the interrupt on the particular port pin with the help of IMR register and DisableIRQ() function disable NVIC interrupt for all pins on particular port with help of ICER register.

What we think only using GPIO_PortDisableInterrupts() function should serve the purpose.

We have verified the functionality for GPIO_PortDisableInterrupts() function on the other port pins for interrupt, there it is not causing any problem.

Can you please help us with it?

Please let us know if we are missing anything.

Thanks in advanced.

Regards,

P Bhagat.

0 项奖励
回复
7 回复数

2,188 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.
I was wondering if you can share your demo code and introduce the testing steps and EVK-board.
Looking forward to your reply.
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 项奖励
回复

2,180 次查看
pbhagat
Contributor I

Hi,

Please find the attached file for code template (Here external interrupt initialization part and interrupt handler is mentioned).

Below are the important points I would like to share,

1] The part number of processor which we use in our circuit is MIMXRT1052DVL6B.

2] The development board which we refer is EVBKIMXRT1050 and its SDK for demo examples.

3] GPIO2(pin23) is configured for external interrupt for both rising and falling edge(basically for detecting 24VAC input signal), this rising and falling edge occurrence is based on the availability of 24AC signal.

4] The circuit is design in such a way that when 24VAC is present there will be logic low level(0V) signal at GPIO port pin and when 24VAC is absent there will be logic high level(3.3V) signal at GPIO port pin.

Procedure for external interrupt :

1] Switch ON 24VAC input power of circuit board, so as 24VAC is present there will be logic low level signal at GPIO port pin.

2] Now Switch OFF 24VAC input power of circuit board, it will generate rising edge interrupt at GPIO port pin and will have logic high level signal at port pin.

3]  As soon as it generate interrupt clear port interrupt flag.

4] Check port pin logic level.

5] Performed the required actions based on interrupt.

6] Disable the GPIO port pin interrupt with the help of GPIO_PortDisableInterrupts() function.

Note : Here the signal on port pin will be available for very small amount of time say 60msec, so within that time we have to detect the interrupt and perform required action.

Please let us know if you need any other information.

Regards,

P Bhagat.

0 项奖励
回复

2,166 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
After having a brief review of the code, I don't find anything wrong actually.
In your application, you use the GPIO_B1_07 as the GPIO2_IO23, and it's able to GPIO_PortDisableInterrupts() to disable the interrupt function of the above GPIO pin.
So I'd like to suggest you check the value of the GPIO_ISR register before the exit the interrupt function, meanwhile, check the value in the first place after reentering the interrupt function.
It can help us to figure out the trigger source of the second time of entering the interrupt function.
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 项奖励
回复

2,140 次查看
pbhagat
Contributor I

Hi,

As you mentioned we have checked the value of GPIO_ISR register. 

What we have observed is that second time also the interrupt source is same. 

Below is the process which we follow to check the value of GPIO_ISR register and we have attached the code template for your reference.

1] We have declared 4 variables named test_occurence1, test_occurence2, test_occurence3, test_occurence4 to check number of times it enters into ISR function on different conditions.

2] We have also declared 4 variables named test_isr1, test_isr2, test_isr3, test_isr4 to check the value of GPIO_ISR register at different conditions in AC loss ISR handler.

3] Use of these variables are

    a] test_occurence1 = Total number of times control goes into ISR handler. test_isr1 is the status of GPIO_ISR at this condition.

    b] test_occurence2 = Total number of times control goes into ISR handler when GPIO pin is SET. test_isr2 is the status of GPIO_ISR at this condition.

    c] test_occurence3 = Total number of times control goes into ISR handler but GPIO pin is NOT SET and test occurence2 variable is zero. test_isr3 is the status of GPIO_ISR at this condition.

    d] test_occurence4 = Total number of times control goes into ISR handler but GPIO pin is NOT SET and test occurence2 variable is non zero. test_isr4 is the status of GPIO_ISR at this condition.

4] Please see attached images of "default_value_of_variable_registers" and "value_of_variable_registers_after_program_freerun_in_debug" there you can see default value of GPIO_ISR register and number of occurence of ISR handler.

5] Here default value of GPIO_ISR register is 0xBE3FFFFF and value after interrupt occur and when intrrerrupt occur one more time even after disabling it with the help of GPIO_PortDisableInterrupts() function is 0xBEBFFFFF. Only 23rd bit of GPIO2_ISR register is changed which is our AC loss input pin where we are monitoring external interrupt.

6] So from this observations it is clear that same external interrupt is the source for reentering the ISR even after disabling it with the help of GPIO_PortDisableInterrupts().

7] One more observation is that it only enters one time into ISR handler after disabling it after that status of GPIO2_ISR register changes to 0xBE3FFFFF which is default status.

8] If we used DisableIRQ() function then it won't reenter into ISR handler.

Please let us know your comments on our observations.

Also let us know if we are missing anything.

Regards,

P Bhagat.

 

0 项奖励
回复

2,097 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
It seems a bit weird, I was wondering if you can replicate the phenomen on other GPIO pin besides GPIO2_IO23.
In further, I'd like to know what board you tested with.
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 项奖励
回复

2,089 次查看
pbhagat
Contributor I


Hi,

Thanks for your reply.

No, we can not replicate this on other GPIO pin beside GPIO2_IO23 as we have a board with a fix hardware and there is no extra GPIO pin where we can configure it for this purpose.


This functionality we have tested on the special hardware board which we have assembled for our project purpose, we used NXP processor with part number MIMXRT1052DVL6B on this hardware board.

Regards,

P Bhagat.

0 项奖励
回复

2,067 次查看
jeremyzhou
NXP Employee
NXP Employee

Hi,
Thanks for your reply.
I've not replicated the phenomenon when testing with the gpio_input_interrupt demo project in the SDK library.
So I guess the phenomenon is related to the input signal, maybe you can try to use the oscilloscope to observe the input signal for Pin23.
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 项奖励
回复