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 RTC

Other Parts Discussed in Thread: AM3354, TPS65910A, AM3359, TPS65910

Hai Support,

I am using AM3354 in my design and I have few questions regarding the RTC functionality. I see that AM335x evaluation board uses RTC crystal connected to the Processor. But when the power is off there is no backup power to the RTC domain and the time and date contents cannot be actively incremented. It will remain at the old place only after power on. But I see that the RC oscillator on the PMIC can be used for the RTC functionality and it even has battery backup connected to it. If I am using RTC from PMIC do I need to connect Crystal to Processor? There is accuracy issue with the RC oscillator which will not provide the accurate time. I am not sure of what will be difference when I use RC oscillator or crystal. If any details can be provided on this then it would be helpful.

Regards,

Erfan

  • Hi Erfan,
     
    Please check sections 4.2.1 and 4.2.2.5 of the AM335X datasheet for the RTC clock specifications and connection if not used. Generally you are right, Crystal oscillator is much more precise than internal RC oscillator. If you are using the RTC of the TPS65910A PMIC there is an option to connect the PMIC output CLK32KOUT to the AM3354 input XTALIN, however you must be aware that a level translator may be required. Ccheck out this thread for explanation:
     
     
    Best Regards
    Biser
  • Hai Biser,

    If I am using RTC from power management then why do I need to connect CLK32KOUT from PMIC to Processor? Processor can read the time and date values directly from PMIC itself on the I2C bus right?

    Regards,

    Erfan

  • Yes, this is true. I just pointed this out as an option in case you want to reload the processor RTC with proper values at start-up, and then use it having a stable 32kHz clock.
     
    BR
    Biser
  • Hello,

    I stumble into this problem yesterday. I set up the date and time on my AM335x evm board expecting the system to keep the setting after rebooting, knowing that there is a backup battery.

    Well, this morning the date and time were wrong. I'm trying to get some information around the net, but it seems that this matter has not really been tackled.

    I don't really want to use the RTC from the PMIC and I rather keep the 32 Khz crystal feeding the AM3359.

    However, Erfan brought an interesting point about reading the RTC from the PMIC using I2c.

    Then my question is, how do we do that and especially how can we change the setting?

    Thank you very much.

  • Hi Laurent,
     
    Unfortunately there is an Errata (Advisory 1.0.5), which I think covers exactly what's happening to your EVM. I have information that this will be resolved in the next processor revision. As for reading the PMIC RTC over I2C, this is a standard I2C register read operation, but RTC register addresses and PMIC I2C address depend on the PMIC being used.
     
    Best Regards
    Biser
  • Thank you for your prompt answer.

    Just to clear my mind on how the PMIC and AM335x are supposed to work. I can see on the TPS65910A documentation and EVM schematics that the backup battery is connected to VBACKUP which should maintain a VRTC voltage (during power OFF). VRTC is connected to the AM3359 VDDS_RTC pin. Is it how the MPU keep his RTC running?

    We are currently developing a new product that will be release March-April next year. Do you think the revised AM3359 will be available?

    Thank you.

  • Hi Laurent,
     
    Yes, this is how it's supposed to be, but in the current processor Rev. 1.0 the 32kHz clock to the AM335X RTC gates off when VDD_CORE drops below the recommended voltage (or gets turned off). As for the next revision, I think you should plan for both Rev.1.0 and 2,0 when you start your design, and if 2.0 is available by that time it will be easy to drop the unnecessary parts of the design.
     
    Best Regards
    Biser
  • Thanks, got you.

    To make sure we can deliver the unit with date and time (which is really critical because our unit have to have a calibration cycle and need to prompt the user when is the next calibration), I'm trying to read those information from the PMIC via i2c. However, in the /dev and /sys, I can see i2c-1 and i2c-2, I can communicate with all the different sensors (light and temperature) but there is no i2c-0, which is connected to the PMIC (@ 0x2D).

    I tried to create the node i2c-0 with "mknod /dev/i2c-0 c 89 0 but, I can't open the device.

    Do you have any suggestion or guidance about that?

    Thank you very much.

  • Hi Laurent,
     
    I'm sorry, but I can't be of much help with Linux. I deal with hardware issues on the forums. However from what I see on the schematics there is no 32kHz crystal on the EVM PMIC. As for I2C0, this is also used for PMIC voltage control, so it mighr be buried somewhere in the power management. Sorry I can't be of more help on this.
     
    Best Regards
    Biser
  • Hi Laurent,

    I have similar problem. My system has i2c devices 1 to 3, so the EEPROM and PMIC are on /dev/i2c-1

    # i2cdetect -l
    i2c-1   i2c             OMAP I2C adapter                        I2C adapter
    i2c-3   i2c             OMAP I2C adapter                        I2C adapter

    Here you can see a dump of PMIC registers.

    # i2cdump -y -f 1 0x2d
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    10: 00 00 00 00 00 00 00 00 00 00 00 00 9f 0d 01 00    ............???.
    20: 05 0d 00 00 05 00 00 04 00 00 00 00 00 00 00 00    ??..?..?........
    30: 09 0d 01 0d 0d 0d 09 01 0d 00 00 00 00 00 3b 60    ?????????.....;`
    40: 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    5...............
    50: 13 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ??..............
    60: 0a 0a 0a 0a 0a 0a 00 00 00 00 00 00 00 00 00 00    ??????..........
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

    The first thing I see, that reset values are not equal to the default ones. The next problem, I cannot write. The values won't be saved. After write to the RTC_CTRL_REG (0x10), i2cdump shows the same picture. I've asked in several forums/mailing lists, but still have no answer concerning real RTC driver for tps65910 RTC. The only clue was this post http://support.criticallink.com/redmine/boards/28/topics/1999. I tried to contact the developers of this company, but still have no answer.

    Please share your i2cdump.

    i2cdump, i2cdetect etc. are part of http://www.lm-sensors.org/wiki/I2CTools

    Yegor

  • I've got RTC working. First step is to activate RTC domain in DEVCTRL_REG (0x3f). I've chosen an external 32KHz clock source:

    i2cset -f -y -m 0xf0 1 0x2d 0x3f 0x00 b

    after that you can activate RTC in RTC_CTRL_REG (0x10)

    i2cset -f -y -m 0x01 1 0x2d 0x10 0x01 b

    making i2cdump you can now see seconds increasing.

  • Hi,

    I'm glade you were able to make it work.

    What board and OS are you using?

    I'm using AM335x evm board and the PMIC is on i2c-0. The problem is I don't have access to i2c-0 once Linux boot, I do have access to i2c-1 & i2c-2.

  • I'm using http://buildroot.uclibc.org/ and kernel from http://arago-project.org/git/projects/?p=linux-am33x.git;a=shortlog;h=refs/heads/v3.2-staging

    What does "i2cdetect -l" say?

    What do you mean saying, you don't have access to i2c-0 after Linux boot?

  • So I'm using AM335x EVM board from TI with Linux. During the boot Linux go get the IDs from the 3 stacks of boards via i2c-0. However once Linux boot, there is no file i2c-0 in /dev and no entry in the /sys/class folder.

    Here is what i2cdetect display

    root@am335x-evm:~# i2cdetect -l
    i2c-1   i2c             OMAP I2C adapter                        I2C adapter
    i2c-2   i2c             OMAP I2C adapter                        I2C adapter

    I can't bring the i2c-0 to "live" to read and write the PMIC register (which is connected to i2C-0).

  • Execute "i2cdump -y -f 1 0x2d" and let me know what is says.

  • root@am335x-evm:~# i2cdump -y -f 1 0x2d
    No size specified (using byte-data access)
         0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f    0123456789abcdef
    00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    10: 00 00 00 00 00 00 00 00 00 00 00 00 9f 0d 01 00    ............???.
    20: 05 0d 38 00 05 2e 00 05 00 00 00 00 00 00 00 00    ??8.?..?........
    30: 09 0d 01 0d 0d 0d 09 01 0d 00 00 00 00 00 3f 70    ?????????.....?p
    40: 35 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    5...............
    50: 13 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ??..............
    60: 08 0a 0a 0a 0a 0a 00 00 00 00 00 00 00 00 00 00    ??????..........
    70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    80: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ?...............
    90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................
    f0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00    ................

  • So, it seems that I have the same i2cdump as you, so I executed the two command lines and it seems to be working.

    Thanks for the tip. However I'm still confused about the i2c line. The command line use i2c-1 but according to the documentation and the schematic the PMIC is connected to i2c-0.

    http://processors.wiki.ti.com/index.php/AM335x_General_Purpose_EVM_HW_User_Guide#I2C_Address_Assignments

    AM335x Baseboard FunctionAM335x I2C PortAddress
    Baseboard ID memory I2C0 0x50
    AM335x PMIC Smart Reflex I2C0 0x12
    AM355x PMIC Control I2C0 0x2D

    There is something that I'm missing somewhere!!!

  • Ok, after looking at the uboot pinmux configuration and trying few stuff I finally figured it out.

    Even though there are three i2c on the am335x-evm only 2 are used. I2C0 and what TI called in the user guide I2C1/I2C2.

    But what is confusing is that in the /dev and /sys directories I2C0 is renamed i2c-1 and I2C1 is renamed i2c-2.

    Hope this help.

  • The numbering will be defined in the board file and must start with 1. I don't know why it will be made this way.

     omap_register_i2c_bus(1, 100, am335x_i2c0_boardinfo,
                                    ARRAY_SIZE(am335x_i2c0_boardinfo));

    I also encountered similar issue: http://comments.gmane.org/gmane.linux.ports.arm.omap/81231

    Now we have a working RTC, but still no driver ... Are you going to write one?

  • Hi,

    I can definitively start writing a driver however it will be on my spare time, we have to release our new product in a few months and I don't really have time. I'm probably going to use i2c to read and write the registers.

    However, I think I will have to use an external crystal (right now I don't have one and I'm using the internal RC), I noticed that the clock is 4min behind already.

    We keep in touch for the driver.

    Thanks for the help

  • Hai Yegor,

    I just wanted to know if you were able to change the contents of the RTC registers on PMIC. The reason I am asking for this is I am using RC oscillator on the PMIC which does not provide the accurate values and I will be using the RTC from Processor which has dedicated 32KHz connected to it. I want to write PMIC RTC registers in continuous intervals to make sure the time variance can be minimized and accurate timing can be maintained.

    Regards,

    Erfan 

  • Hi Erfan,

    I was able to change the values. So far I've touched following registers:

    RTC_CTRL_REG

    BCK1_REG..BCK5_REG - they maintained their value after power off.

    In my design I have external 32KHz source connected to PMIC. Have you looked at RTC_COMP_LSB_REG and RTC_COMP_MSB_REG?

  • Hi Laurent,

    I was blind ;-) Look here: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=blob;f=drivers/rtc/rtc-tps65910.c;h=7a82337e4deee1ae9d1648ec6df5dbbcfe344ba4;hb=HEAD

    And this thread: http://comments.gmane.org/gmane.linux.kernel/1340005

    One still has to back port, but this should be a minor problem. That's why I hate to use old PSP kernels :-(

    Yegor

  • i2cdump  can show i2c device values of  register.  On  AM335X EVM ,PMIC on I2c-1, not at  i2c-0.  Because i2ctool  and  linux on  userspace start  one index,  not zero.

    root@am335x-evm:~# ls /sys/bus/i2c/devices/
    1-002d 1-0040 1-0051 2-001b 2-0048 i2c-2
    1-0035 1-0050 2-0018 2-0039 i2c-1

  • I have the same problem with WinCE 7 on AM335X.  I can read the registers via testi2c but I am unable to write to, for example, 0x3f:  testi2c reports success but the value does not change, and I am unable to enable the RTC as a result.  I tried writing many other registers but no success there either.

  • Hi,

    I have seen that silicon version 2.0 and 2.1 do not have this issue? Right?

    Are these already available

     

    Johan

  • Hi Johan,
     
    The RTC errata has been corrected in Rev. 2.X. You can download the latest documentation for AM335X from TI product pages. Documentation has been updated yesterday. For availability please ask your TI representative or reseller.
  • Hi Biser,

    Can you comment on how big the cap must be to store eg data for a power outage of 1 day?

     

    Johan

  • I can't quite understand the question. If you mean the RTC, worst case consumption is given in the AM335X datasheet, real life measurements can be found at: http://processors.wiki.ti.com/index.php/AM335x_Power_Consumption_Summary
  • Biser-

    Can you provide the link in this thread?   When I look in the Technical Documents tab of TI Home > ARM Processors > Sitara ARM Cortext-A Processors > ARM Cortex-A8 Core > ARM AM335x ARM Cortex-A8 I find nothing whatever related to the AM335x chip (or the power sequencer TPS65910A3 that I referred to), nor do I see anything dated yesterday or any errata since  2011.  The website is not at all helpful here.  Can you clarify exactly what problem is being solved and whether the erratum petains to the AM335x or the TPS65910A3?

    Thanks,

    Bruce

  •  
    To all of you that are posting on this old thread since today: If you want your questions answered clearly and without misunderstanding, please start new posts.