Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Archimedes Gaviola
Hi,

Good day!

How to enable DS3231 real-time clock in Raspberry Pi 4B? In Raspberry Pi 3B
these 2 lines below in the config.txt works.

dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231

and resolve the dmesg messages below.

WARNING: clock lost 8 days
WARNING: CHECK AND RESET THE DATE!

This system is not always connected to the Internet.

Thanks and best regards,
Archimedes


Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Mark Kettenis
> From: Archimedes Gaviola 
> Date: Sun, 23 Aug 2020 22:36:49 +0800
> 
> Hi,
> 
> Good day!
> 
> How to enable DS3231 real-time clock in Raspberry Pi 4B? In Raspberry Pi 3B
> these 2 lines below in the config.txt works.
> 
> dtparam=i2c_arm=on
> dtoverlay=i2c-rtc,ds3231
> 
> and resolve the dmesg messages below.
> 
> WARNING: clock lost 8 days
> WARNING: CHECK AND RESET THE DATE!
> 
> This system is not always connected to the Internet.

I think only the dtoverlay line is needed.  But yes, this works as
long as the i2c-rtc overlay file is present in the overlays
subdirectory of the firmware partition of your boot medium.

Many of the other chip types supported by the i2c-rtc overlay are
supported by OpenBSD as well.  Feel free to send me any modules with
unsupported chips, and I'll make them work.

Cheers,

Mark



Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Archimedes Gaviola
On Sun, Aug 23, 2020 at 10:50 PM Mark Kettenis 
wrote:

> > From: Archimedes Gaviola 
> > Date: Sun, 23 Aug 2020 22:36:49 +0800
> >
> > Hi,
> >
> > Good day!
> >
> > How to enable DS3231 real-time clock in Raspberry Pi 4B? In Raspberry Pi
> 3B
> > these 2 lines below in the config.txt works.
> >
> > dtparam=i2c_arm=on
> > dtoverlay=i2c-rtc,ds3231
> >
> > and resolve the dmesg messages below.
> >
> > WARNING: clock lost 8 days
> > WARNING: CHECK AND RESET THE DATE!
> >
> > This system is not always connected to the Internet.
>
> I think only the dtoverlay line is needed.  But yes, this works as
> long as the i2c-rtc overlay file is present in the overlays
> subdirectory of the firmware partition of your boot medium.
>
> Many of the other chip types supported by the i2c-rtc overlay are
> supported by OpenBSD as well.  Feel free to send me any modules with
> unsupported chips, and I'll make them work.
>
> Cheers,
>
> Mark
>

 Hi Mark,

Thanks for your prompt response! I tried it now by pulling-out dtbo file
here

https://github.com/raspberrypi/firmware/blob/master/boot/overlays/i2c-rtc.dtbo

and put it in the overlays directory and then update the system time and
date to current using NTP via $ rdate ntp.pool.org and then reboot. The
system will still show up

WARNING: clock lost 8 days
WARNING: CHECK AND RESET THE DATE!

In Raspberry Pi 3B, it showed-up something "i2c at dsxrtc"  in the dmesg.
This time with Raspberry Pi 4B I had not seen any indicator.

By the way, this is my RTC module
https://shopee.ph/DS3231-Mini-RTC-Module-i.18252381.315148783.

Thanks and best regards,
Archimedes


Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Archimedes Gaviola
Correction, it's -> $ rdate pool.ntp.org

On Mon, Aug 24, 2020 at 1:04 AM Archimedes Gaviola <
archimedes.gavi...@gmail.com> wrote:

