# Pi3 B+ , HyperPixel 4" , DS3231 timer , Debian

**URL:** <https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492>\
**Category:** Support\
**Created:** [May 8, 2019, 3:29am UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492 "2019-05-08T03:29:16Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![WilsonB](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@WilsonB](https://forums.pimoroni.com/u/WilsonB)\
**Post date:** [May 8, 2019, 3:29am UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/1 "2019-05-08T03:29:16Z")

</div>

Pi3 B+ , HyperPixel 4" , Debian distro, DS3231 timer connected through the I2C interface connection on LCD.  
LCD works…

on LCD— on DS3231 (clock module)  
GND ---- negative (-)  
SCL ---- C  
SDA ---- D  
3v3 ---- Positive

After I reroute it;  
sudo ln -s /dev/i2c-3 /dev/i2c-1

It shows in  
root@kali:~# 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: – -- – -- – -- – --

But when I use hwclock, it does not see it;  
sudo hwclock -r  
hwclock: Cannot access the Hardware Clock via any known method.

## removed the fake clock

/etc/modules

i2c-dev  
i2c-bcm2708  
snd-bcm2835  
i2c-bcm2835  
rtc-ds1307

* * *

added in ;  
/boot/config.txt

dtoverlay=i2c-rtc,ds3231

* * *

Theoretically, couldn’t I just solder it direct to GPIO pins and have it set clock initially at boot , then ignore and then use pins for LCD there after?  
If I can’t get this going, I will just solder pins directly and figure out how to setclock at boot , then switch to LCD

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 8, 2019, 8:26am UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/2 "2019-05-08T08:26:02Z")

</div>

I have several DS3231’s in use here. Wired up the conventional way to the GPIO i2c. I follow this Adafruit guide to get mine working.

> **[Overview | Adding a Real Time Clock to Raspberry Pi | Adafruit Learning System](https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi)**
>
> Keep time at all times with a real time clock

I think I would temporarily connect it right to the GPIO without the Hyperpixel. Then get it working so you know its working.  
Then unplug the DS3231 and plug in the hyperpixel in and get that working.  
Then connect the DS3231 to the hyperpixel i2c header and see if you can get the DS3231 working again.  
Best guess is its the dtoverlay=i2c-rtc,ds3231 entry that might have to be changed to point to the alternatee i2c?

The 68 should change to a UU in i2c detect when you get it working, that means its under system control or something.

---

<div class="post-metadata">

**Author:** ![WilsonB](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@WilsonB](https://forums.pimoroni.com/u/WilsonB)\
**Post date:** [May 8, 2019, 4:39pm UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/3 "2019-05-08T16:39:39Z")

</div>

Thank you so much for the suggestions.  
Will try them.  
Have you used the I2C header on the LCD?

Do you think it’s easily possible to just keep the ds3231 directly connected to GPIO pins with LCD connected and have it working?  
The system should only need to read from the hwclock once to set time. If this was done at beginning of boot, then turn over all pins to LCD.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 8, 2019, 5:03pm UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/4 "2019-05-08T17:03:13Z")

</div>

I don’t own a Hyperpixel. Nice bit of kit but having all the GPIO pins used up kind of puts me off from wanting one.  
The i2c pins on the GPIO are repurposed / reassigned to another function, hooking the DS3231 up to them isn’t likely going to work. The pinout is here,

> **[Hyperpixel4 at Raspberry Pi GPIO Pinout](https://pinout.xyz/pinout/hyperpixel4#)**
>
> An 800x480 pixel 60FPS 4

Since i2c is a very common bus to be used is my guess why they added the header on the back of hyperpixel. I do believe its a software i2c though, not a dedicated hardware i2c like what’s on the Pi’s GPIO.  
Phil @gadgetoid may be able to tell what you need to do to get this working.

---

<div class="post-metadata">

**Author:** ![WilsonB](https://avatars.discourse-cdn.com/v4/letter/w/e8c25b/32.png) [@WilsonB](https://forums.pimoroni.com/u/WilsonB)\
**Post date:** [May 8, 2019, 8:43pm UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/5 "2019-05-08T20:43:24Z")

</div>

Thanks for your reply…

So I did some experimenting and turns out,  
Clock works great when config.txt has remarked out.  
#Turn on HyperPixel lcd  
#dtoverlay=hyperpixel4:rotate

and while LCD AND Clock connected, LCD works fine even with this enabled.

# This is to enable the DS3231 RTC clock

dtoverlay=i2c-rtc,ds3231

So, I have different configuration for a different purpose. To swap LCD and HDMI depending if HDMI is detected.  
Basicly , if hdmi is detected, then it renames and uses the HDMI config.txt file, if not detected then it uses the LCD config.txt  
So in this theory, setting clock from ds3231 asap and then using a config.txt that has Hyperpixel enabled in confi file should work.

---

<div class="post-metadata">

**Author:** ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)\
**Post date:** [May 8, 2019, 8:57pm UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/6 "2019-05-08T20:57:54Z")

</div>

Good luck. Please post back with how you make out success or fail, hopefully success. =)

---

<div class="post-metadata">

**Author:** ![Snargaloo](https://avatars.discourse-cdn.com/v4/letter/s/65b543/32.png) [@Snargaloo](https://forums.pimoroni.com/u/Snargaloo)\
**Post date:** [September 12, 2019, 1:48am UTC](https://forums.pimoroni.com/t/pi3-b-hyperpixel-4-ds3231-timer-debian/10492/7 "2019-09-12T01:48:09Z")

</div>

To enable DS3231 with Hyperpixel 4, you have to use a different dtoverlay.

dtoverlay=i2c-rtc,ds3231 will attempt to initialize the ds3231on the i2c1 interface. Hyperpixel 4 uses this interface and the ds3231 needs to be plugged into the alternate i2c interface on the back of display. This alternate i2c uses software i2c3 on BCM pins 10 and 11. To get this to work, add these lines to config.txt

dtparam=i2c\_arm=on  
dtparam=i2c3=on  
dtoverlay=i2c-rtc-gpio,ds3231,i2c\_gpio\_sda=10,i2c\_gpio\_scl=11

Note that scl ends in letter L and not number 1.
