User avatar
Onira
Posts: 233
Joined: Tue Oct 02, 2012 6:24 pm
Location: Poland

RTC PFC8563 - help please

Tue Dec 03, 2013 7:03 pm

I have RTC module PFC8563

how to make it working with my RPi?
Cogito ergo sum

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

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 7:07 pm

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.
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.


User avatar
Onira
Posts: 233
Joined: Tue Oct 02, 2012 6:24 pm
Location: Poland

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 7:19 pm

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
Cogito ergo sum

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

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 7:43 pm

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
Last edited by DougieLawson on Tue Dec 03, 2013 7:51 pm, edited 1 time in total.
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.

User avatar
Onira
Posts: 233
Joined: Tue Oct 02, 2012 6:24 pm
Location: Poland

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 7:48 pm

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
Cogito ergo sum

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

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 7:52 pm

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.
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.

User avatar
Onira
Posts: 233
Joined: Tue Oct 02, 2012 6:24 pm
Location: Poland

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 8:10 pm

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] ?
Cogito ergo sum

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

Re: RTC PFC8563 - help please

Tue Dec 03, 2013 11:25 pm

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.
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.

User avatar
Onira
Posts: 233
Joined: Tue Oct 02, 2012 6:24 pm
Location: Poland

Re: RTC PFC8563 - help please

Wed Dec 04, 2013 4:45 pm

Code: Select all

$ sudo modprobe pfc8563
FATAL: Module pfc8563 not found
Cogito ergo sum

User avatar
Onira
Posts: 233
Joined: Tue Oct 02, 2012 6:24 pm
Location: Poland

Re: RTC PFC8563 - help please

Thu Dec 05, 2013 8:24 pm

Cogito ergo sum

Return to “Troubleshooting”