Giter VIP home page Giter VIP logo

rpi4-bare-metal's People

Contributors

rhythm16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

rpi4-bare-metal's Issues

Explanation for calculation of PL011 UART baud rate setting

* The baudrate setting of the PL011 UART was copied from the [exercise solutions](https://github.com/s-matyukevich/raspberry-pi-os/tree/master/exercises/lesson01/2), I don't know how it's calculated and is surprised that the value also works for the RPI4.

The baudrate setting of the PL011 UART was copied from the exercise solutions, I don't know how it's calculated and is surprised that the value also works for the RPI4.

The hint is in this file:

for calculation hint see PrimeCell ® UART (PL011) Technical Reference Manual

Said reference manual is here: https://developer.arm.com/documentation/ddi0183/g/; section 3.3.6 example 3-1 contains an example for how to calculate the baudrate setting (the formulas in section 3.3.4 and 3.3.6 are pretty obscure):

If the required baud rate is 230400 and UARTCLK = 4MHz then:
Baud Rate Divisor = (4×10^6)/(16×230400) = 1.085
This means BRDI = 1 and BRDF = 0.085.
Therefore, fractional part, m = integer((0.085×64)+0.5) = 5
Generated baud rate divider = 1+5/64 = 1.078
Generated baud rate = (4×10^6)/(16×1.078) = 231911
Error = (231911-230400)/230400 × 100 = 0.656%
The maximum error using a 6-bit UARTFBRD Register = 1/64×100 = 1.56%. This occurs when m = 1, and the error is cumulative over 64 clock ticks.

There's also table 3-8 with "typical bit rates and their corresponding divisors when UARTCLK is 7.3728MHz" and table 3-9 with "required bit rates and their corresponding integer and fractional divisor values and generated bit rates when UARTCLK is 4MHz".

As both the RPi3 and the RPi4 have a PL011 UART, these calculations work for both models.

(this is a bit like a detective following clues...)

Is this starting up for you?

Hey nice work, I'm trying to get this working as well so I can startup the MMU on rpi4, it doesn't seem to startup for me though.

I tried downloading the firmware from today and from ~6 months ago but neither will boot up for me.

I'm able to get the MMU working on the rpi 3 but not the 4, so was hoping to be able to boot this up and use some of your code.

Explanation for 500MHz system clock

* Low level devel said the RPI4's system clock frequency is 500MHz, this is correct in my testing, but I can't find this anywhere, in fact the bcm2711 (the soc on the PI4) peripheral datasheet actually says the system clock frequency is 250MHz on page 10.

Low level devel said the RPI4's system clock frequency is 500MHz, this is correct in my testing, but I can't find this anywhere, in fact the bcm2711 (the soc on the PI4) peripheral datasheet actually says the system clock frequency is 250MHz on page 10.

The document on overclocking contains the default frequencies:

This table gives the default values for the options on various Raspberry Pi Models, all frequencies are stated in MHz
...
core_freq... Pi4... 500

(yeah, the documentation is all over the place)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.