Thu Jan 05, 2017 8:36 am
Are you talking about this post or my reference to my recent post?
Yes I am serious.
And yes, I have followed the most recent methods of installing an RTC on Jessie. The RTC works fine, everytime, everyday, etc, until there is just one other access on the i2c to use such as a DAC, after which the RTC access fails as per this post and my post, to which I refer.
As I mention in this post there seems to be a long lasting problem with the RTC/I2C over the years which end up with the similar symptoms of hanging, file i/o error, etc, but only after using the I2C bus for something else, all of which never show a solution or a happy ending.
I have the line added as you show. Out of interest can you access your RTC, then another i2c device on the same bus and then access the RTC again, because if so and if you have a definitive step by step method of installation over and above what is on this forum, please share. It is quite critical for me because the hang up stops the stand alone remote logging system (which has no internet access).
There are many posts relating to I2C/RTC problems and so this is a chance to crack it once and for all!
=====
For completeness these are my notes listing the steps I use to install the RTC, please feel free to correct or comment as a solution is what I am aiming for:
1. ENABLE I2C MODULE AT BOOTUP USING CONFIG
The I2C module needs to be be enabled in the RPi kernel to come in at boot up. Edit the config menu settings:
sudo raspi-config
Select (5) Interfacing` Options then 'P5 I2C - Enable/Disable automatic loading of I2C kernel module' and follow the prompts to ENABLE the ARM i2c interface, to add it to the kernel and include it at boot time.
2. I2C AT BOOTUP
Open and check config.txt file:
sudo nano /boot/config.txt
The following line should already be in the config.txt, and it sets i2c on:
dtparm=i2c_arm=on # should be on
Info: the previous param to turn on I2C is not used now as it specified channel 0 or 1
# dtparm=i2c1=on # this sets ch1 on and so best to use above dtparm=i2c_arm=on
Note that these other options are also seen in the config.txt file
#dtparam=i2s=on # this option is commented out
dtparam=spi=off # spi off as I use bcm2835 lib for spi
3. INSTALL I2C-TOOLS
sudo apt-get install i2c-tools
4. CHECK ATTACHED I2C DEVICES ON BUS
This command reads each address and should only take 1 sec:
sudo i2cdetect -y 1
This shows a DAC device at 62 and the RTC device at 68. If UU is shown at an address it means probing was skipped because there is a (kernel) driver associated with that address.
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- 62 -- -- -- -- -- UU -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
If it takes longer than 1sec to probe the above the I2C bus could be held down, the I2C i/o has been changed to general GPIO or the driver has been corrupted somehow.
RTC DRIVER INSTALLATION
1. Use the I2C tools to check that the required I2C module has been detected and the RTC should appear at address 0x68 (UU).
2. Add the RTC module to the config.txt file
sudo nano /boot/config.txt
At the end of the file add this line then save:
dtoverlay=i2c-rtc,ds3231 # needed for RPI to access RTC (or ds1307, pcf2127 as per chipset)
3. Edit the /lib/udev/hwclock-set file
sudo nano /lib/udev/hwclock-set
Comment out the following 3 lines using #
# if [ -e /run/systemd/system ] ; then
# exit 0
# fi
Comment out the following 2 lines using # or remove any with --systz
#/sbin/hwclock --rtc=$dev --systz --badyear
...
#/sbin/hwclock --rtc=$dev --systz
Save.
4. Disable the 'fake hwclock' which can interfere with the 'real' hwclock
sudo apt-get remove fake-hwclock
sudo rm /etc/cron.hourly/fake-hwclock
sudo update-rc.d -f fake-hwclock remove
sudo rm /etc/init.d/fake-hwclock
sudo update-rc.d hwclock.sh enable << some do not mention this line
5. Reboot to bring in the changes
sudo reboot
===
Q: are there any errors in the above setup for Jessie?
Apparently, this long standing I2C issue has been talked about and comments bounced around often, but I have not seen any specific fix being offered by anyone who has actually experienced the fault, pinned the issue down and found a proper workaround. I wish I knew where the hang up occurs in the (kernel/driver) software and if there was a method to clear it without requiring a reboot. Or if there was some method of 'flushing' out current I2C operations. If there is someone who could assist and would like to visit/see/analyze the setup I use please let me know.
Thanks
Steve