Hi, I have problem about uart send functionality. If there is no data on receive I can send data but if data received when I send data ,the program will stop at
while (LINFlexD_0.UARTSR.B.DTFTFF == 0);
I put a secureCounter to while loop so it is go on working but I want to know why this happens. If I increase baud rate I see that event occurrence decrease. So I think that uart is not work full dublex. Manual Reference says Uart is Full duplex but it is working as half dublex.
My configuration is listed below:
nbLINFlex = 0;
LINFLEX[nbLINFlex]->LINCR1.B.INIT = 1; // enter initialization mode
LINFLEX[nbLINFlex]->UARTCR.B.UART = 1; //0=LIN 1=UART
LINFLEX[nbLINFlex]->UARTCR.B.PCE = 0; //0 = parity disabled, 1 = parity enabled
LINFLEX[nbLINFlex]->UARTCR.B.PC0 = 0; //0 = even parity, 1 = odd parity
LINFLEX[nbLINFlex]->UARTCR.B.WL0 = 1; //0 7-bit data + parity bit *** 1 8-bit data (or 9-bit if PCE is set).
LINFLEX[nbLINFlex]->UARTCR.B.TxEn = 1;
LINFLEX[nbLINFlex]->UARTCR.B.RxEn = 1;
LINFLEX_InitRxBuffer(nbLINFlex,1);
LINFLEX[nbLINFlex]->UARTSR.B.DRFRFE = 1; // clear DRF flag (Data Reception Complete Flag)
LINFLEX[nbLINFlex]->UARTSR.B.DTFTFF = 1; // clear DTF flag (Data Transmission Complete Flag)
LINFLEX[nbLINFlex]->LINCR1.B.INIT = 0; // enter normal mode
Is there any solution to solve this.
Hi,
I found solution. Problem is about clearing DRFRFE flag.
In ISR I use
LINFLEX[0]->UARTSR.B.DRFRFE = 1;
to clear flag. When I use this also DTFTFF flag clearing. So
while (LINFlexD_0.UARTSR.B.DTFTFF == 0); is locked.
We have to use
LINFlexD_0.UARTSR.R &= 0x00000004;
to clear DRFRFE flag.
Hi,
yes, this is common issue when bit access is used; read-modify-write instruction is executed and so other flags can be cleared too.
See more info in chapter 3.2 of https://www.nxp.com/docs/en/engineering-bulletin/EB758.pdf
BR, Petr