k64 fifo uart fifoempt flag always high.....

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

k64 fifo uart fifoempt flag always high.....

776 Views
thrithinchand
Contributor I

sir, i did uart bootloader code in k64 at 9600 baud rate in polling method ,,,,,

aceept data from uart when it reach 32 byte itll go for flash write and come back befor the next byte .... so it worked fine but it require much time so i need to implement uart fifo to increase the baud rate..9600 to 115200...and reduce the time for flash ... so here i enable the uart0 fifo,8byte size.. but while i checking the uart fifo empty flag it always show...the fifo is empty....ill put my code here .......

/* Disable UART TX RX before setting. */

    base->C2 &= ~(UART_C2_TE_MASK | UART_C2_RE_MASK);

/* Enable tx/rx FIFO */

    base->PFIFO |= (UART_PFIFO_TXFE_MASK | UART_PFIFO_RXFE_MASK);

/*select fifo size 8 data word*/

    base->PFIFO|=UART_PFIFO_RXFIFOSIZE(2);

    /* Flush FIFO */

    base->CFIFO |= (UART_CFIFO_TXFLUSH_MASK | UART_CFIFO_RXFLUSH_MASK);

/*enaable UART TX RX before setting. */

    base->C2 |= (UART_C2_TE_MASK | UART_C2_RE_MASK);

above code for enable fifo....

delay();

(in that delay running i send data)

then in my pgm code....

if(kUART_RxFifoEmptyFlag)

   {UART_WriteBlocking(DEMO_UART,&UART0->RCFIFO,1);

    UART_WriteByte(DEMO_UART,'A');}

    else UART_WriteByte(DEMO_UART,'B');

i got out put 9A9A9A.... like this so flag always one so data in fifo is empty???????????

actually my task to store data in fifo to store a buf ......

0 Kudos
2 Replies

499 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi thrithin,

If you want to use "kUART_RxFifoEmptyFlag", please refer below code:

if (kUART_RxFifoEmptyFlag & UART_GetStatusFlags(DEMO_UART))

{

}

Best Regards,

Robin

0 Kudos

499 Views
mjbcswitzerland
Specialist V

Hi

I am not sure exactly what your problem is but the maximum speed of programming to K64 Flash while continuouly receiving UART data is around 57600 Baud - any faster and the input will overflow while Flash words are programmed (unless code were run from SRAM).

See the following (chapter 5) for details of using SW flow control to allow faster speeds (by ensuring that no data is received when programming): http://www.utasker.com/docs/uTasker/uTaskerSerialLoader.PDF

Also techniques as used by the KBOOT UART or AN2295 Developer's serial loader allow programming flash while the UART reception is paused.

All solutions are also available as industrially proven, off-the-shelf project at http://www.utasker.com/kinetis.html for immediate use if you prefer not to develop, debug and test a new solution.

Regards

Mark

0 Kudos