PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 12:28 pm

That seems unlikely, but not impossible. Did you do anything other than a software update between it working and not working? Have you tried setting the clock and rebooting?

TarjeiB
Posts: 157
Joined: Thu Jul 12, 2012 3:33 pm

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 12:46 pm

No other changes, it worked, I updated, now it doesn't work.
Setting the clock and rebooting will always bring back 1970 now.

Is there an rpi-update command I can use to try an older kernel pre tree-change?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 12:51 pm

Yes. sudo rpi-update <git hash>, where you can get the hash for a revision from here: https://github.com/Hexxeh/rpi-firmware/commits/master

For the last pre-3.18, pre-device-tree kernel:

Code: Select all

sudo rpi-update f74b92120e0d469fc5c2dc85b2b5718d877e1cbb

TarjeiB
Posts: 157
Joined: Thu Jul 12, 2012 3:33 pm

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 1:14 pm

Code: Select all

uname -a
Linux bjortjonn 3.12.36+ #737 PREEMPT Wed Jan 14 19:40:07 GMT 2015 armv6l GNU/Linux

sudo hwclock --rtc /dev/rtc0 -r --debug
hwclock from util-linux 2.20.1
Using /dev interface to clock.
Last drift adjustment done at 1427714563 seconds after 1969
Last calibration done at 1427714563 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
/dev/rtc0 does not have interrupt functions. Waiting in loop for time from /dev/rtc0 to change
...got clock tick
Time read from Hardware Clock: 2013/04/17 23:50:49
Hw clock time : 2013/04/17 23:50:49 = 1366242649 seconds since 1969
Thu 18 Apr 2013 01:50:49 CEST  -0.821951 seconds

So, it works like a charm (nevermind the wrong date, it's using a capacitor, not a battery so it's been down too long). After correcting the time:

Code: Select all

date
Mon Mar 30 15:08:44 CEST 2015

sudo hwclock --rtc /dev/rtc0 --systohc
sudo hwclock --rtc /dev/rtc0 -r
Mon 30 Mar 2015 15:10:15 CEST  -0.188787 seconds
So it works with no modificatons with the old kernel. After a reboot, time is still correct:

Code: Select all

date
Mon Mar 30 15:12:59 CEST 2015

sudo hwclock --rtc /dev/rtc0 -r
Mon 30 Mar 2015 15:13:33 CEST  -0.410315 seconds
So even while I can make I2C work with the new kernel, hwclock doesn't, and only works with the old kernel?
Could it be related to the "interrupt" thing, or is that way off? "/dev/rtc0 does not have interrupt functions."

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 1:29 pm

The message about it not having interrupt functions is because it is an I2C device - this isn't the cause of the problem. I have a PCF8523 running with a new kernel, and it also shows the same message when I run hwclock with --debug.

So, there are a few things you could try:
1) Make sure that you have correct /lib/udev/hwclock-set, then rpi-update again.
2) If that doesn't work, try adding "device_tree=" to your config.txt and rebooting, which will disable device tree. Then try the old method of configuring the RTC. If this works it will tell us that the problem is DT-related. If it doesn't, then it is probably a driver issue.

TarjeiB
Posts: 157
Joined: Thu Jul 12, 2012 3:33 pm

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 2:05 pm

Same problem - something must be wrong with the 3.18 driver.

I also just now tried the latest hwclock from util-linux 2.26.1 as suggested elsewhere, and it does make a difference. hwclock now works!

Code: Select all

sudo hwclock --rtc /dev/rtc0 -r
Mon 30 Mar 2015 16:02:39 CEST  .978874 seconds

sudo hwclock --rtc /dev/rtc0 -r --debug
hwclock from util-linux 2.26.1
Using the /dev interface to the clock.
Last drift adjustment done at 1427723960 seconds after 1969
Last calibration done at 1427723960 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
select() to /dev/rtc0 to wait for clock tick timed out...synchronization failed
With debug it gives the same error as before, but both -s and -r gives expected results.

What's different?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Mon Mar 30, 2015 2:36 pm

The diff for hwclock.c back to the 2.20.1 release is 1275 lines, and even the commit log is 530 lines. If you feel adventurous you could use git bisect to narrow it down to a single commit, which may only take 9 or 10 builds.

