Solderless connecting I2C Dallas RTC DS1307 to OlinuxInoMaxi

Started by flavigny, November 15, 2012, 06:23:37 PM

Previous topic - Next topic

flavigny

Hello,
Yeah, I have connected a (3 $, found on ebay: http://www.ebay.com/itm/ws/eBayISAPI.dll?ViewItem&item=200763022338 )  I2C clock to GPIO 40 pins connector .
Note that (as explained yesterday by Fadil Berisha), hardware versus software I2C fuses (well descibed in manual) concerns only the UEXT connector, raw SDA is available on Gpio pin 10 & SCL on pin 12.

here is the work:


About software: (I run Archlinux) I downloaded i2c-tools by pacman -Sy i2c-tools.
Clock is at address 104 (32K Eprom at 80, but not yet tried)

I used i2cset and i2cdump. Fine.

start clock: i2cset 0 104 0 0
stop clock: i2cset 0 104 0 128 (mandatory before setting time)
set time: i2cset 0 104 word value word: 0: seconds, 1:minutes, 2:hours, 4:day, 5:month, 6: year (0-99)
read more: http://www.sparkfun.com/datasheets/Components/DS1307.pdf
get time: i2cget 0 104 word
Now I have to learn a bit more about memory usage and software (hwclock seems never using added RTC ) and

At this time, I don't know how to link hwclock to my new one, so I use raw copy of bytes from clock to date command.
I write 'g' script:
#!/bin/sh
X=`i2cget -y 0 104 $1|sed "s/0x"`
if [ ${#X} -eq 1 ]
then
X=0$X
fi
echo $X


To set time from ds1307 (to be included in start process)
date `./g 5``./g 4``./g 2``./g 1``./g 6`.`./g 0`

Regards
PO.