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

Support 4.9152MHz clock #299

Closed

Conversation

gauravahuja
Copy link

Add support for 4.9152MHz clock which also provides error free UART for certain baud rates like 38400

@MCUdude
Copy link
Owner

MCUdude commented May 23, 2024

That's not a very common clock frequency, and of you have a look at an AVR baud rate calculator, 4.9152 MHz isn't a very "good" clock speed to choose in terms of UART compatibility.

Skjermbilde 2024-05-23 kl  20 14 43

@MCUdude MCUdude closed this May 23, 2024
@gauravahuja
Copy link
Author

gauravahuja commented May 25, 2024

Compare it with baud compatibility for 4Mhz clock. 4.9152Mhz offers 0% error rate for many baud rates that you would realistically use for sub 8Mhz clocks.

image

@MCUdude
Copy link
Owner

MCUdude commented May 25, 2024

Yes, but then again 7.3728 MHz is a better option. If you have to use that particular frequency, you can always use PlatformIO.

@gauravahuja
Copy link
Author

gauravahuja commented Jun 3, 2024

@MCUdude There are a few things I would like to point out

  • Your comment about 4.9152MHz not being very "good" clock speed isn't objectively true compared to other frequencies supported by MiniCore.
  • There will always be some clock setup that is better like 7.3728 MHz you suggested. But then what is the point of supporting multiple clock frequencies that are not better?
  • Platform IO uses MiniCore as part of its build process so I cannot readily use it without support for clock frequency I need.
  • I am willing to invest time and energy into adding support for a new clock frequency If you are willing to include that in MiniCore.

@MCUdude
Copy link
Owner

MCUdude commented Jun 3, 2024

Your comment about 4.9152MHz not being very "good" clock speed isn't objectively true compared to other frequencies supported by MiniCore.

True, clock frequencies, like 4 and 8 MHz, perform worse than 4.9152 MHz when using "standard" baud rates like 115200, but performers perfect at non-standard ones like 250000 and 500000.

But then what is the point of supporting multiple clock frequencies that are not better?

It depends on the application. A "round" clock like 4 MHz performs excellent with "round" baud rates, like 250000 baud, like I mentioned earlier.

Platform IO uses MiniCore as part of its build process so I cannot readily use it without support for clock frequency I need.

You can easily override the clock frequency (F_CPU) when building using PlatformIO. PlatformIO is very flexible, much more than Arduino IDE.

I am willing to invest time and energy into adding support for a new clock frequency If you are willing to include that in MiniCore.

But I see no point in adding a new clock frequency to the list when there are better alternatives for both standard and non-standard baud rates. Why not change to a more common frequency rather than pushing toward adding this not-so-common, not-all-that-great clock that isn't very common to use with AVRs?

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

Successfully merging this pull request may close these issues.

None yet

2 participants