TarjeiB
Posts: 157
Joined: Thu Jul 12, 2012 3:33 pm

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Tue Mar 31, 2015 8:38 am

PhilE wrote:The diff for hwclock.c back to the 2.20.1 release is 1275 lines, and even the commit log is 530 lines. If you feel adventurous you could use git bisect to narrow it down to a single commit, which may only take 9 or 10 builds.
I had a quick look into it, but then realised there's other things that doesn't work in 3.18 too (mjpeg-streamer with Logitech Quickcam Pro 9000) , so I'm just going to give it up and go with 3.12 for now.

User avatar
PeterO
Posts: 4942
Joined: Sun Jul 22, 2012 4:14 pm

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Thu Apr 02, 2015 8:02 pm

PhilE wrote: Try this:
1. Add

Code: Select all

dtoverlay=i2c-rtc,pcf8563
to config.txt .
2. Disable or remove the fake-hwlock.

Code: Select all

dpkg --purge fake-hwclock
should do it.
3. Edit /lib/udev/hwclock-set and change both occurrences of "--systz" to "--hctosys".
4. Delete /etc/adjtime .
5. Reboot.
Worked like a charm (with one obvious appropriate change) for an A+ with a DS1307 !
+1
PeterO
Discoverer of the PI2 XENON DEATH FLASH!
Interests: C,Python,PIC,Electronics,Ham Radio (G0DZB),1960s British Computers.
"The primary requirement (as we've always seen in your examples) is that the code is readable. " Dougie Lawson

User avatar
dliloch
Posts: 168
Joined: Wed Jun 27, 2012 6:28 pm
Location: cleveland, ohio usa

Re: [SOLVED] after yesterday's update the i2c clock doesn't

Sun May 24, 2015 8:53 pm

very helpful ... I never had this problem with raspbian .. in archlinux WHEN I UPGRADED via pacman -Su I lost my i2c and fstab had an entry for /root removed causing the disk to go into read only .. very confusing since I did fschecks and everything was fine .. .. back together again ..
in archlinux thre was a config.txt.pacnew which has everything there and I just had to uncomment the i2c stuff..

villamarinella
Posts: 9
Joined: Mon Jul 20, 2015 5:05 pm

I killed the system

Wed Sep 16, 2015 7:29 am

After added the devicetree lines to /boot/command.txt

my raspberry PI dont boot up.

I love all this wonderful tutorials.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: after yesterday's update the i2c clock doesn't work (sol

Wed Sep 16, 2015 1:01 pm

Your post reads like a complaint - sarcasm rarely gets a good response.

If you are actually asking for help then you will need to provide more information. Examples of useful information include what you did (e.g. what software you started with, how you upgraded, the content of config.txt, etc.) and what you observed (output from the kernel or just a rainbow screen).

willshill
Posts: 12
Joined: Fri Sep 25, 2015 11:25 am

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 7:57 pm

Hi!

I have tried to add the following to boot/config.txt as I have a Pi 2 B+

device_tree=bcm2708-rpi-b-plus.dtb
device_tree_param=i2c1=on
device_tree_param=spi=on

But I think I have made an error and now the Pi wont boot up! How can I rescue this without factory resetting and loosing my work :S

gordon77
Posts: 4117
Joined: Sun Aug 05, 2012 3:12 pm

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 7:59 pm

Can you plug the Sd card in another pc and modify the file?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 8:43 pm

If you can edit config.txt then delete:

Code: Select all

device_tree=bcm2708-rpi-b-plus.dtb
It is the wrong dtb for a Pi2. The firmware will automatically load the correct one, and as you have found, setting it manually has its pitfalls. Next change i2c1 to I2c_arm, since that is more portable. Then try booting.

You might want to read https://www.raspberrypi.org/documentati ... ce-tree.md for some background.

willshill
Posts: 12
Joined: Fri Sep 25, 2015 11:25 am

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 9:35 pm

Thanks for the reply..

I wiped the Pi in the end as I couldn't access the config file from my pc.

Anyhow, I still have the same issue I started with. When I try to run 'gpio load i2c', I get an error saying

file not present /dev/i2c-0.

Here is my auto generated setting from my config file...What do I need to add/remove?

Code: Select all

# NOOBS Auto-generated Settings:
hdmi_force_hotplug=1
config_hdmi_boost=4
overscan_left=24
overscan_right=24
overscan_top=16
overscan_bottom=16
disable_overscan=0
device_tree=

Thanks for your support.

willshill
Posts: 12
Joined: Fri Sep 25, 2015 11:25 am

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 9:36 pm

Oh I assume I have a PI 2 b+, it says on the PI ' Model B VI.I

Thanks

User avatar
DougieLawson
Posts: 35810
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 9:40 pm

Get rid of that device_tree= null line. That's going to stop a whole lot of hardware from working.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

willshill
Posts: 12
Joined: Fri Sep 25, 2015 11:25 am

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 9:48 pm

Ok I removed the tree line and then re-enabled i2c and SPI and I still get

file not present /dev/i2c-0.

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 9:54 pm

You shouldn't be accessing /dev/i2c-0 on a Pi 2 - it's reserved for the camera and other peripherals that the GPU controls.

Also, In order for /dev/i2c-0 and /dev/i2c-1 to be available, the i2c-dev module must be loaded. This isn't something that Device Tree can do (well, it's not supposed to...), so just add it to /etc/modules.

