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

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.


#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
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?

Hi Shamseer,
Greetings of the day!
Did you find any solution to the problem? I am also facing the same issue. I enabled the HXTAL bit in RCU_CTL & SCS bit in RCU_CFG0 for external crystal but it is not reflected in the SCSS bit in RCU_CFG0. If you get it resolved please post here. I have just posted my code in this forum,

Hi shamseer,
I dont know C but have the following doubt in your code.
shouldnt you be shifting a 0 to the RCU_CTL bit 17 and shift a 1 to bit 0 to switch from HXTAL to IRC8.