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

Doesn't show external crystal clock's status in RCU_CTL register. #35

Open
ghost opened this issue Mar 20, 2022 · 0 comments
Open

Doesn't show external crystal clock's status in RCU_CTL register. #35

ghost opened this issue Mar 20, 2022 · 0 comments

Comments

@ghost
Copy link

ghost commented Mar 20, 2022

Hi team,
I a'm very excited regarding the risc v architecture and would like to work with this future technology. Before a week, i started learning risc v architecture with help of a low cost development board. I have given by some basic details here to get you an idea about my working environment.
Gd32 dev board with lcd (seed studio)
Rv debugger(sipeed )
Platform io

The example led code is working fine. I would like to turn on external clock. That's why i read gd32 's reference manual and got regarding the RCU_CTL register. Then i have written a demo code.

Code

#include "gd32vf103.h"

Int main()
{
RCU_CTL|=(1<<16);// external Crystal turn on
While(RCU_CTL & (1<<17) != 0x00020000);// checking the external crystal turn on successful.

RCU_CTL|=(1<<16);// external Crystal turn off
While(RCU_CTL & (1<<17) == 0x00020000);// checking the external crystal turn off successful

return 0;
}

Here turn on working fine. But when code enter turn off checki it's not exit. So the status of external clock is enable.

Such as when i was searching this one i saw "system init" function definition inside of one of the gd32 firmware library file. It's enable internal oscillator like
RCU_CTL|=0x1;
Then it's not checking the status of oscillator with bit number 2.

So the RCU_CTL register showing bit number 2 for internal oscillator status and bit number 17 for external oscillator status.

All of you if you hqve any idea about this region pls help me. I'm still stucking?
.
If you have the gd32 related board could you pls check it for me?

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

0 participants