I have a rpi cm3+ with dietpi os v7.6.2.
my rtc device is ds3231.
/boot/config.txt is:
dtparam=i2c_arm=on
dtparam=i2c_arm_baudrate=400000
dtparam=i2c0=on
dtoverlay=i2c-rtc,ds3231
also /etc/modules is:
snd-bcm2835
i2c-bcm2835
i2c-bcm2708
i2c-dev
rtc-ds1307
I did all instruction in this page
https://learn.adafruit.com/adding-a-real-time-clock-to-raspberry-pi/set-rtc-time
when i run i2cdetect -y 0 i have 0x68.
also dmesg | grep rtc
answer is:
[ 4.772977] rtc-ds1307: probe of 0-0068 failed with error -121
I don’t know what is the problem and therefor hwclock command response is:
hwclock: Cannot access the Hardware Clock via any known method.
hwclock: Use the --verbose option to see the details of our search for an access method.
everything was ok in DietPI last OS version with kernel 4.1 but in this kernel (5.1) isn’t ok.
I upgraded the os for SPI CAN problems when using two can in SocketCAN API.
thanks for your help.
I also use a DS3231 RTC except it’s on a Pi3B+.
All I have in my /boot/config.txt which applies to the RTC:
dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231
I would try commenting out everything but those, then work from there. After a reboot, try the i2cdetect -y 0 command and see if it reports ‘UU’ in place of 0x68. If port 0 no longer works, try i2cdetect -y 1.
Two possible issues stand out to me. For the first - I’m not familiar with the CM3+, but my basic understanding is it’s essentially a 3B+ in a different form factor. Per this page (at the bottom), beginning with the 512M Pis the i2c port was changed from 0 to 1. FYI, my Pi3B+ uses i2c port 1. Your current config file specifies running i2c on port 0. Possible misconfiguration there.
As to the second possible issue, I would try running the default 100KHz on the i2c until you get the RTC working, then experiment running the higher rate if you actually need it. Although I cannot find the link at the moment, I also seem to recall reading some chatter over at the RPi forums about how there was/is a bug with the i2c configuration regarding rate; the gist was that the config file required using a higher value to get an actual 400KHz rate. Since I did not have a reason to run 400KHz, I didn’t pursue it further. That issue may have already been solved, but it’s something to keep in mind.
Running with the config.txt parameters I listed above should have the i2c run on the correct port for your device as well as the default 100KHz. See where that gets you, and we can go from there.
if i use
dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231
it only show
Could not open file `/dev/i2c-0' or `/dev/i2c/0': No such file or directory
it doesn’t work.
My suspicion is your device uses i2c port 1; if so, you should receive that error on port 0.
While using only these /boot/config.txt parameters for the RTC:
dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231
Reboot, then try i2cdetect -y 1.
If the kernel module is communicating successfully with the RTC, you should see:
