Clock speed, UART, and booting

Subscribe to the forum to receive notifications about new posts.
Post Reply
Ruturaj Mali
Posts: 16
Joined: Mon Jun 17, 2024 1:00 pm

Although I'm a complete novice when it comes to bare-metal PI, however, I do have experience on the Arduino. I've learned a lot from going through the demos, but I'm still not quite sure what clock speed means. According to the specs, the CPU in my PI4-B is a BCM 2711 with a 1.5 GHz speed. I did exactly that to find garbage when I calculated the register value for AUX_MU_BAUD_REG. Then, I used a suggested value from a YouTube video (based on a 500 MHz speed), and that's how it worked. Okay, so perhaps the speed of the CPU and the board differ. Strangely, I have to rely on thedata sheet statements because my application needs some real-time capabilities, but I've never seen anything that allows me to assume the
Now that everything on the SD Card has been cleared out, here is my SD Boot media:
fixup4.dat
start4.elf
#miniuart-bt.dtbo
bcm2711-rpi-4-b.dtb
config.txt
kernel.img
That is what's in the config.txt:
arm_64bit=1
uart_2ndstage=1
#dtoverlay=miniuart-bt
kernel=kernel.img
Even though I can see the kernel operating (it's just reading from the UART and returning the character), it's garbage. It doesn't matter if the miniuart-bt is included in the configuration.
Would someone kindly point me in the right direction and explain what clock speed the board is operating at so that I can locate this information?
User avatar
Shraddha
Posts: 61
Joined: Fri Jun 14, 2024 3:54 pm

The problem you're encountering with the UART and the garbage data is likely due to a mismatch in the baud rate calculation.

Understanding Clock Speed and UART is important.
1. The BCM2711 in your Raspberry Pi 4B has a CPU clock speed of 1.5 GHz.
2. The UART peripheral has its own clock, which is usually different from the CPU clock. For the mini UART (AUX_MU), it usually runs at a fixed clock speed of 500 MHz.

Calculate the correct register value
1. If you want a specific baud rate, you calculate the register value (AUX_MU_BAUD_REG);

Register Value = [500,000,000/(8×Baud Rate)]-1

2. Set the calculated value into the AUX_MU_BAUD_REG

Ensure the mini UART is used: Make sure the miniuart-bt overlay is either commented out or correctly configured in config.txt.
Set the calculated baud rate
Post Reply