Page 1 of 1

RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:03 pm
by Onira
I have RTC module PFC8563

how to make it working with my RPi?

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:07 pm
by DougieLawson
http://hackaday.com/2009/06/26/parts-i2 ... r-pcf8563/ has the wiring diagram
and
https://projects.drogon.net/raspberry-p ... c-library/ which points to http://unicorn.drogon.net/pfc8563.c that has some code to run it on the I²C interface.

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:10 pm
by caerandir

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:19 pm
by Onira
sorry but I don't know how to do that :(
direct intructions please...

I thought about a module to load but now I'm lost

Code: Select all

$ gcc pfc8563.c
/tmp/ccr1wjma.o: In function `setClock':
pfc8563.c:(.text+0x3f0): undefined reference to `wiringPiI2CWriteReg8'
pfc8563.c:(.text+0x3fc): undefined reference to `wiringPiI2CWrite'
pfc8563.c:(.text+0x420): undefined reference to `wiringPiI2CWriteReg8'
/tmp/ccr1wjma.o: In function `main':
pfc8563.c:(.text+0x448): undefined reference to `wiringPiI2CSetup'
pfc8563.c:(.text+0x4e0): undefined reference to `wiringPiI2CReadReg8'
pfc8563.c:(.text+0x500): undefined reference to `wiringPiI2CReadReg8'
pfc8563.c:(.text+0x520): undefined reference to `wiringPiI2CWriteReg8'
pfc8563.c:(.text+0x530): undefined reference to `wiringPiI2CWriteReg8'
pfc8563.c:(.text+0x540): undefined reference to `wiringPiI2CReadReg8'
pfc8563.c:(.text+0x560): undefined reference to `wiringPiI2CReadReg8'
pfc8563.c:(.text+0x57c): undefined reference to `wiringPiI2CWrite'
collect2: ld returned 1 exit status

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:43 pm
by DougieLawson
Onira wrote:sorry but I don't know how to do that :(
direct intructions please...

I thought about a module to load but now I'm lost

what should I do with that .c file?
Read the code with 'nano pfc8563.c'

a .c file is a program written in the C language. So you compile it with gcc -o foo foo.c to make an executable program called foo in the current working directory. It needs you to have installed the WiringPi library before you can compile it.

Code: Select all

sudo apt-get install git
cd /tmp
git clone git://git.drogon.net/wiringPi
cd wiringPi
sudo ./build
sudo ldconfig
cd ..
mkdir drogon
cd drogon
wget  http://unicorn.drogon.net/pfc8563.c 
gcc -o pfc8563 pfc8563.c -lwiringPi

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:48 pm
by Onira

Code: Select all

[email protected] /tmp/wiringPi/drogon $ gcc -o pfc8563 pfc8563.c -lwiringPi
[email protected] /tmp/wiringPi/drogon $
so is it done? what next? :P

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 7:52 pm
by DougieLawson
Onira wrote:

Code: Select all

[email protected] /tmp/wiringPi/drogon $ gcc -o pfc8563 pfc8563.c -lwiringPi
[email protected] /tmp/wiringPi/drogon $
so is it done? what next? :P
Connect your device to the I²C interface, check it's visible with i2cdetect -y 0 (or i2cdetect -y 1) and run the program you've just compiled.

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 8:10 pm
by Onira

Code: Select all

$ sudo i2cdetect -y 1
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- 51 -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
what about invoking sudo modrobe [correct module] ?

Re: RTC PFC8563 - help please

Posted: Tue Dec 03, 2013 11:25 pm
by DougieLawson
Looks like the device is visible at 0x51. Which matches the code

Code: Select all

  if ((rtc = wiringPiI2CSetup (0x51)) == -1)
    { fprintf (stderr, "rtc: Unable to initialise I2C: %s\n", strerror (errno)) ; return 1 ; }
So try running it with sudo pfc8563 and see what you get.

Re: RTC PFC8563 - help please

Posted: Wed Dec 04, 2013 4:45 pm
by Onira

Code: Select all

$ sudo modprobe pfc8563
FATAL: Module pfc8563 not found

Re: RTC PFC8563 - help please

Posted: Thu Dec 05, 2013 8:24 pm
by Onira