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

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

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.

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.

1 Like

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.

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,

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.

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.

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

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.