I've got a Raspberry Pi 4B (4GB) with a DS3231 RTC module. I can make the combo work with Ubuntu and RaspberryPI-OS. I'd like to try it with the plain-vanilla Debian from <https://raspi.debian.net/tested-images/> but I can't find instructions for activating the I2C and RTC hardware in that OS.
On Sunday, 16 April 2023 04:47:37 CEST Rick Thomas wrote:
I've got a Raspberry Pi 4B (4GB) with a DS3231 RTC module. I can
make the combo work with Ubuntu and RaspberryPI-OS. I'd like to
try it with the plain-vanilla Debian from <https://raspi.debian.net/tested-images/> but I can't find
instructions for activating the I2C and RTC hardware in that OS.
Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml in the kernel
source describes how one could use it ('compatible = "maxim,ds3231"'
for DS3231). I think you should make a DeviceTree Overlay, but I
don't know how to do that.
On Sunday, 16 April 2023 04:47:37 CEST Rick Thomas wrote:
I've got a Raspberry Pi 4B (4GB) with a DS3231 RTC module. I can make the >> combo work with Ubuntu and RaspberryPI-OS. I'd like to try it with the
plain-vanilla Debian from <https://raspi.debian.net/tested-images/> but I
can't find instructions for activating the I2C and RTC hardware in that OS.
Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml in the kernel source describes how one could use it ('compatible = "maxim,ds3231"' for DS3231).
I think you should make a DeviceTree Overlay, but I don't know how to do that.
ExecStart=/bin/sh -c "modprobe i2c_bcm2835 && modprobe i2c_bcm2708 && modprobe rtc_ds1307 && sleep 1 && echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device && /sbin/hwclock -s"
Am Sun, 16 Apr 2023 10:01:08 +0200
schrieb Diederik de Haas <didi.debian@cknow.org>:
On Sunday, 16 April 2023 04:47:37 CEST Rick Thomas wrote:
I've got a Raspberry Pi 4B (4GB) with a DS3231 RTC module. I can
make the combo work with Ubuntu and RaspberryPI-OS. I'd like to
try it with the plain-vanilla Debian from
<https://raspi.debian.net/tested-images/> but I can't find
instructions for activating the I2C and RTC hardware in that OS.
Documentation/devicetree/bindings/rtc/rtc-ds1307.yaml in the kernel
source describes how one could use it ('compatible = "maxim,ds3231"'
for DS3231). I think you should make a DeviceTree Overlay, but I
don't know how to do that.
I got this working with that systemd unit on a Rpi3 but should also
work on a RPi4. Maybe you need to adjust the modprobe sequence. I guess
the 2708 is 2835 on the Pi4.
cat /etc/systemd/system/hwclock-pi.service
[Unit]
Description=HWClock at the I2C Bus of the Raspberry pi
Before=basic.target
Conflicts=shutdown.target
DefaultDependencies=no
[Service]
Type=oneshot
ExecStart=/bin/sh -c "modprobe i2c_bcm2835 && modprobe i2c_bcm2708 && modprobe rtc_ds1307 && sleep 1 && echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device && /sbin/hwclock -s" ExecStop=/sbin/hwclock -w RemainAfterExit=yes
[Install]
WantedBy=basic.target
I found this in journalctl :
Apr 16 18:23:33 pi kernel: rtc-ds1307: probe of 1-0068 failed with error -121
Apr 16 18:23:33 pi kernel: i2c i2c-1: new_device: Instantiated device ds1307 at 0x68
Is rtc_ds1307 the wrong module for my DS3231 rtc hardware?
Hi.
On Sun, Apr 16, 2023 at 06:41:53PM -0700, Rick Thomas wrote:
I found this in journalctl :
Apr 16 18:23:33 pi kernel: rtc-ds1307: probe of 1-0068 failed with error -121
Apr 16 18:23:33 pi kernel: i2c i2c-1: new_device: Instantiated device ds1307 at 0x68
Is rtc_ds1307 the wrong module for my DS3231 rtc hardware?
No, because ds1307 kernel module should work with DS3231.
But the address of the device (0x68) on I2C bus could be different,
or the device is actually connected to another I2C bus (i.e. - not 1st).
Consider running i2cdetect to clarify things.
Reco
Sadly, when I do:
i2cdetect -l
I get nothing back. Leading me to conclude that there are no busses available.
Hi.
On Mon, Apr 17, 2023 at 02:48:44AM -0700, Rick Thomas wrote:
Sadly, when I do:
i2cdetect -l
I get nothing back. Leading me to conclude that there are no busses available.
"modprobe i2c-dev" should fix that.
Reco
ExecStart=/bin/sh -c "modprobe i2c_bcm2835 && modprobe i2c_bcm2708 && modprobe rtc_ds1307 && sleep 1 && echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device && /sbin/hwclock -s"
On Mon, Apr 17, 2023 at 02:48:44AM -0700, Rick Thomas wrote:
Sadly, when I do:
i2cdetect -l
I get nothing back. Leading me to conclude that there are no busses available.
"modprobe i2c-dev" should fix that.
On Mon, 2023-04-17 at 13:39 +0300, Reco wrote:
On Mon, Apr 17, 2023 at 02:48:44AM -0700, Rick Thomas wrote:
Sadly, when I do:
i2cdetect -l
I get nothing back. Leading me to conclude that there are no busses available.
"modprobe i2c-dev" should fix that.
This seems like a usability issue, so I have sent a patch that
adds a bunch of error messages in situations of silent failure:
https://lore.kernel.org/linux-i2c/20230418023248.250685-1-pabs3@bonedaddy.net/T/
On Sun, 2023-04-16 at 11:17 +0200, Georg Gast wrote:
ExecStart=/bin/sh -c "modprobe i2c_bcm2835 && modprobe i2c_bcm2708 &&
modprobe rtc_ds1307 && sleep 1 && echo ds1307 0x68 >
/sys/class/i2c-adapter/i2c-1/new_device && /sbin/hwclock -s"
I feel like there should be a better way to do this than manually doing
/sys changes? Is there no i2c command for wrapping /sys i2c changes?
--
bye,
pabs
https://wiki.debian.org/PaulWise
What would have been even greater is if the error messages include
references to some documentation that explained the problem and gave
some clues to the larger context in which the problem arose.
For example, I'd like to know why it chose bus3 rather than one of
the other busses (0,1,2,4)?
I'd also like to know what the various modules do and what kinds of parameters there are to influence the detailed behavior?
And where is the documentation for the magic writing into /sys ?
On Mon, 2023-04-17 at 22:21 -0700, Rick Thomas wrote:
What would have been even greater is if the error messages include
references to some documentation that explained the problem and gave
some clues to the larger context in which the problem arose.
The messages I sent that patch adding are for very simple issues;
"/proc not mounted", "/sys not mounted" and "i2c-dev not loaded" and
since they all have very simple solutions, I just added the commands
to fix them instead of pointers to documentation about each error.
Probably the i2c manual pages should get some links to the Linux kernel documentation and wiki for I2C. I'm unlikely to work on that though, hopefully someone else is willing to do that.
For example, I'd like to know why it chose bus3 rather than one of
the other busses (0,1,2,4)?
I expect that depends on the bus driver code for your device,
those do not seem to document their ordering though and it
looks like your particular i2c bus driver has no documentation.
https://www.kernel.org/doc/html/latest/i2c/busses/index.html
I'd also like to know what the various modules do and what kinds of
parameters there are to influence the detailed behavior?
Looks like the devices are defined by DeviceTree, ACPI, board files, dynamically by drivers for other devices, hardware probing or sysfs:
https://www.kernel.org/doc/html/latest/i2c/instantiating-devices.html
And where is the documentation for the magic writing into /sys ?
Seems to be here:
https://www.kernel.org/doc/html/latest/i2c/instantiating-devices.html#method-4-instantiate-from-user-space
https://www.kernel.org/doc/html/latest/i2c/i2c-sysfs.html
These may also be useful:
https://www.kernel.org/doc/html/latest/i2c/ https://archive.kernel.org/oldwiki/i2c.wiki.kernel.org/
PS: I am subscribed, no need to CC me, please respect Reply-To.
--
bye,
pabs
https://wiki.debian.org/PaulWise
Attachments:
* signature.asc
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 299 |
Nodes: | 16 (2 / 14) |
Uptime: | 37:15:58 |
Calls: | 6,682 |
Files: | 12,222 |
Messages: | 5,343,192 |