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);
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.
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
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.
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!
-----------------------------------------------------------------------------------------------------------------------