This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

am335x use external rtc

Other Parts Discussed in Thread: TPS65910, DA8XX

Hi,

   If i want to use an external RTC IC (eg. DS3231)for my real time clock, how to modify linux kernel?

   I use DS3231 on i2c0 bus.

I have tested, but failed. My modification as follows:

1. add 

            {
                I2C_BOARD_INFO("ds3231", 0x68),
        },

       in fuction     am335x_i2c0_boardinfo.

2.change linux kernel menuconfig

     Device Drivers  --->    Real Time Clock  --->       <*>   Dallas/Maxim DS3232 

   and disable  TI OMAP1 option (also I  tried enable this option)

But I failed. When enable TI OMAP1,the RTC is AM335X internal RTC. and disable TI OMAP1 ,there is no rtc device in /dev

So what else I need to do If I  want use DS3231 for my RTC but AM335X internal RTC.

Thank you very much!

  • I haven't seen such a use case. When an external RTC is used, it is only used for timekeeping when the system is powered off. Then when the system is powered on the internal RTC is updated from the external RTC.
  • Hi,

    Can you please attach a log file of your boot. If the device fails to register for some reason, there should be an error message during boot.

    P.S.

    TI OMAP1 configuration option should not be used with Sitara AM335x devices.

    Best regards,
    Miroslav

  • Thank you for your reply.

    I think this is normal method that don't use  internal RTC.

    In the other hardware platform , I use external RTC(like DS3231) ,just write a DS3231 driver and register a device named rtc0 at the path of /dev,and link rtc to rtc0 is ok. hwclock can access that.

    But I don't know why it's not work in am335x . I do this in linux kernel because TI provide linux kernel had DS3232 driver.

    the boot file as follow, There are some errors like "hwclock: can't open '/dev/misc/rtc': No such file or directory",because the driver didn't produce a device node.  But in /sys/bus/i2c/drivers/rtc-ds3232 ,

    we can see the driver has been loaded successful.


    U-Boot SPL 2013.01.01 (Jun 25 2013 - 16:42:52)
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Peripheral mode controller at 47401000 using PIO, IRQ 0
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Host mode controller at 47401800 using PIO, IRQ 0
    OMAP SD/MMC: 0
    reading u-boot.img
    reading u-boot.img


    U-Boot 2013.01.01 (Jun 25 2013 - 16:42:52)

    I2C:   ready
    DRAM:  256 MiB
    WARNING: Caches not enabled
    NAND:  No NAND device found!!!
    0 MiB
    MMC:   OMAP SD/MMC: 0, OMAP SD/MMC: 1
    *** Warning - readenv() failed, using default environment

    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Peripheral mode controller at 47401000 using PIO, IRQ 0
    musb-hdrc: ConfigData=0xde (UTMI-8, dyn FIFOs, bulk combine, bulk split, HB-ISO Rx, HB-ISO Tx, SoftConn)
    musb-hdrc: MHDRC RTL version 2.0
    musb-hdrc: setup fifo_mode 4
    musb-hdrc: 28/31 max ep, 16384/16384 memory
    USB Host mode controller at 47401800 using PIO, IRQ 0
    Net:   <ethaddr> not set. Validating first E-fuse MAC
    cpsw, usb_ether
    Hit any key to stop autoboot:  0
    mmc0 is current device
    SD/MMC found on device 0
    reading uEnv.txt
    ** Unable to read file uEnv.txt **
    reading uImage
    2858240 bytes read in 308 ms (8.9 MiB/s)
    Booting from mmc ...
    ## Booting kernel from Legacy Image at 80007fc0 ...
       Image Name:   Linux-3.2.0
       Image Type:   ARM Linux Kernel Image (uncompressed)
       Data Size:    2858176 Bytes = 2.7 MiB
       Load Address: 80008000
       Entry Point:  80008000
       Verifying Checksum ... OK
       XIP Kernel Image ... OK
    OK

    Starting kernel ...

    Uncompressing Linux... done, booting the kernel.
    [    0.000000] Linux version 3.2.0 (root@zhlx-2012) (gcc version 4.7.3 20130226 (prerelease) (crosstool-NG linaro-1.13.1-4.7-2013.03-20130313 - Linaro GCC 2013.03) ) #15 Tue Feb 18 17:45:07 CST 2014
    [    0.000000] CPU: ARMv7 Processor [413fc082] revision 2 (ARMv7), cr=10c53c7d
    [    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
    [    0.000000] Machine: am335xevm
    [    0.000000] Memory policy: ECC disabled, Data cache writeback
    [    0.000000] AM335X ES2.1 (sgx neon )
    [    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024
    [    0.000000] Kernel command line: console=ttyO0,115200n8 root=/dev/mmcblk0p2 ro rootfstype=ext3 rootwait ip=none
    [    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)
    [    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)
    [    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)
    [    0.000000] Memory: 256MB = 256MB total
    [    0.000000] Memory: 253980k/253980k available, 8164k reserved, 0K highmem
    [    0.000000] Virtual kernel memory layout:
    [    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
    [    0.000000]     fixmap  : 0xfff00000 - 0xfffe0000   ( 896 kB)
    [    0.000000]     vmalloc : 0xd0800000 - 0xff000000   ( 744 MB)
    [    0.000000]     lowmem  : 0xc0000000 - 0xd0000000   ( 256 MB)
    [    0.000000]     modules : 0xbf000000 - 0xc0000000   (  16 MB)
    [    0.000000]       .text : 0xc0008000 - 0xc04f9000   (5060 kB)
    [    0.000000]       .init : 0xc04f9000 - 0xc0532000   ( 228 kB)
    [    0.000000]       .data : 0xc0532000 - 0xc0590f40   ( 380 kB)
    [    0.000000]        .bss : 0xc0590f64 - 0xc05bcfb4   ( 177 kB)
    [    0.000000] NR_IRQS:396
    [    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 5.0) with 128 interrupts
    [    0.000000] Total of 128 interrupts on 1 active controller
    [    0.000000] OMAP clockevent source: GPTIMER2 at 24000000 Hz
    [    0.000000] OMAP clocksource: GPTIMER1 at 32768 Hz
    [    0.000000] sched_clock: 32 bits at 32kHz, resolution 30517ns, wraps every 131071999ms
    [    0.000000] Console: colour dummy device 80x30
    [    0.000122] Calibrating delay loop... 795.44 BogoMIPS (lpj=3977216)
    [    0.088684] pid_max: default: 32768 minimum: 301
    [    0.088775] Security Framework initialized
    [    0.088867] Mount-cache hash table entries: 512
    [    0.089233] CPU: Testing write buffer coherency: ok
    [    0.109069] omap_hwmod: pruss: failed to hardreset
    [    0.110137] print_constraints: dummy:
    [    0.110473] NET: Registered protocol family 16
    [    0.112457] OMAP GPIO hardware version 0.1
    [    0.114807] omap_mux_init: Add partition: #1: core, flags: 0
    [    0.116607]  omap_i2c.1: alias fck already exists
    [    0.117431]  omap2_mcspi.1: alias fck already exists
    [    0.117645]  omap2_mcspi.2: alias fck already exists
    [    0.118530]  edma.0: alias fck already exists
    [    0.118530]  edma.0: alias fck already exists
    [    0.118560]  edma.0: alias fck already exists
    [    0.136108] bio: create slab <bio-0> at 0
    [    0.138122] SCSI subsystem initialized
    [    0.139678] usbcore: registered new interface driver usbfs
    [    0.139953] usbcore: registered new interface driver hub
    [    0.140136] usbcore: registered new device driver usb
    [    0.140411] registerd cppi-dma Intr @ IRQ 17
    [    0.140441] Cppi41 Init Done Qmgr-base(d087a000) dma-base(d0878000)
    [    0.140441] Cppi41 Init Done
    [    0.140472] musb-ti81xx musb-ti81xx: musb0, board_mode=0x13, plat_mode=0x3
    [    0.140747] musb-ti81xx musb-ti81xx: musb1, board_mode=0x13, plat_mode=0x1
    [    0.141784] omap_i2c omap_i2c.1: bus 1 rev2.4.0 at 100 kHz
    [    0.143493] tps65910 1-002d: JTAGREVNUM 0x0
    [    0.145843] print_constraints: VRTC:
    [    0.147247] print_constraints: VIO: at 1500 mV
    [    0.149536] print_constraints: VDD1: 600 <--> 1500 mV at 1262 mV normal
    [    0.151794] print_constraints: VDD2: 600 <--> 1500 mV at 1137 mV normal
    [    0.152770] print_constraints: VDD3: 5000 mV
    [    0.154144] print_constraints: VDIG1: at 1800 mV
    [    0.155548] print_constraints: VDIG2: at 1800 mV
    [    0.156921] print_constraints: VPLL: at 1800 mV
    [    0.158325] print_constraints: VDAC: at 1800 mV
    [    0.159698] print_constraints: VAUX1: at 1800 mV
    [    0.161102] print_constraints: VAUX2: at 3300 mV
    [    0.162506] print_constraints: VAUX33: at 3300 mV
    [    0.163879] print_constraints: VMMC: at 3300 mV
    [    0.164337] tps65910 1-002d: No interrupt support, no core IRQ
    [    0.166290] Switching to clocksource gp timer
    [    0.180541] musb-hdrc: version 6.0, ?dma?, otg (peripheral+host)
    [    0.180725] musb-hdrc musb-hdrc.0: dma type: dma-cppi41
    [    0.181030] MUSB0 controller's USBSS revision = 4ea20800
    [    0.181060] musb0: Enabled SW babble control
    [    0.181884] musb-hdrc musb-hdrc.0: USB OTG mode controller at d083c000 using DMA, IRQ 18
    [    0.182037] musb-hdrc musb-hdrc.1: dma type: dma-cppi41
    [    0.182312] MUSB1 controller's USBSS revision = 4ea20800
    [    0.182342] musb1: Enabled SW babble control
    [    0.182739] musb-hdrc musb-hdrc.1: MUSB HDRC host driver
    [    0.182830] musb-hdrc musb-hdrc.1: new USB bus registered, assigned bus number 1
    [    0.182952] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002
    [    0.182952] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
    [    0.182952] usb usb1: Product: MUSB HDRC host driver
    [    0.182983] usb usb1: Manufacturer: Linux 3.2.0 musb-hcd
    [    0.182983] usb usb1: SerialNumber: musb-hdrc.1
    [    0.183715] hub 1-0:1.0: USB hub found
    [    0.183746] hub 1-0:1.0: 1 port detected
    [    0.184265] musb-hdrc musb-hdrc.1: USB Host mode controller at d083e800 using DMA, IRQ 19
    [    0.184661] NET: Registered protocol family 2
    [    0.184844] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)
    [    0.185119] TCP established hash table entries: 8192 (order: 4, 65536 bytes)
    [    0.185272] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)
    [    0.185363] TCP: Hash tables configured (established 8192 bind 8192)
    [    0.185363] TCP reno registered
    [    0.185363] UDP hash table entries: 256 (order: 0, 4096 bytes)
    [    0.185394] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
    [    0.185577] NET: Registered protocol family 1
    [    0.185821] RPC: Registered named UNIX socket transport module.
    [    0.185821] RPC: Registered udp transport module.
    [    0.185852] RPC: Registered tcp transport module.
    [    0.185852] RPC: Registered tcp NFSv4.1 backchannel transport module.
    [    0.186065] NetWinder Floating Point Emulator V0.97 (double precision)
    [    0.197326] VFS: Disk quotas dquot_6.5.2
    [    0.197387] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
    [    0.197875] msgmni has been set to 496
    [    0.200805] alg: No test for stdrng (krng)
    [    0.201446] io scheduler noop registered
    [    0.201446] io scheduler deadline registered
    [    0.201538] io scheduler cfq registered (default)
    [    0.202636] Could not set LED4 to fully on
    [    0.217346] omap_uart.0: ttyO0 at MMIO 0x44e09000 (irq = 72) is a OMAP UART0
    [    0.862396] console [ttyO0] enabled
    [    0.866607] omap_uart.1: ttyO1 at MMIO 0x48022000 (irq = 73) is a OMAP UART1
    [    0.874450] omap_uart.2: ttyO2 at MMIO 0x48024000 (irq = 74) is a OMAP UART2
    [    0.882202] omap_uart.3: ttyO3 at MMIO 0x481a6000 (irq = 44) is a OMAP UART3
    [    0.889984] omap_uart.4: ttyO4 at MMIO 0x481a8000 (irq = 45) is a OMAP UART4
    [    0.897766] omap_uart.5: ttyO5 at MMIO 0x481aa000 (irq = 46) is a OMAP UART5
    [    0.905944] omap4_rng omap4_rng: OMAP4 Random Number Generator ver. 2.00
    [    0.921569] brd: module loaded
    [    0.929351] loop: module loaded
    [    0.932739] at24 1-0051: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [    1.036895] No daughter card found
    [    1.040496] at24 1-0050: 32768 byte 24c256 EEPROM, writable, 64 bytes/write
    [    1.055694] Board name: A335X_SK
    [    1.059112] Board version: 1.2B
    [    1.062377] The board is a AM335x Starter Kit.
    [    1.067810]  omap_hsmmc.0: alias fck already exists
    [    1.073242]  omap_hsmmc.1: alias fck already exists
    [    1.079193]  da8xx_lcdc.0: alias fck already exists
    [    1.084655] da8xx_lcdc da8xx_lcdc.0: GLCD: Found NHD-4.3-ATXI#-T-1 panel
    [    1.100402] Console: switching to colour frame buffer device 60x34
    [    1.115386] registered am33xx_sr device
    [    1.121612] mtdoops: mtd device (mtddev=name/number) must be supplied
    [    1.128784] omap2-nand driver initializing
    [    1.133209] OneNAND driver initializing
    [    1.186950] davinci_mdio davinci_mdio.0: davinci mdio revision 1.6
    [    1.193420] davinci_mdio davinci_mdio.0: detected phy mask fffffffc
    [    1.201629] davinci_mdio.0: probed
    [    1.205169] davinci_mdio davinci_mdio.0: phy[0]: device 0:00, driver unknown
    [    1.212585] davinci_mdio davinci_mdio.0: phy[1]: device 0:01, driver unknown
    [    1.220275] usbcore: registered new interface driver zd1201
    [    1.226257] usbcore: registered new interface driver cdc_ether
    [    1.232513] usbcore: registered new interface driver cdc_eem
    [    1.238586] usbcore: registered new interface driver dm9601
    [    1.244476] cdc_ncm: 04-Aug-2011
    [    1.247985] usbcore: registered new interface driver cdc_ncm
    [    1.253906] Initializing USB Mass Storage driver...
    [    1.259216] usbcore: registered new interface driver usb-storage
    [    1.265502] USB Mass Storage support registered.
    [    1.270751] mousedev: PS/2 mouse device common for all mice
    [    1.277099] input: ti-tsc as /devices/platform/omap/ti_tscadc/tsc/input/input0
    [    1.285339] i2c /dev entries driver
    [    1.407775] OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
    [    1.416259] cpuidle: using governor ladder
    [    1.421020] cpuidle: using governor menu
    [    1.429656] omap4_aes_mod_init: loading AM33X AES driver
    [    1.435333] omap4-aes omap4-aes: AM33X AES hw accel rev: 3.02
    [    1.441864] omap4_aes_probe: probe() done
    [    1.446289] omap4_sham_mod_init: loading AM33X SHA/MD5 driver
    [    1.452453] omap4-sham omap4-sham: AM33X SHA/MD5 hw accel rev: 4.03
    [    1.463806] omap4_sham_probe: probe() done
    [    1.470306] usbcore: registered new interface driver usbhid
    [    1.476135] usbhid: USB HID core driver
    [    1.480804] tiadc tiadc: attached adc driver
    [    1.485473] oprofile: hardware counters not available
    [    1.490814] oprofile: using timer interrupt.
    [    1.495330] nf_conntrack version 0.5.0 (3968 buckets, 15872 max)
    [    1.502075] ip_tables: (C) 2000-2006 Netfilter Core Team
    [    1.507781] TCP cubic registered
    [    1.511169] NET: Registered protocol family 17
    [    1.515838] Registering the dns_resolver key type
    [    1.520843] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 3
    [    1.528869] ThumbEE CPU extension supported.
    [    1.533416] mux: Failed to setup hwmod io irq -22
    [    1.538970] Power Management for AM33XX family
    [    1.543823] Trying to load am335x-pm-firmware.bin (60 secs timeout)
    [    1.550537] Copied the M3 firmware to UMEM
    [    1.554931] Cortex M3 Firmware Version = 0x181
    [    1.563964] create_regulator: VDD1: Failed to create debugfs directory
    [    1.572357] smartreflex smartreflex: am33xx_sr_probe: Driver initialized
    [    1.589874] clock: disabling unused clocks to save power
    [    1.607788] Detected MACID=88:33:14:f6:97:ae
    [    1.612945] mmc0: host does not support reading read-only switch. assuming write-enable.
    [    1.621948] cpsw: Detected MACID = 88:33:14:f6:97:b0
    [    1.627746] mmc0: new high speed SDHC card at address 1234
    [    1.634094] drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
    [    1.641204] Waiting for root device /dev/mmcblk0p2...
    [    1.646820] mmcblk0: mmc0:1234 SA08G 7.28 GiB
    [    1.653686]  mmcblk0: p1 p2 p3
    [    1.751770] EXT3-fs (mmcblk0p2): recovery required on readonly filesystem
    [    1.758941] EXT3-fs (mmcblk0p2): write access will be enabled during recovery
    [    5.970092] kjournald starting.  Commit interval 5 seconds
    [    5.975921] EXT3-fs (mmcblk0p2): recovery complete
    [    6.850585] EXT3-fs (mmcblk0p2): mounted filesystem with ordered data mode
    [    6.857849] VFS: Mounted root (ext3 filesystem) readonly on device 179:2.
    [    6.865356] Freeing init memory: 228K
    INIT: version 2.88 booting
    Starting udev
    [    9.878265] kjournald starting.  Commit interval 5 seconds
    [   10.779113] EXT3-fs (mmcblk0p3): using internal journal
    [   10.784606] EXT3-fs (mmcblk0p3): recovery complete
    [   10.789642] EXT3-fs (mmcblk0p3): mounted filesystem with ordered data mode
    Starting Bootlog daemon: bootlogd: cannot allocate pseudo tty: No such file or directory
    bootlogd.
    [   10.955963] EXT3-fs (mmcblk0p2): using internal journal
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Wed Jun 26 00:07:00 UTC 2013
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    INIT: Entering runlevel: 5
    Starting system message bus: dbus.
    Starting telnet daemon.
    hwclock: can't open '/dev/misc/rtc': No such file or directory
    Starting syslogd/klogd: done
    Starting thttpd.
    Starting Lighttpd Web Server: 2013-06-26 00:07:00: (log.c.166) server started
    lighttpd.
    ***************************************************************
    ***************************************************************
    NOTICE: This file system contains the followin GPLv3 packages:
        binutils-symlinks
        binutils
        gdbserver

    If you do not wish to distribute GPLv3 components please remove
    the above packages prior to distribution.  This can be done using
    the opkg remove command.  i.e.:
        opkg remove <package>
    Where <package> is the name printed in the list above

    NOTE: If the package is a dependency of another package you
          will be notified of the dependent packages.  You should
          use the --force-removal-of-dependent-packages option to
          also remove the dependent packages as well
    ***************************************************************
    ***************************************************************
    Stopping Bootlog daemon: bootlogd.
    umount: can't umount /mnt/.psplash: Device or resource busy

     _____                    _____           _         _   
    |  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
    |     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
    |__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|  
                  |___|                    |___|            

    Arago Project http://arago-project.org am335x-evm ttyO0

    Arago 2013.05 am335x-evm ttyO0

    am335x-evm login: root

  • I also found a forum in TI E2E Community,

    http://e2e.ti.com/support/embedded/linux/f/354/t/290968.aspx


    The question is the same as me . But it had not been resolved.

    Thank you .

  • HI,

    Please use i2c-probe command in your u-boot prompt to test your RTC. If the testing result shows that your rtc address is not valid , please check your hardware circuit. In this case , maybe you missed pull-up res or wrong i2c addr was used. 

  • I can't see any messages indicating that the rtc_device_register() function completes successfully:

    dev_info(dev, "rtc core: registered %s as %s\n",
    		rtc->name, dev_name(&rtc->dev));

    Check if the ds3232_check_rtc_status() function returns an error. The reason may be what Sichao Tang suggested above.

    Best regards,
    Miroslav

  • Thank for your reply.

    I resolve my problem. You are right, DS3232 driver is not  probe.

    Thank you.

  • HI,

        If your question is solved, please click yes.Thank you.