>
>
> On Sun, Aug 23, 2020 at 10:50 PM Mark Kettenis 
> wrote:
>
>> > From: Archimedes Gaviola 
>> > Date: Sun, 23 Aug 2020 22:36:49 +0800
>> >
>> > Hi,
>> >
>> > Good day!
>> >
>> > How to enable DS3231 real-time clock in Raspberry Pi 4B? In Raspberry
>> Pi 3B
>> > these 2 lines below in the config.txt works.
>> >
>> > dtparam=i2c_arm=on
>> > dtoverlay=i2c-rtc,ds3231
>> >
>> > and resolve the dmesg messages below.
>> >
>> > WARNING: clock lost 8 days
>> > WARNING: CHECK AND RESET THE DATE!
>> >
>> > This system is not always connected to the Internet.
>>
>> I think only the dtoverlay line is needed.  But yes, this works as
>> long as the i2c-rtc overlay file is present in the overlays
>> subdirectory of the firmware partition of your boot medium.
>>
>> Many of the other chip types supported by the i2c-rtc overlay are
>> supported by OpenBSD as well.  Feel free to send me any modules with
>> unsupported chips, and I'll make them work.
>>
>> Cheers,
>>
>> Mark
>>
>
>  Hi Mark,
>
> Thanks for your prompt response! I tried it now by pulling-out dtbo file
> here
>
>
> https://github.com/raspberrypi/firmware/blob/master/boot/overlays/i2c-rtc.dtbo
>
> and put it in the overlays directory and then update the system time and
> date to current using NTP via $ rdate ntp.pool.org and then reboot. The
> system will still show up
>
> WARNING: clock lost 8 days
> WARNING: CHECK AND RESET THE DATE!
>
> In Raspberry Pi 3B, it showed-up something "i2c at dsxrtc"  in the dmesg.
> This time with Raspberry Pi 4B I had not seen any indicator.
>
> By the way, this is my RTC module
> https://shopee.ph/DS3231-Mini-RTC-Module-i.18252381.315148783.
>
> Thanks and best regards,
> Archimedes
>
>


Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Mark Kettenis
> From: Archimedes Gaviola 
> Date: Mon, 24 Aug 2020 01:04:23 +0800
> 
> On Sun, Aug 23, 2020 at 10:50 PM Mark Kettenis 
> wrote:
> 
>  > From: Archimedes Gaviola 
>  > Date: Sun, 23 Aug 2020 22:36:49 +0800
>  > 
>  > Hi,
>  > 
>  > Good day!
>  > 
>  > How to enable DS3231 real-time clock in Raspberry Pi 4B? In Raspberry
>  Pi 3B
>  > these 2 lines below in the config.txt works.
>  > 
>  > dtparam=i2c_arm=on
>  > dtoverlay=i2c-rtc,ds3231
>  > 
>  > and resolve the dmesg messages below.
>  > 
>  > WARNING: clock lost 8 days
>  > WARNING: CHECK AND RESET THE DATE!
>  > 
>  > This system is not always connected to the Internet.
> 
>  I think only the dtoverlay line is needed.  But yes, this works as
>  long as the i2c-rtc overlay file is present in the overlays
>  subdirectory of the firmware partition of your boot medium.
> 
>  Many of the other chip types supported by the i2c-rtc overlay are
>  supported by OpenBSD as well.  Feel free to send me any modules with
>  unsupported chips, and I'll make them work.
> 
>  Cheers,
> 
>  Mark
> 
>  Hi Mark,
> 
> Thanks for your prompt response! I tried it now by pulling-out dtbo file here
> 
> https://github.com/raspberrypi/firmware/blob/master/boot/overlays/i2c-rtc.dtbo
> 
> 
> and put it in the overlays directory and then update the system time and date
> to current using NTP via $ rdate ntp.pool.org and then reboot. The system
> will still show up
> 
> WARNING: clock lost 8 days
> WARNING: CHECK AND RESET THE DATE!

Without showing the complete dmesg we can't help you.



Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Archimedes Gaviola
On Mon, Aug 24, 2020 at 1:10 AM Mark Kettenis 
wrote:

> > From: Archimedes Gaviola 
> > Date: Mon, 24 Aug 2020 01:04:23 +0800
> >
> > On Sun, Aug 23, 2020 at 10:50 PM Mark Kettenis 
> > wrote:
> >
> >  > From: Archimedes Gaviola 
> >  > Date: Sun, 23 Aug 2020 22:36:49 +0800
> >  >
> >  > Hi,
> >  >
> >  > Good day!
> >  >
> >  > How to enable DS3231 real-time clock in Raspberry Pi 4B? In Raspberry
> >  Pi 3B
> >  > these 2 lines below in the config.txt works.
> >  >
> >  > dtparam=i2c_arm=on
> >  > dtoverlay=i2c-rtc,ds3231
> >  >
> >  > and resolve the dmesg messages below.
> >  >
> >  > WARNING: clock lost 8 days
> >  > WARNING: CHECK AND RESET THE DATE!
> >  >
> >  > This system is not always connected to the Internet.
> >
> >  I think only the dtoverlay line is needed.  But yes, this works as
> >  long as the i2c-rtc overlay file is present in the overlays
> >  subdirectory of the firmware partition of your boot medium.
> >
> >  Many of the other chip types supported by the i2c-rtc overlay are
> >  supported by OpenBSD as well.  Feel free to send me any modules with
> >  unsupported chips, and I'll make them work.
> >
> >  Cheers,
> >
> >  Mark
> >
> >  Hi Mark,
> >
> > Thanks for your prompt response! I tried it now by pulling-out dtbo file
> here
> >
> >
> https://github.com/raspberrypi/firmware/blob/master/boot/overlays/i2c-rtc.dtbo
> >
> >
> > and put it in the overlays directory and then update the system time and
> date
> > to current using NTP via $ rdate ntp.pool.org and then reboot. The
> system
> > will still show up
> >
> > WARNING: clock lost 8 days
> > WARNING: CHECK AND RESET THE DATE!
>
> Without showing the complete dmesg we can't help you.
>
>
Hi Mark,

