RTC Configuration

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

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

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

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

Hi

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

Regards,
James