LPUART_DisableInterrupts on a K32L2

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

LPUART_DisableInterrupts on a K32L2

831 Views
cyril_baby
Contributor I

On the K32L2 micro -

I can enable the LPUART interrupt but I cannot disable it. If I execute this code the firmware will go into the UART handler no matter if I disable the second half of the code or not.

I am not sure what the reason is. 

//This piece of code successfully enable LPUART interrupt upon data receival

LPUART_EnableInterrupts(LPUART0, kLPUART_RxDataRegFullInterruptEnable);
LPUART_EnableInterrupts(LPUART1, kLPUART_RxDataRegFullInterruptEnable);

EnableIRQ(LPUART0_IRQn);
EnableIRQ(LPUART1_IRQn);

//This piece of code UNsuccessfully DISable LPUART interrupt upon data receival

LPUART_DisableInterrupts(LPUART0, kLPUART_RxDataRegFullInterruptEnable);
LPUART_DisableInterrupts(LPUART1, kLPUART_RxDataRegFullInterruptEnable);

DisableIRQ(LPUART0_IRQn);
DisableIRQ(LPUART1_IRQn);

0 Kudos
Reply
3 Replies

689 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Cyril,

My name is Sabina and I'll be happy to assist you. Could you please share where in your code you are disabling your UART IRQ?

I have reproduce it from my side, but it successfully disables the interrupt handler. For example, I put the same functions you are using at the end of the handler so I will enter only once at the beginning.

pastedImage_1.png

After receiving one character successfully, it never returns to the handler. 

Please let me know your results from your end, by applying the same on the lpuart_interrupt example from the SDK.

Best Regards,

Sabina

0 Kudos
Reply

689 Views
cyril_baby
Contributor I

Hi Sabina,

Thank you for reaching out. The code has changed tremendously since then, and I think I found the reason why the interrupt couldn’t be disabled.

I was trying to disable it while executing the IRQ handler. I think I should have gotten out of it and then disable.

Let me know if that makes sense for you as well.

Rgds

Cyril.

0 Kudos
Reply

689 Views
Sabina_Bruce
NXP Employee
NXP Employee

Hello Cyril,

Hope you are doing well.

Yes, the implementation should also work. In the end, there are many different configurations and manners that can function properly. However, it will depend on the principal objective of your application what will work best.

Hope it helps!

Sabina

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply