# Adding Real Time Clock to Rpi4 with Rocky 9.3

**URL:** <https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445>\
**Category:** Special Interest Groups\
**Created:** [January 10, 2024, 7:43pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445 "2024-01-10T19:43:00Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jross\_mt](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jross\_mt](https://forums.rockylinux.org/u/jross_mt)\
**Post date:** [January 10, 2024, 7:43pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/1 "2024-01-10T19:43:00Z")

</div>

My Rpi4 / Rock 9.3 boots up with the date set to Aug 21, 2023. It doesn’t take long for chronyd to set the clock but in the meantime logs are using the wrong date.

I bought an Adafruit PCF8523 RTC that just pops on the GPIO bus. Unfortunately, all of the docs/tutorials I can find for this clock assume that the Pi4 is running raspian and to use raspi-config to enable the i2c bus.

How would I do this with Rocky 9?

Thanks!  
Jeff Ross

---

<div class="post-metadata">

**Author:** ![Sherif](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sherif/32/42_2.png) [@Sherif](https://forums.rockylinux.org/u/Sherif)\
**Post date:** [January 10, 2024, 11:31pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/2 "2024-01-10T23:31:58Z")

</div>

I haven’t tested this but you can create config.txt if doesn’t exists already, more info here:

[https://forums.raspberrypi.com/viewtopic.php?f=117&t=208748](https://forums.raspberrypi.com/viewtopic.php?f=117&t=208748)

and

> **[Raspberry Pi Documentation - The config.txt file](https://www.raspberrypi.com/documentation/computers/config_txt.html#gpio-control)**
>
> The official documentation for Raspberry Pi computers and microcontrollers

---

<div class="post-metadata">

**Author:** ![jross\_mt](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jross\_mt](https://forums.rockylinux.org/u/jross_mt)\
**Post date:** [January 11, 2024, 12:04am UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/3 "2024-01-11T00:04:46Z")

</div>

Thanks for the links!

I guess the trick is going to be figuring out what values the 6 pins used by the RTC module need to be set.

So far I haven’t seen any low level info covering this. What I am finding is “import these python3 modules and set the time”.

What I see in reality is that those python scripts don’t even see the RTC module on the GPIO bus so that’s why I asked about enabling that bus as raspi-config would do. I _do_ have a 3B+ still on Ubuntu so maybe I can take a peek at that and glean some information.

Thanks again!

Jeff

---

<div class="post-metadata">

**Author:** ![Sherif](https://sea2.discourse-cdn.com/flex020/user_avatar/forums.rockylinux.org/sherif/32/42_2.png) [@Sherif](https://forums.rockylinux.org/u/Sherif)\
**Post date:** [January 11, 2024, 2:32pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/4 "2024-01-11T14:32:13Z")

</div>

No problem, keep us posted!

---

<div class="post-metadata">

**Author:** ![jross\_mt](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jross\_mt](https://forums.rockylinux.org/u/jross_mt)\
**Post date:** [January 11, 2024, 3:31pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/5 "2024-01-11T15:31:54Z")

</div>

I found this on reddit:

[https://www.reddit.com/r/RockyLinux/comments/11ys7bf/how\_to\_enable\_i2c\_on\_rpi4/](https://www.reddit.com/r/RockyLinux/comments/11ys7bf/how_to_enable_i2c_on_rpi4/)

```auto
jross@rpi4:~$ sudo i2cdetect -y 1
     0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --                         

So at least I can see the i2c now!

Jeff

```

---

<div class="post-metadata">

**Author:** ![jross\_mt](https://avatars.discourse-cdn.com/v4/letter/j/a698b9/32.png) [@jross\_mt](https://forums.rockylinux.org/u/jross_mt)\
**Post date:** [January 11, 2024, 8:53pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/6 "2024-01-11T20:53:11Z")

</div>

Unfortunately, that’s all the farther I’ve gotten. The rpm mentioned in the reddit thread adds sections to /boot/config.txt like this:

```auto
# Start managed by rpi4-i2c-userspace rpm
dtparam=i2c_arm=on
i2c-bcm2708
# End managed by rpi4-i2c-userspace rpm

# Start managed by rpi4-i2c-userspace-i2c1 rpm
dtparam=i2c1=on
# End managed by rpi4-i2c-userspace-i2c1 rpm

```

Rebooting to enable that does nothing that I can see. i2cdetect -y 1 still shows a 68 instead of a UU to show that the clock is working.

hwclock finds no clock:

```auto
jross@rpi4:~$ sudo hwclock --verbose -r
hwclock from util-linux 2.37.4
System Time: 1705006319.086912
Trying to open: /dev/rtc0
Trying to open: /dev/rtc
Trying to open: /dev/misc/rtc
No usable clock interface found.
hwclock: Cannot access the Hardware Clock via any known method.

```

So I’m stopped for now unless someone has a clue by four to help me out 😉

Jeff

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex020/uploads/rockylinux/original/1X/91b7219eec10e30013422e4df76c1d898711a5d5.svg) [@system](https://forums.rockylinux.org/u/system)\
**Post date:** [March 11, 2024, 8:53pm UTC](https://forums.rockylinux.org/t/adding-real-time-clock-to-rpi4-with-rocky-9-3/12445/7 "2024-03-11T20:53:36Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
