I believe I finally solved it.
Seem I changed the overlay a little too much, it should still say it is
"maxim,ds3221" as compatible. I did not think that line was interpreted.
Hence
extrtc: ds3231@68 {
/* compatible = "micro-crystal,rv3028"; */
compatible = "maxim,ds3231";
reg = <0x52>;
};
now works
rtc0 rtc1 and rtc are created. System time is updated from rtc0.
I still have to confirm rtc0 is updated from network time.
Thanks Robert for putting me on the right track.
torsdag 11 februari 2021 kl. 12:59:59 UTC+1 skrev Johan Ingvast:
> Thanks Robert for suggestion
>
> I did the editing as you proposed, kernel finds it but still does not use
> it as I expected.
>
> Details follow.
>
> I did edit them like this
> extrtc: ds3231@68 {
> compatible = "micro-crystal,rv3028";
> reg = <0x52>;
> };
> and change the overlay name in fragment0.
>
> Renamed the file to BB-I2C2-RTC-RV3028.dts
> Compiled, installed and included the line
> dtb_overlay=/lib/firmware/BB-I2C2-RTC-RV3028.dtbo
> in /boot/uEnv.txt
>
> After reboot there is no /dev/rtc0 created, neither the /dev/rtc link
> Some filtered results from
> $ dmesg
> [ 0.000798] timer_probe: no matching timers found
> [ 1.373919] omap_rtc 44e3e000.rtc: registered as rtc1
> [ 1.663955] PM: rtc0 not available
> [ 1.665284] PM: rtc0 not available
> [ 1.666533] hctosys: unable to open rtc device (rtc0)
> [ 1.933272] PM: rtc0 not available
>
> So the overlay is processed since the renumbering of the rtc (built in
> becomes rtc1) work.
> But the new rtc is not installed in kernel
>
> It is listed in /proc/device-tree/chosen/overlay.
>
> The unit seem to be noticed in /sys/class/i2c-dev/i2c-2/device/2-0052
> The file name inside returns the right name
> $ cat name
> rv3028
>
>
> But it is not occupied by the kernel since I can still do
> $ i2cdetect -y 2 0x52 0x0
> 22
>
> So any clues how I can get the kernel to use it?
>
> /johan
>
>
>
> lördag 6 februari 2021 kl. 05:51:08 UTC+1 skrev RobertCNelson:
>
>> On Fri, Feb 5, 2021 at 4:39 AM Johan Ingvast <[email protected]> wrote:
>> >
>> > Hi
>> >
>> > I have a RTC rv3028 on my system. It sits on i2c-2 at address 0x52.
>> > I want it to update the system time with a correct time at each start
>> of system regardless contact to internet time or not. I have no need of the
>> alarm functions.
>> >
>> > RV3028 is really low power and claim to be accurate.
>> >
>> > I have checked it working using i2cset and i2cget.
>> >
>> > Now I want to have the system use it instead of the one not backed up
>> battery.
>> >
>> > I found out that the most important registers of rv3028 are at the same
>> place as for the ds3231 that the kernel supports. This made me try
>> >
>> > $ echo ds3231 0x52 > /sys/class/i2c-dev/i2c-2/device/new_device
>> >
>> > and what I hoped happened. The /dev/rtc1 was created and responded with
>> the set time from
>> > $ hwclock -r -f /dev/rtc1
>> >
>> > But I still have some steps to take to make everything work. The system
>> should use the clock as /dev/rtc and use it at startup, correct the time
>> and so forth.
>> >
>> > I thought of using overlays, there is an overlay for ds3031 which codes
>> for another i2c address.
>> >
>> > Is it possible/enough to change bus and address of an existing ds3031
>> overlay like
>> https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-RTC-DS3231.dts
>>
>> to make it work for the rv3028?
>>
>> Correct, just update these 3 lines and it should just work..
>>
>>
>> https://github.com/beagleboard/bb.org-overlays/blob/master/src/arm/BB-I2C2-RTC-DS3231.dts#L81-L84
>>
>>
>> The rest is more informal that get's reported to userspace for your
>> sanity to see if it loaded..
>>
>> Regards,
>>
>> --
>> Robert Nelson
>> https://rcn-ee.com/
>>
>
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/beagleboard/066d5fe4-3fab-4870-b806-32e893800f33n%40googlegroups.com.