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

Wrong baud rate calculation formula on Pi3+ #3

Open
FlKo opened this issue Nov 2, 2019 · 2 comments
Open

Wrong baud rate calculation formula on Pi3+ #3

FlKo opened this issue Nov 2, 2019 · 2 comments

Comments

@FlKo
Copy link

FlKo commented Nov 2, 2019

// Set integer & fractional part of baud rate to 2400 Baud fixed. Divider = 3.000.000 / 2400
// Fractional part = 0. In contrary to the documentation, there is no additional divider by 16
// (RASPI 3). May be different at RASPI 1/2 ??
iowrite32(3000000 / 2400, UART_INT_BAUD);
iowrite32(0, UART_FRAC_BAUD);

This baud rate calculation is just working by accident for Raspi Pi 3+ as you wrongly assume that
"there is no additional divider by 16" (which is still there in fact).
For Pi 3 and upwards the default UART frequency is now 48MHz instead of 3MHz,
so while your result is right, your math is wrong (if you don't change the default value in config.txt).

Your calculation of 3000000 / 2400 returns the same result as 48000000 / (16 * 2400) (which is 1250).

See the following commit:
Raspberry Pi Firmware Commit

@john30
Copy link
Member

john30 commented Nov 9, 2019

@Galileo53 could you have a look at this please?

@Galileo53
Copy link
Member

To be honest, I have not found a way to read the current default value of the clock frequency. So I only adjusted the comment for now and it still works "by accident" (V1.8). Maybe someone can give me a hint so I can implement it correctly

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

3 participants