Greetings to all,
I am trying to use the RT1176 IDLE interrupt to receive serial port data of indefinite length.
I am using it based on the demo of lpuart_edma_transfer_cm7, and enabled the serial port idle interrupt based on the demo
LPUART_ClearStatusFlags(LPUART1_PERIPHERAL, kLPUART_IdleLineFlag);
LPUART_EnableInterrupts(LPUART1_PERIPHERAL, kLPUART_IdleLineInterruptEnable);
After LPUART_TransferCreateHandleEDMA
kStatus_LPUART_TxIdle is triggered without any problem. But when receiving data, the serial port interrupt IRQ will be triggered continuously.
I tried to find the reason and found that when the IDLE interrupt ISR is triggered, kLPUART_TransmissionCompleteFlag is also set. But I clearly disabled this interrupt after the transmission is completed.
The order is as follows
After completing the initialization
The program sent a piece of data to the outside, and the data was successfully sent. After entering the IRQ, I compared all the interrupt flags, which seemed to be normal.
Then
Disabled DMA sending LPUART_TransferAbortSendEDMA
Disabled the TransmissionComplete interrupt, which was able to
Then cleared the interrupt flag
Then I used the serial port assistant to send a message to the MCU
After entering the interrupt, it was detected that the TransmissionCompleteFlag was set again.
At this time, if I don’t know the TransmissionCompleteFlag interrupt will enter the interrupt loop indefinitely.
The interrupt is clearly disabled here, why does it enter the IRQ after the flag is set?
I used Jlink RTT to show log. SDK is Version: 2.16.000.
I would like to know why this happens, or if there is any way I can avoid it so that I can use the idle interrupt and normal DMA transmission without conflict.
Looking forward to your advice. Thanks in advance!
i.MX-RT1170
Hi @hughdai ,
There may be a conflict between two interrupt handler functions in your implementation.One is triggered on an IDLE condition and one is triggered on completion of an EDMA transfer.It's likely that there is a conflict in the middle causing the flag bits to change in an unanticipated way.
Suggest you simplify the logic by referring to these two links:
https://blog.csdn.net/xxx77ghl/article/details/137199775
Best regards