Rtc can‘t work

I’m trying to write some bare metal code, and when I try to read the registers of the rtc device, I find that the values read and written are all 0. I tried to view the value of the corresponding address in uboot, but I couldn’t write it, nor could I read it.

As described in the register manual:
The default value of CFG-RTC is 8, but I didn’t see it.
Does the rtc device require any additional configuration before it can be used? Why can’t its address space be read or written?


In U-boot stage, cannot read or write RTC’s registers by the command “md“ and “mw” directly. maybe need to set the clock and enable RTC etc

1 Like

Did you see the RTC errata ?

1 Like

I would start exactly where @danny.xu advised, the JH7110 RTC does not have a clock configured and is not currently enabled during U-boot.

mzs@tick:~/src/risc-v/jh7110/VisionFive2/u-boot$ rgrep -i JH7110 * 2>/dev/null | grep -i RTC | awk -F':' '{print $1}' | sort -u

The following files would be where I would look as for how to configure the required clocks and enable the JH7110 RTC:

mzs@tock:~/src/risc-v/jh7110/VisionFive2/linux$ rgrep -i JH7110 * 2>/dev/null | grep -i RTC | awk -F':' '{print $1}' | sort -u

But there is also a second entry in the errata, where the workaround is to add an external RTC (Real-Time Clock) chip and a coin cell battery, because the JH-7110 RTC does not have a separate always on domain (AON), so it does not support the ability to continue timing after power down or restart. Which in my mind makes the RTC in the JH7110, far less useful. But it is still useful for tracking the date and time while the board is powered on.

1 Like