lpcware

Problem with DS1337 RTC with LPC17xx

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by vk41286 on Wed Mar 26 04:17:32 MST 2014
Hi,

I am currently learning how to interface DS1337 with LPC17xx Board. I am using uclinux2.6.33 right now. The drivers are also present in drivers/rtc/rtc-ds1307.c

Here is my .config sample :


CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
CONFIG_RTC_DEBUG=y


#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
CONFIG_RTC_INTF_DEV_UIE_EMUL=y
CONFIG_RTC_DRV_TEST=y


#
# 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_MAX6900 is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_BQ32K is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set

#
# SPI RTC drivers
#

#
# Platform RTC drivers
#
CONFIG_RTC_DRV_CMOS=y
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_MSM6242 is not set
# CONFIG_RTC_DRV_BQ4802 is not set
# CONFIG_RTC_DRV_RP5C01 is not set
# CONFIG_RTC_DRV_V3020 is not set

#
# on-CPU RTC drivers
#
# CONFIG_RTC_DRV_PL030 is not set
# CONFIG_RTC_DRV_PL031 is not set
# CONFIG_RTC_DRV_LPC178X is not set
# CONFIG_DMADEVICES is not set
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set



Kernel Logs ::


Quote:

Booting kernel from Legacy Image at a0000000 ...
   Image Name:   Linux-2.6.33-arm1
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    1384224 Bytes =  1.3 MB
   Load Address: a0008000
   Entry Point:  a0008001
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

�Linux version 2.6.33-arm1 (vk18434@vk18434-OptiPlex-9010) (gcc version 4.4.1 (Sourcery G++ Lite 2010q1-189) ) #238 Wed M4
CPU: ARMv7-M Processor [412fc230] revision 0 (ARMv7M)
CPU: NO data cache, NO instruction cache
Machine: NXP LPC178x/7x
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 8128
Kernel command line: lpc178x_platform=ea-lpc1788 console=ttyS0,115200 panic=10 ethaddr=C0:B1:3C:88:88:88
PID hash table entries: 128 (order: -3, 512 bytes)
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 32MB = 32MB total
Memory: 31076k/31076k available, 1692k reserved, 0K highmem
Virtual kernel memory layout:
    vector  : 0x00000000 - 0x00001000   (   4 kB)
    fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
    lowmem  : 0xa0000000 - 0xa2000000   (  32 MB)
    modules : 0xa0000000 - 0x01000000   (1552 MB)
      .init : 0xa0008000 - 0xa0058000   ( 320 kB)
      .text : 0xa0058000 - 0xa014b000   ( 972 kB)
      .data : 0xa014c000 - 0xa0159f20   (  56 kB)
Hierarchical RCU implementation.
NR_IRQS:41
Calibrating delay loop... 31.23 BogoMIPS (lpj=156160)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
I2C: i2c-0: LPC2K I2C adapter
I2C: i2c-1: LPC2K I2C adapter
I2C: i2c-2: LPC2K I2C adapter
Switching to clocksource cm3-systick
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
Serial: 8250/16550 driver, 2 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0x4000c000 (irq = 5) is a 16550A
console [ttyS0] enabled
serial8250.2: ttyS1 at MMIO 0x40098000 (irq = 7) is a 16550A
lpc_mii_bus: probed
eth0: using RMII interface
eth0: LPC mac at 0x20084000 irq 28
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1)
~~~~~~~~~~~~~~~~~~~~~~~~
In DS1337 Probe function
~~~~~~~~~~~~~~~~~~~~~~~~
ds1307->type=0
ds1307->type=0
tmp=8
~~~~~~~~~~~~~~~~~~~~~~~~
tmp=69
~~~~~~~~~~~~~~~~~~~~~~~~
RTC_DS1337 0-0068: rtc core: registered RTC_DS1337 as rtc0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rtc_device_register successfull
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RTC_DS1337 0-0068: 56 bytes nvram
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Probe function called successfully
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rtc-test rtc-test.0: rtc core: registered test as rtc1
rtc-test rtc-test.1: rtc core: registered test as rtc2
i2c /dev entries driver
TCP cubic registered
NET: Registered protocol family 17
t=-1608777852
RTC_DS1337 0-0068: setting system clock to 2000-01-01 01:02:45 UTC (946688565)
Freeing init memory: 320K
init started: BusyBox v1.17.0 (2014-03-25 15:47:56 IST)
~ #



Now I am able to set the date, but after resetting my LPC17xx, I am unable to read the present date.
i still see the below line ::

RTC_DS1337 0-0068: setting system clock to 2000-01-01 01:02:45 UTC (946688565)
Any help would be appreciated.

~ #date -u "2014-03-26 16:29:00"
Wed Mar 26 16:29:00 UTC 2014


~ # hwclock -u -w
hush: can't execute 'hwclock': No such file or directory


I am following the present page right now ::



Thank you once again.

Any help would be appreciated.

Br
vk41286

Outcomes