Nuclei-Software / nuclei-sdk

Nuclei RISC-V Software Development Kit
https://doc.nucleisys.com/nuclei_sdk
Apache License 2.0
117 stars 50 forks source link

RCCV vs. adding clock pulses #41

Closed gsauthof closed 10 months ago

gsauthof commented 2 years ago

The GD32CVF103 User Manual (1.3) specifies the RTC clock calibration value (RCCV) as:

RTC clock calibration value The value indicates how many clock pulses are ignored or added every 2^20 RTC clock pulses.

(Section 4.4.2, page 59, emphasis mine)

After implementing a calibration procedure I don't think that the second (emphasized) part is true. That means it looks like the RCCV can only be used to ignore clock pulses.

(In which case, when having a clock that is too slow, one would need to decrement the prescaler and calibrate from a (then) too fast clock.)

My tests show that RCCV isn't interpreted as signed (two's complement) value.

And I can't find any other field that would work as a sign bit, either. I mean, e.g. in contrast to the GD32F1x0 where the RTC_HRFC register contains the CMSK (Calibration mask number) and FREQI fields.

Can you clarify this point?

fanghuaqi commented 2 years ago

Sorry, we are not the chip designer of GD32VF103, so the RTC clock peripheral inside it, I am not familar with it.