Tiny Core Linux
Tiny Core Base => Raspberry Pi => Topic started by: foxsam on October 21, 2014, 11:30:04 PM
-
I have this (http://nicegear.co.nz/blog/using-an-i2c-real-time-clock-rtc-with-a-raspberry-pi/) rtc module and need help setting it up. I tried taking 'nortc' out from cmdline.txt but it just hangs. I tried following instructions from that site but could not adapt them to picore.
Any help is apreciated.
thanks
-
Did you install the rtc kernel modules extensions? If not load rtc-3....tcz fitting your vesions.
-
I installed rtc-3.16.3-piCore+ by running tce and searching for rtc and installed it. Does that mean it loaded? When i remove nortc from cmdline.txt it hangs by "setting language to c " in the boot process.
tc@piCorePlayer:~$ uname -a
Linux piCorePlayer 3.16.3-piCore+ #1 PREEMPT Sun Sep 21 20:27:08 CEST 2014 armv6l GNU/Linux
I have a b+ if that changes anything.
Thanks.
-
Unfortunately I do not have such RTC. Do not remove NORTC from the command line. When system is running, check RTC whether it is seen as an I2C device and works as expected. Then we can proceed if hw itself verified to work.
-
I tried searching before but I can't find how to check if it is working. when I do hwclock i get an error:
tc@piCorePlayer:~$ hwclock
hwclock: can't open '/dev/misc/rtc': No such file or directory
Thanks again
-
try
sudo hwclock
You can check it with ls command or mc too
i2c-tools package can be used to check chip itself on the bus and the bus itself to be sure the hw layer is ok.
-
hwclock is same error with sudo
tc@piCorePlayer:~$ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
-
and if this adds anything.
tc@piCorePlayer:~$ ls -l /sys/bus/i2c/devices/i2c-*
lrwxrwxrwx 1 root root 0 Dec 31 1969 /sys/bus/i2c/devices/i2c-0 -> ../../../devices/platform/bcm2708_i2c.0/i2c-0/
lrwxrwxrwx 1 root root 0 Dec 31 1969 /sys/bus/i2c/devices/i2c-1 -> ../../../devices/platform/bcm2708_i2c.1/i2c-1/
-
It works!
tc@piCorePlayer:~$ sudo modprobe i2c-bcm2708
tc@piCorePlayer:~$ echo ds1307 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
ds1307 0x68
tc@piCorePlayer:~$ sudo hwclock
Sat Jan 1 01:16:18 2000 0.000000 seconds
I am going to reboot and make sure I am clear about what I did but it definitely works.
p.s. If you can help me figure out what files i need to change and backup so that it is persistent that would be great.
Thanks alot.
-
Easiest thing is to put all commands you are typing to get it up and sync system clock to hw clock to /opt/bootlocal.sh which is executed during startup as root so no need for sudo.
Of course you must backup it with
filetool.sh -b
or using TC GUI tool to make it permanent to survive reboot.
-
BTW do you know your RTC chip has a 0.25C resolution temperature sensor?
-
BTW do you know your RTC chip has a 0.25C resolution temperature sensor?
no. But I am very happy to hear as I was going to look into a temp sensor next. This is good news.
I am not sure how to read from the device tho. I am getting errors if I run echo ds3231 0x68 | sudo tee /sys/class/i2c-adapter/i2c-1/new_device
before I try to read.
tc@piCorePlayer:~$ sudo i2cget 1 0x68 0x12
Error: Could not set address to 0x68: Device or resource busy
If I do it before running the echo command it works.
-
To get temperature you must read two registers of the RTC chip via I2C commands. Google for sample programs and read datasheet of the chip which registers for temp and how to read them. This article may help:
http://www.instructables.com/id/Raspberry-Pi-I2C-Python/
It is for Raspbian so modul initialization is different. Also smbus Python module is missing in the repo, I will add it.
For sure you will find plenty of ways to handle I2C
-
py-smbus.tcz added to repo. Install it and you can use Python
import smbus
-
Hi!
I'm trying to use i2c as well on my pi3 - no luck so far :-/
read "Enabling i2C under 8.0beta3" aswell, but it also doesn't succeed.
maybe somethong else is wrong...?
no /dev/i2c
I was trying to install py-smbus.tcz, but i can't find it. has it been removed?
do i need the dev version of i2c-tools?
thanks!