AnsweredAssumed Answered

UART_DRV_EdmaGetReceiveStatus reports that it has received a certain amount of data before it actually has

Question asked by Siddharth Menon on Sep 22, 2015
Latest reply on Oct 12, 2015 by Siddharth Menon



I'm using the Kinetis SDK 1.2 with the FRDMK64f board.


My application uses the CMSIS RTX OS has only one thread. I am trying to start receiving data from UART0 at 115200 baud, using UART_DRV_EdmaReceiveData, and I store the data into a thread safe FIFO. In a polling loop I am making calls to UART_DRV_EdmaGetReceiveStatus, and I advance the tail of the FIFO by how many ever bytes UART_DRV_EdmaGetReceiveStatus tells me it received (I am disabling interrupts when i call UART_DRV_EdmaReceiveData and when I advance the tail of the FIFO).


The problem is that, sporadically, the data actually received looks incorrect. Specifically, although UART_DRV_EdmaReceiveData tells me it has received a certain number of bytes (this is generally of the order of 600 or so), when I copy the "new" data in my FIFO, it looks like the data did not actually get written (old values are being copied). However, if i put a breakpoint in my code (i'm using J-Link for debugging), it looks like the data in the FIFO is correct... so presumably by the time the breakpoint got hit the EDMA completed writing all the data.


Like i mentioned, this happens sporadically, and it is more frequent when a lot of data is being sent to UART0.


The code I have is pretty complicated, and i'm not sure how I can give you reproduction steps. Has anyone encountered anything similar, or is there a bug with the SDK that may be causing this behavior.