UART FIFO about K40

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

UART FIFO about K40

Jump to solution
964 Views
ramazantoprak
Contributor II

I have a question about K40, i want to use FIFO receiver/ transmitter, but i dont know how can i reach insde FIFO data using uart_D register. Is there any example code about that or explanation. And i didnt understand purpose of watermark method.

Thanks a lot.

Ramazan

1 Solution
730 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Ramazan,

The attachment provides the UART module transmit DMA test function (uart_tdre_dma_test()) and UART module receive DMA test function (uart_rdrf_dma_test()) separately.

And it also support the UART3, I'd like to suggest that you can verify these function one by one to your demo.
Have a great day,
Ping

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

View solution in original post

0 Kudos
4 Replies
730 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Ramazan,

Please check the attachments which are used as validation code, I think it can help you out.
Have a great day,
Ping

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

730 Views
ramazantoprak
Contributor II

Hi jeremyzhou,

Thanks your answer and helpfull shairing. Actually, I sent some data with uart3_D register, but when i want to send using FIFO buffer, it doesnt succeed. my code is following. TCFIFO [TXCOUNT] doesnt count truely, it only count one time but i am sending 8 dataword, so it should be able to count 8. Where is the my fault. Is there any ideas about this.

unsgined int i, error=0;

void main(){

Uart_INIT(); // no -parity, 8-bit ,4800-baud, transmitter disable, receiver disable

UART3->PFIFO.TXFE = 1;

UART3->PFIFO.RXFE = 1;

UART3->C2.TE  = 0;

UART3->C2.RE = 0;

/* Loop to fill the entire TxFIFO */

for(i=0;i<9;i++){

/* Write data into the FIFO */

UART3->D.RT  = i;

}

/* Test to make sure TCFIFO is 8 (FIFO full) */

if ( UART3->TCFIFO.TXCOUNT != 8)     {         error++;     }

/* Flush the TxFIFO */

UART3->CUART->FIFO.TXFLUSH = 1;

/* Test to make sure TCFIFO is 0 now (FIFO flushed) */

if ( UART3->TCFIFO.TXCOUNT != 0){  error++;  }

/* Loop to fill the entire TxFIFO with a new data set */

for( i=0x11; i < 0x19; i++){

/* Write data into the FIFO */

UART3->UART->D.RT = i;

}

/* Set the Rx watermark to 8 so that we can detect when the transmit is complete */

UART3->RWFIFO.RXWATER = 8;

/* Now re-enable the transmitter. This should cause all 8 bytes to transmit

UART3->C2.TE = 1;

}

Thanks for your interest,

Ramazan

0 Kudos
730 Views
ramazantoprak
Contributor II

6. UART0 and UART1 contains 8-entry transmit and 8-entry receive FIFOs

7. All other UARTs contain a 1-entry transmit and receive FIFOs

I saw in the datasheet. I used UART3, it has one dataword,for this reason TXCOUNT is counting 1. I missed out it. i will use uart0 for 8 dataword.

Thanks for your halp,

ramazan

0 Kudos
731 Views
jeremyzhou
NXP Employee
NXP Employee

Hi Ramazan,

The attachment provides the UART module transmit DMA test function (uart_tdre_dma_test()) and UART module receive DMA test function (uart_rdrf_dma_test()) separately.

And it also support the UART3, I'd like to suggest that you can verify these function one by one to your demo.
Have a great day,
Ping

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

0 Kudos