Hi,
In my board, RTC is clocked with 32.768 khz crystal with following settings:
/* Disable interrupt */
csrw mie, 0;
(gdb) x 0x10000040 => RTC config register
0x10000040: 0x1000100f => scale 15 and enabled
and hoping to read the rtcs
ticking up for every 1sec.
li t0, AON_BASE;
/* init rtc high & low to 0 */
sw zero, RTC_COUNT_HI_OFST(t0);
sw zero, RTC_COUNT_LO_OFST(t0);
li t1, 0x100F; /* Enable and set scale F */
sw t1, RTC_CFG_OFST(t0);
/* read rtccounthi (offset 0x04C) - high bits counter */
lw t2, RTC_COUNT_HI_OFST(t0);
/* read rtccountlo (offset 0x048) - low bits counter */
lw t3, RTC_COUNT_LO_OFST(t0);
I can read the high and low count as below & it keeps ticking up.
(gdb) x 0x10000048
0x10000048: 0x000a1009 => lower 32 bits
(gdb) x 0x1000004C
0x1000004c: 0x00000000=> upper 16 bits
(gdb) x 0x1000004C
0x1000004c: 0x00000000
(gdb) x 0x10000048
0x10000048: 0x004faac6
The FE310 manual mentions that the value of rtcs is memory-mapped and can be read as a single 32-bit register over the AON TileLink bus.
Now, when tried to read from 0x10000050 (mmap addr to rtcs), its incrementing quickly. I am expecting it to increment by 1 every sec. But its not.
Within few seconds on my computer, it hit
(gdb) x 0x10000050
0x10000050: 0x0000023f
I did NOT change clock settings, with default power up, when rtc is enabled, assuming would be clocked with 32.768 ext crystal.
Here are the lf clk settings:
(gdb) x 0x10000070
0x10000070: 0xc0100004 => lfosc enabled and ready, with divisor value
(gdb) x 0x1000007C
0x1000007c: 0x00000000 => Here the lfextclk_sel is also 0, lfextclk_mux_status is also 0.
Does this mean lfosc is used to clock rtc?