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

SystemClock initialization #10

Open
n-e-g opened this issue Jan 17, 2025 · 1 comment
Open

SystemClock initialization #10

n-e-g opened this issue Jan 17, 2025 · 1 comment

Comments

@n-e-g
Copy link

n-e-g commented Jan 17, 2025

Hello,

I am finding difficulties in configuring system clock on ch32 platform with noneos-sdk.
As far as I can judge startup code, it enforces calling SetSysClock, which is configured by SYSCLK_FREQ_* constants.
The way these constants are set, I find it impossible to have HSI clock, without changing source of the package in platformio directory.
Or am I missing some configuration option for doing this ?

Unfortunately, changing package sources will affects all projects based on this framework, which is very unfortunate.
Thus it would be very nice to have more flexible way of configuring system clock.
I find couple of possibilities, how to address this issue:

  • Configure SetSysClock function as weak, so that defining own function will override any default behavior
  • Have HSI clock default
  • Have SYSCLK_FREQ_ option set unless it is already provided by build flags
@chintal
Copy link

chintal commented Jan 28, 2025

I agree, there needs to be a better way to configure this ( and other ) features. Perhaps a configuration file that can be provided by the application.

For the moment, you might be able to change the clock by defining the value in the the build flags in platformio. One of these should do what you want:

-DSYSCLK_FREQ_24MHZ_HSI=24000000
-DSYSCLK_FREQ_48MHZ_HSI=48000000

I have not checked whether this works.

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

2 participants