But that doesn't explain why this gpio utility is trying to use i2c-0. Doesn't it have a command line parameter (like i2c-detect -y 1) to choose an I2C bus?

PhilE
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 2316
Joined: Mon Sep 29, 2014 1:07 pm
Location: Cambridge

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 9:57 pm

Ah, if you are using "gpio load i2c" to cause the kernel module to be loaded (I found the documenation), don't - Device Tree will do that automatically for you provided you have enabled the underlying interface, and that is what "dtparam=i2c_arm=on" does for you.

willshill
Posts: 12
Joined: Fri Sep 25, 2015 11:25 am

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 10:06 pm

According to the /etc/moddules file, the i2c-dev module is loaded.

I am trying to do this project: http://www.stuff.tv/features/how-build- ... thermostat and within 'configure raspberry PI' section, I need to Enable SPI and i2C protocols.

How can I get around this issue? Do I need to do something different to enable the i2c protocol as I have a Pi 2 B +? Or can I assume it is running even though 'GPIO load i2c' returns this missing file error?

Appreciate your support!

User avatar
DougieLawson
Posts: 35810
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 10:13 pm

Can you run an lsmod (ell,ess,emm,oh,dee) command and post the results?
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

willshill
Posts: 12
Joined: Fri Sep 25, 2015 11:25 am

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 10:22 pm

I cannot get this command to work? Google auto corrected to insmod and this still chucked an error?

User avatar
DougieLawson
Posts: 35810
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: after yesterday's update the i2c clock doesn't work (sol

Mon Nov 09, 2015 10:25 pm

It's ls (list) mod (modules) and it will show you what's loaded. It doesn't even need root privileges.

Code: Select all

pi@aplus ~ $ lsmod
Module                  Size  Used by
rpcsec_gss_krb5        22276  0
ctr                     4001  1
ccm                     8278  1
arc4                    1972  2
rt2800usb              18832  0
rt2800lib              81962  1 rt2800usb
rt2x00usb              11918  1 rt2800usb
rt2x00lib              47910  3 rt2x00usb,rt2800lib,rt2800usb
mac80211              622304  3 rt2x00lib,rt2x00usb,rt2800lib
cfg80211              499834  2 mac80211,rt2x00lib
crc_ccitt               1620  1 rt2800lib
rfkill                 22491  2 cfg80211
spi_bcm2835             7948  0
bcm2835_gpiomem         3703  0
uio_pdrv_genirq         3690  0
uio                    10002  1 uio_pdrv_genirq
bcm2708_rng             1220  0
i2c_bcm2708             6252  0
i2c_dev                 6730  0
snd_bcm2835            22317  0
snd_pcm                92581  1 snd_bcm2835
snd_timer              23454  1 snd_pcm
snd                    68161  3 snd_bcm2835,snd_timer,snd_pcm
fuse                   91981  1
ipv6                  360374  56
turn off auto-correct because it's clearly insane.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

Return to “Troubleshooting”