AnsweredAssumed Answered

LPC1768, UART full duplex ?

Question asked by René Brunier on Jul 5, 2017
Latest reply on Jul 11, 2017 by Kerry Zhou

Hello LPC users,

 

I'm using an UART3 to exchange data with an external device. UART3 set to 8 bits, no parity, 1200bauds, RX data interrupt enable.Here are the settings for UART3:

    LPC_SC ->PCONP |= (1<<25);
    //select clock PCLK=CCLK/4 (clear bits 14:15)
    LPC_SC ->PCLKSEL1 &= ~(PCLK_UART3_MASK) ;

 

    // PINSEL9 Pin so that P4.28 = TXD3 and P4.29=RXD3
    //  25:24 P4.28 GPIO Port 4.28 RX_MCLK MAT2.0 TXD3
    //  27:26 P4.29 GPIO Port 4.29 TX_MCLK MAT2.1 RXD3
    LPC_PINCON->PINSEL9 |=  ((3 << 24) | (3 << 26));

 

    LPC_UART3 ->LCR = 0x83;        // 8 bits, no Parity, 1 Stop bit, DLAB=1

 

    // Settings value assume a 25MHz base frequency - clock is 100Mhz and PCLKSEL1=0 (so PCLK=CCLK/4)
    // for 4800 bds:
    LPC_UART3 ->FDR = 0xe3 ;        // MULVAL=0x0e; DIVADDVAL=0x03     0xe3
    LPC_UART3 ->DLL = 0x0c ;        // DLL 0x0c
    LPC_UART3 ->DLM = 0x01 ;        // DLM 0x01

 

    LPC_UART3 ->IER = 0x01;            // Enable RX DATA interrupt

    LPC_UART3 ->LCR &= (~(0x80)) ;    // erase DLAB
    LPC_UART3 ->FCR = 0x07;            // Enable FIFO and reset TX and RX FIFO, trigger IRQ at first character received
    LPC_UART3 ->TER |= (1<<7);      // UART_TER_TXEN    !< Transmit enable bit
    LPC_UART3 ->IER = 0x01;            // Enable RX DATA interrupt, requires DLAB=1 ?
    NVIC_EnableIRQ(UART3_IRQn);
    NVIC_SetPriority(UART3_IRQn , 0); // set highest priority

 

However, I experiment some collisions in the received data frame, and RX data are loss.
Looking into LPC user manual, I notice that both registers for RX and TX (respectively named U3RBR and U3THR) are pointing on the same address?
Is this possible, in such conditions to get UART working in full duplex ?

 

Any clue ?

Thank's

René

Outcomes