RTC Configuration

589 views
Skip to first unread message

James S

unread,
Jul 12, 2013, 7:38:06 AM7/12/13
to beagl...@googlegroups.com
Hi 

I'm trying to connect a DS1338 RTC chip to the Beaglebone White, branch 3.2.42. I get the following error message on boot:-
[    0.791564] rtc-ds1307: probe of 3-0068 failed with error -5
[    0.813598] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

Why can't I communicate with the RTC?


I've wired up the SCL and SDA in parallel to the on-board cat24c256 eeprom and powered the rtc from 3V3.

I changed the kernel by adding the following to  __initdata cape_i2c_boardinfo[]  in board-am335xevm.c.
        {
                I2C_BOARD_INFO("rtc-ds1307", 0x68),     /
                .type = "ds1338",
        },

I modified the config file as follows:-
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set

# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
CONFIG_RTC_DRV_DS1307=y
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_DS3232 is not set
# CONFIG_RTC_DRV_MAX6900 is not set


Regards,
James

Andrew Bradford

unread,
Jul 12, 2013, 8:00:48 AM7/12/13
to beagl...@googlegroups.com
On Fri, Jul 12, 2013, at 07:38 AM, James S wrote:
> I'm trying to connect a DS1338 RTC chip to the Beaglebone White, branch
> 3.2.42. I get the following error message on boot:-
> [ 0.791564] rtc-ds1307: probe of 3-0068 failed with error -5
> [ 0.813598] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)

The kernel's looking for your RTC on i2c2 (hardware numbering) which is
bus 3 in Linux.

> Why can't I communicate with the RTC?
>
>
> I've wired up the SCL and SDA in parallel to the on-board cat24c256
> eeprom
> and powered the rtc from 3V3.

In parallel with the EEPROM on the main board or on a cape?

> I changed the kernel by adding the following to __initdata
> cape_i2c_boardinfo[] in board-am335xevm.c.
> {
> I2C_BOARD_INFO("rtc-ds1307", 0x68), /
> .type = "ds1338",
> },
>
> I modified the config file as follows:-
> CONFIG_RTC_LIB=y
> CONFIG_RTC_CLASS=y
> *CONFIG_RTC_HCTOSYS=y*
> *CONFIG_RTC_HCTOSYS_DEVICE="rtc0"*
> # CONFIG_RTC_DEBUG is not set
>
> #
> # RTC interfaces
> #
> CONFIG_RTC_INTF_SYSFS=y
> CONFIG_RTC_INTF_PROC=y
> CONFIG_RTC_INTF_DEV=y
> # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
> # CONFIG_RTC_DRV_TEST is not set
>
> #
> # I2C RTC drivers
> #
> *CONFIG_RTC_DRV_DS1307=y*
> # CONFIG_RTC_DRV_DS1374 is not set
> # CONFIG_RTC_DRV_DS1672 is not set
> # CONFIG_RTC_DRV_DS3232 is not set
> # CONFIG_RTC_DRV_MAX6900 is not set

The board file is probably putting the RTC on the wrong i2c bus. If you
had the RTC on the i2c1 bus, like my bones, you'd see a boot up messages
like:

[ 1.236145] rtc-ds1307 2-0068: rtc core: registered ds1339 as rtc0
[ 1.322998] rtc-ds1307 2-0068: setting system clock to 2000-01-01
00:01:59 UTC (946684919)

That's a first boot when RTC wasn't powered before hand.

-Andrew

James S

unread,
Jul 12, 2013, 8:18:26 AM7/12/13
to beagl...@googlegroups.com
Hi 

The RTC is on a cape, the EEPROM is working OK.

Do I need to use the other I2C interface and, if so, what changes do I need to make to the kernel? 

Thanks,
James

Andrew Bradford

unread,
Jul 12, 2013, 8:38:49 AM7/12/13
to beagl...@googlegroups.com
On Fri, Jul 12, 2013, at 08:18 AM, James S wrote:
>
>
> On Friday, July 12, 2013 12:38:06 PM UTC+1, James S wrote:
> >
> > I'm trying to connect a DS1338 RTC chip to the Beaglebone White, branch
> > 3.2.42. I get the following error message on boot:-
> > [ 0.791564] rtc-ds1307: probe of 3-0068 failed with error -5
> > [ 0.813598] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
> >
> > Why can't I communicate with the RTC?
> >
> >
> > I've wired up the SCL and SDA in parallel to the on-board cat24c256 eeprom
> > and powered the rtc from 3V3.
> >
> > I changed the kernel by adding the following to __initdata
> > cape_i2c_boardinfo[] in board-am335xevm.c.
> > {
> > I2C_BOARD_INFO("rtc-ds1307", 0x68), /
> > .type = "ds1338",
> > },
> >
> > I modified the config file as follows:-
> > CONFIG_RTC_LIB=y
> > CONFIG_RTC_CLASS=y
> > *CONFIG_RTC_HCTOSYS=y*
> > *CONFIG_RTC_HCTOSYS_DEVICE="rtc0"*
> > # CONFIG_RTC_DEBUG is not set
> >
> > #
> > # RTC interfaces
> > #
> > CONFIG_RTC_INTF_SYSFS=y
> > CONFIG_RTC_INTF_PROC=y
> > CONFIG_RTC_INTF_DEV=y
> > # CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
> > # CONFIG_RTC_DRV_TEST is not set
> >
> > #
> > # I2C RTC drivers
> > #
> > *CONFIG_RTC_DRV_DS1307=y*
> > # CONFIG_RTC_DRV_DS1374 is not set
> > # CONFIG_RTC_DRV_DS1672 is not set
> > # CONFIG_RTC_DRV_DS3232 is not set
> > # CONFIG_RTC_DRV_MAX6900 is not set
>
> The RTC is on a cape, the EEPROM is working OK.
>
> Do I need to use the other I2C interface and, if so, what changes do I
> need
> to make to the kernel?

Can you talk to the RTC via i2c software tools in Linux or u-boot? Even
if (especially if) it doesn't get registered by Linux you should be able
to read and write the registers of the RTC. That's a good sanity check
that the RTC is actually functional and correctly connected.

If you look at the I2C bus with a logic analyzer or bus-pirate, do you
see comms with the RTC?

-Andrew

James S

unread,
Jul 12, 2013, 10:55:17 AM7/12/13
to beagl...@googlegroups.com
Hi 

Thanks for that. A silly wiring problem on the board.

Regards,
James


On Friday, July 12, 2013 12:38:06 PM UTC+1, James S wrote:
Reply all
Reply to author
Forward
0 new messages