I2C DS1307

The Dallas Semiconductor DS1307 provides real time clock functionality with an I2C interface.

SparkFun makes a breakout board which can easily be connected to the i2c bus on the robostix. DS1307 is a 5v device, and the robostix provides a 5v i2c bus interface.

So, getting the DS1307 connected physically turned out the be quite simple, connect +5, SDA, SCL and Ground from the appropriate connectors on the breakout board to the same pins on the robostix.

I was able to verify that the DS1307 was on the i2c bus by using the i2c program mentioned on the I2C quick start page. The DS1307 is hard coded to be at address 0x68.

Getting the DS1307 to work under linux turned out to be more of a battle. I found this version of a patch that looked like it held some promise, even though it had been rejected. I was able to get it to work on the gumstix with only a couple of minor changes. The [ds1307.patch file has been updated to work with the gumstix.

Integrating the DS1307 with the gumstix
These instructions are designed for the new version of the 2.6.15 version of buildroot and will require minor changes to work with older versions of buildroot. CONFIG_SENSORS_DS1307=m ds1307.linux.config is the config file I used. to look like: CONFIG_HWCLOCK=y i2c-dev i2c-pxa ds1307 to the end of the file. The version I used can be found in ds1307.busybox.config. rm -rf build_arm_nofpu/linux-2.6.15gum/ rm -rf build_arm_nofpu/busybox-1.01/ make
 * Copy the ds1307.patch into the gumstix-buildroot/target/device/Gumstix/basix-connex/kernel-patches directory.
 * Edit the file with the name series in the same directory and add an entry onto the end which has ds1307.patch on it.
 * Enable I2C as described on the I2C quick start page. You'll also want to enable the DS1307 (once you're in the I2C menu, you'll find the DS1307 under "Miscellaneous I2C Chip support --->". If you edit your linux.config file directly, you'll want to add an entry which says
 * Enable HWCLOCK in busybox. This can be done by changing the line in the busybox.config file (also found in gumstix-buildroot/target/device/Gumstix/basix-connex/) from:
 * 1) CONFIG_HWCLOCK is not set
 * Edit gumstix-buildroot/target/generic/target_skeleton/etc/modules and add
 * Rebuild linux and busybox
 * Copy S10clock into gumstix-buildroot/target/generic/target_skeleton/etc/init.d

After you've downloaded your new file system, you should be able to use a combination of the date and hwclock commands to manipulate the DS1307. Use the date command to set the current date and time. Use "hwclock -w" to set the DS1307 to match the current date and time (set with the date command). Use the "hwclock -r" command to read the time from the DS1307 and "hwclock -s" to set the linux date and time from the DS1307.

A step-by-step summary on how to integrate DS1307 with gumstix (r1161)
Click DS1307_r1161 for details on how to connect DS1307 to a connex, wifistix, robostix stack (with buildroot r1161, 2.6.18gum)