I have written a programm that receives data from an external device via LPUART. It’s been working all fine with an example code that receives manual user input, but when I receive data that is being send by another programm (thus, very fast), every once in a while a byte goes missing and I’m running out of ideas how to fix this problem.
- I use the MIMXRT1060 EVK
- I use the lpuart freertos driver
- I work with LPUART2
- I slightly modified LPUART_RTOS_Receive so that I can call it with a timeout
- I use a ring buffer for receiving data. A buffer overflow does never occur, so that’s not the problem.
My thoughts and what I’ve tried so far
Because there is no buffer overflow whatsover, the problem must be somewhere closer to the hardware. It seems to me that interrupts are lost. But there’s the big question: Why and where?
- fsl_lpuart_freertos uses an event group to recognize interrupts. I figured that maybe the interrupt handling takes too long so that some interrupts might not be noticed. So, I created a counting semaphore to ensure every interrupt is being recognized. But this did not fix the problem.
- The IRQ priority of LPUART2 is set to 5 befor initialization. Changing the value (e.g. to configMAX_SYSCALL_INTERRUPT_PRIORITY + 1) did not fix the problem either.
- Increasing configTICK_RATE_HZ did not help.
Has anyone got another idea where I could have missed some vital configuration or what could be the cause of the problem? Keep in mind that the code has been working fine with slow data flows, but it starts losing data when the transmission rate is very high.
Thanks in advance