This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

UART Register Reading to TEST UART

Hi,

I am writing a test code in the u-boot where i need to get the baud rate of the UART, which i am doing as below.

u32 dll_reg_Mode_3 = *( volatile u32* )0x48020000;

But the return value is not as per the baud rate set. 

here i am working with baud rate of 115200 and debugging and trying to get the same baudrate but every time the return value of the statement keep changing and not giving the Value as 0x1A, which should be the return value.

I am using the ti8148EVM to run this code.

what i am doing wrong here?

  • Vimal,

    In order to be able to read/write the UART DLL/DLH registers, you need first enable the read/write access to these registers. You should set UART LCR[7] DIV_EN bit to 0x1 and then you can access the DLL/DLH registers.

    When LCR[7] DIV_EN = 0x0, when reading 0x48020000 register, you are actually reading UART0.RHR register, instead of UART0.DLL

    See DM814x TRM,

    section 24.2.3.4.3 Baud Rate Data and Stop Configuration

    Procedure: Set LCR to desired value; LCR[7] to 1, gives access to DLH and DLL registers. Set DLH and
    DLL; LCR[7] = 0, removes access to DLH and DLL registers.

    24.3.10 Line Control Register (LCR)
    7  DIV_EN     0x0 - Normal operating condition.
                         0x1 - Divisor latch enable. Allows access to DLL and DLH.



    Best Regards,
    Pavel