Please see attached dmesg.

Thanks and best regards,
Archimedes
openbsd67rpi4b# dmesg
OpenBSD 6.7-current (GENERIC.MP) #775: Wed Aug 19 00:17:01 MDT 2020
dera...@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP
real mem  = 1996668928 (1904MB)
avail mem = 1903022080 (1814MB)
random: good seed from bootblocks
mainbus0 at root: ACPI
psci0 at mainbus0: PSCI 1.1, SMCCC 1.2
cpu0 at mainbus0 mpidr 0: ARM Cortex-A72 r0p3
cpu0: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu0: 1024KB 64b/line 16-way L2 cache
cpu1 at mainbus0 mpidr 1: ARM Cortex-A72 r0p3
cpu1: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu1: 1024KB 64b/line 16-way L2 cache
cpu2 at mainbus0 mpidr 2: ARM Cortex-A72 r0p3
cpu2: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu2: 1024KB 64b/line 16-way L2 cache
cpu3 at mainbus0 mpidr 3: ARM Cortex-A72 r0p3
cpu3: 48KB 64b/line 3-way L1 PIPT I-cache, 32KB 64b/line 2-way L1 D-cache
cpu3: 1024KB 64b/line 16-way L2 cache
efi0 at mainbus0: UEFI 2.7
efi0: https://github.com/pftf/RPi4 rev 0x1
smbios0 at efi0: SMBIOS 3.3.0
smbios0: vendor https://github.com/pftf/RPi4 version "UEFI Firmware v1.19" date 
08/13/2020
smbios0: Raspberry Pi Foundation Raspberry Pi 4 Model B
apm0 at mainbus0
ampintc0 at mainbus0 nirq 256, ncpu 4 ipi: 0, 1: "interrupt-controller"
agtimer0 at mainbus0: tick rate 54000 KHz
acpi0 at mainbus0: ACPI 6.3
acpi0: sleep states
acpi0: tables DSDT FACP CSRT DBG2 GTDT APIC PPTT BGRT
acpi0: wakeup devices
"BCM2849" at acpi0 not configured
"BCM2835" at acpi0 not configured
"BCM2854" at acpi0 not configured
"ACPI0004" at acpi0 not configured
xhci0 at acpi0 XHC0 addr 0x6/0x1000 irq 175, xHCI 1.0
usb0 at xhci0: USB revision 3.0
uhub0 at usb0 configuration 1 interface 0 "Generic xHCI root hub" rev 3.00/1.00 
addr 1
"ACPI0007" at acpi0 not configured
"ACPI0007" at acpi0 not configured
"ACPI0007" at acpi0 not configured
"ACPI0007" at acpi0 not configured
"ACPI0004" at acpi0 not configured
"BCM2848" at acpi0 not configured
"BCM2850" at acpi0 not configured
"BCM2856" at acpi0 not configured
"BCM2845" at acpi0 not configured
"BCM2841" at acpi0 not configured
"BCM2841" at acpi0 not configured
"BCM2838" at acpi0 not configured
"BCM2839" at acpi0 not configured
"BCM2844" at acpi0 not configured
pluart0 at acpi0 URT0 addr 0xfe201000/0x1000 irq 153
"BCM2836" at acpi0 not configured
"BCM2EA6" at acpi0 not configured
"MSFT8000" at acpi0 not configured
"BCM2847" at acpi0 not configured
"BCM2855" at acpi0 not configured
bse0 at acpi0 ETH0 addr 0xfd58/0x1 irq 189: address dc:a6:32:36:b6:70
brgphy0 at bse0 phy 1: BCM54210E 10/100/1000baseT PHY, rev. 2
simplefb0 at mainbus0: 1280x800, 32bpp
wsdisplay0 at simplefb0 mux 1: console (std, vt100 emulation)
wsdisplay0: screen 1-5 added (std, vt100 emulation)
uhub1 at uhub0 port 1 configuration 1 interface 0 "VIA Labs USB2.0 Hub" rev 
2.10/4.20 addr 2
umass0 at uhub1 port 1 configuration 1 interface 0 "Generic Mass Storage" rev 
2.00/1.01 addr 3
umass0: using SCSI over Bulk-Only
scsibus0 at umass0: 2 targets, initiator 0
sd0 at scsibus0 targ 1 lun 0:  removable
sd0: 14765MB, 512 bytes/sector, 30238720 sectors
uhidev0 at uhub1 port 4 configuration 1 interface 0 "A4Tech USB Keyboard" rev 
2.00/1.05 addr 4

Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Mark Kettenis
> From: Archimedes Gaviola 
> Date: Mon, 24 Aug 2020 01:18:46 +0800
> 
> On Mon, Aug 24, 2020 at 1:10 AM Mark Kettenis 
> wrote:
> 
>  > From: Archimedes Gaviola 
>  > Date: Mon, 24 Aug 2020 01:04:23 +0800
>  > 
>  > On Sun, Aug 23, 2020 at 10:50 PM Mark Kettenis
>  
>  > wrote:
>  > 
>  >  > From: Archimedes Gaviola 
>  >  > Date: Sun, 23 Aug 2020 22:36:49 +0800
>  >  > 
>  >  > Hi,
>  >  > 
>  >  > Good day!
>  >  > 
>  >  > How to enable DS3231 real-time clock in Raspberry Pi 4B? In
>  Raspberry
>  >  Pi 3B
>  >  > these 2 lines below in the config.txt works.
>  >  > 
>  >  > dtparam=i2c_arm=on
>  >  > dtoverlay=i2c-rtc,ds3231
>  >  > 
>  >  > and resolve the dmesg messages below.
>  >  > 
>  >  > WARNING: clock lost 8 days
>  >  > WARNING: CHECK AND RESET THE DATE!
>  >  > 
>  >  > This system is not always connected to the Internet.
>  > 
>  >  I think only the dtoverlay line is needed.  But yes, this works as
>  >  long as the i2c-rtc overlay file is present in the overlays
>  >  subdirectory of the firmware partition of your boot medium.
>  > 
>  >  Many of the other chip types supported by the i2c-rtc overlay are
>  >  supported by OpenBSD as well.  Feel free to send me any modules with
>  >  unsupported chips, and I'll make them work.
>  > 
>  >  Cheers,
>  > 
>  >  Mark
>  > 
>  >  Hi Mark,
>  > 
>  > Thanks for your prompt response! I tried it now by pulling-out dtbo
>  file here
>  > 
>  >
>  
> https://github.com/raspberrypi/firmware/blob/master/boot/overlays/i2c-rtc.dtbo
>  
>  > 
>  > 
>  > and put it in the overlays directory and then update the system time
>  and date
>  > to current using NTP via $ rdate ntp.pool.org and then reboot. The
>  system
>  > will still show up
>  > 
>  > WARNING: clock lost 8 days
>  > WARNING: CHECK AND RESET THE DATE!
> 
>  Without showing the complete dmesg we can't help you.
> 
> Hi Mark,
> 
> Please see attached dmesg.
> 
> Thanks and best regards,
> Archimedes 
> 
> 
> openbsd67rpi4b# dmesg
> OpenBSD 6.7-current (GENERIC.MP) #775: Wed Aug 19 00:17:01 MDT 2020
> dera...@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP
> real mem  = 1996668928 (1904MB)
> avail mem = 1903022080 (1814MB)
> random: good seed from bootblocks
> mainbus0 at root: ACPI

You have to switch to DT (device tree) mode to be able to use the RTC.

Cheers,

Mark



Re: Raspberry Pi 4B DS3231 real-time clock

2020-08-23 Thread Archimedes Gaviola
>
> > openbsd67rpi4b# dmesg
> > OpenBSD 6.7-current (GENERIC.MP) #775: Wed Aug 19 00:17:01 MDT 2020
> > dera...@arm64.openbsd.org:/usr/src/sys/arch/arm64/compile/GENERIC.MP
> > real mem  = 1996668928 (1904MB)
> > avail mem = 1903022080 (1814MB)
> > random: good seed from bootblocks
> > mainbus0 at root: ACPI
>
> You have to switch to DT (device tree) mode to be able to use the RTC.
>
> Cheers,
>
> Mark
>

Hi Mark,

How to accomplish switching to DT mode because I haven't tried it yet and
while looking at Raspberry Pi forums and mailing lists those 2
config.txt parameters are only described.

Thanks and best regards,
Archimedes