I am running on a Raspberry Pi Zero 2 W. The software version I am running is:
I have a DS3231 on the I2C bus and enabled the driver. I believe the Real Time Clock is working.
With the DS3231 you can set an alarm that will raise one of it's pins at a predetermined real time.Ultimately, I would like for this DS3231 alarm to get set to some far off future date. Like an hour or so. Then have the pi Zero shutdown and power down. Then when the alarm goes, off external circuitry will re-apply power and the CPU will boot up. For now I am just trying to monitor the DS3231 pin to see if I can control it.
I searched on the web and what I find is that you can send a date to /sys/class/rtc/rtc0/wakealarm:
But I can't seem to find the wakealarm file:
I am assuming that is old information.
I have already written code that accesses other devices on the I2C bus from user space using the /dev/i2c-X device. So, I can code something to access the DS33231's alarm register and load it. If there is already a defined interface to access the alarm on the DS3231 I would rather use that.
Is there a standard way to set the DS3231's alarm without using the /dev/i2c-X interface ?
I am using C++.
If I have to use the /dev/i2c-X interface to access the DS3231 device's alarm is it a problem that there is an existing device driver that is accessing the real time clock portion of the chip? Do I have to worry about conflicts with that driver when using the /dev/i2c-X interface?
Thanks
Chris
Code:
$ cat /etc/os-releasePRETTY_NAME="Debian GNU/Linux 12 (bookworm)"NAME="Debian GNU/Linux"VERSION_ID="12"VERSION="12 (bookworm)"VERSION_CODENAME=bookwormID=debianHOME_URL="https://www.debian.org/"SUPPORT_URL="https://www.debian.org/support"BUG_REPORT_URL="https://bugs.debian.org/"With the DS3231 you can set an alarm that will raise one of it's pins at a predetermined real time.Ultimately, I would like for this DS3231 alarm to get set to some far off future date. Like an hour or so. Then have the pi Zero shutdown and power down. Then when the alarm goes, off external circuitry will re-apply power and the CPU will boot up. For now I am just trying to monitor the DS3231 pin to see if I can control it.
I searched on the web and what I find is that you can send a date to /sys/class/rtc/rtc0/wakealarm:
Code:
$ echo $(date +%s -d '+ 10 minutes') > /sys/class/rtc/rtc0/wakealarmCode:
$ pwd/sys/class/rtc/rtc0$ lsdate dev device hctosys max_user_freq name power since_epoch subsystem time ueventI have already written code that accesses other devices on the I2C bus from user space using the /dev/i2c-X device. So, I can code something to access the DS33231's alarm register and load it. If there is already a defined interface to access the alarm on the DS3231 I would rather use that.
Is there a standard way to set the DS3231's alarm without using the /dev/i2c-X interface ?
I am using C++.
If I have to use the /dev/i2c-X interface to access the DS3231 device's alarm is it a problem that there is an existing device driver that is accessing the real time clock portion of the chip? Do I have to worry about conflicts with that driver when using the /dev/i2c-X interface?
Thanks
Chris
Statistics: Posted by chriskot870 — Fri Dec 12, 2025 11:07 pm