Adjust RTC frequency to 32786 Hz

This commit is contained in:
Rodrigo Arias 2024-09-04 11:46:18 +02:00
parent 158e232520
commit 272fd211b2
2 changed files with 21 additions and 2 deletions

View File

@ -3897,3 +3897,20 @@ Wrote a small tool `plictool` to dump the state of the PLIC:
Interestingly, the auxiliar UART interrupts don't seem to be working very well.
Also, is there another source 33 enabled?
I have also noticed that the clock is running with the wrong frequency.
Everything is about twice as slow. For example, `sleep 1` takes 2 seconds.
So I assume the kernel thinks the clock goes faster than it actually does.
The timer is at 50 KHz:
timebase-frequency = <50000>; /* 50 kHz */
So, the frequency of this "clock" is done by using the "general" clock which
goes at 50 MHz, and then using a simple counter that counts up to 1525, so the
frequency is:
32786.88524590164 Hz
Assuming that it actually works well. Let's try that and see if we can have a
more realistic reading for the CLINT interrupt frequency.

View File

@ -16,8 +16,10 @@
cpus {
#address-cells = <1>;
#size-cells = <0>;
/* Timer */
timebase-frequency = <50000>; /* 50 kHz */
// The RTC timer is clocked at the CPU frequency / 1525, so
// around 32786.88 Hz
timebase-frequency = <32786>;
CPU0: cpu@0 {
clock-frequency = <50000000>; /* 50 MHz */
device_type = "cpu";