AnsweredAssumed Answered

How to use FIFO in uart comunication

Question asked by IgorGonzalez on Oct 2, 2012
Latest reply on Feb 14, 2013 by alejandrolozano


I have already implement uart communication for modbus protocol and works well but now, I would like to implement with FIFOs.

I have some questions about it:


1.- How I have to enable FIFO feature for uart communication? It´s enough with the next code for the init uart configuration?




2.- where I have to write my data? Is there any FIFO data register or I have to write UART4_D register? After modbus process, I have stored all my data in an array buffer and is it enough to send data to UART4_D or I have to take in account something else? Before to try to implements FIFOs, I used to check if TDRE was clear or not before send any other byte.


if(b8envia_mensaje_modbus == TRUE_B1) {

     for (u8nn = CERO_U8; u8nn < u8sendCounter; u8nn++){

          //while((UART4_S1&UART_S1_TDRE_MASK)==0) {}

          UART4_D = aru8sendBuf[u8nn];




3.- Last question is about how can I control uart4 isr to clear a own flag to know that all data has been sent. I´m not sure if S1[TDRE] flag is set when TXFIFO gets empty or equal to TXWATER value.



             UART4_S1;//clear isr

             b8envia_mensaje_modbus = FALSE_B1;//own flag

             GPIOC_PCOR |= 0x00002000; //clear manual CTS

             GPIOC_PCOR |= 0x00001000; //clear manual RTS



Thanks in advance


Igor Gonzalez