Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The order of setting different register to enable UART #148

Open
haogroot opened this issue Nov 3, 2019 · 0 comments
Open

The order of setting different register to enable UART #148

haogroot opened this issue Nov 3, 2019 · 0 comments

Comments

@haogroot
Copy link

haogroot commented Nov 3, 2019

I am working on the second exercise of lesson1 and not really clear about the order of enabling UART. Below is my order of setting different register to enable UART but this is not working to print any character.

    put32(UART_CR, 0);                      // Disable the UART.  CR is control register.
    put32(UART_LCRH, (1<<4)|(3<<5));     // Enable FIFO and 8bit in a frame to transmit/receive
    put32(UART_IBRD, 26);                // Set the Integer baud rate divisor 
    put32(UART_FBRD, 3);                 // Set the Fraction baud rate divisor register
    put32(UART_CR, (1 | 1<<8 | 1<<9));      // enable UART and enable UART's Transmit and Receive

Then I try to check the reference solution and all guys did like the following order:

    put32(UART_IBRD, 26);                // Set the baud rate divisor register
    put32(UART_FBRD, 3);
    put32(UART_LCRH, (1<<4)|(3<<5));     // Enable FIFO and 8bit in a frame to transmit/receive

You will set the baud rate divisor register(IBRD & FBRD) first and then LCRT register (the line control register).

I checkout the BCM2837 ARM Peripherals manual but I can not find any section talking about the order of setting these register. Can anyone share about why the order of enabling
UART register is like this or any background knowledge to this order? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant