• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Clocks & Timers » Clocks & Timers Forum » BQ32000 Reading and Writing Registers
Share
Clocks & Timers
  • Forum
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Forums

BQ32000 Reading and Writing Registers

This question is not answered
Dean Ter Haar
Posted by Dean Ter Haar
on Mar 29 2012 15:05 PM
Prodigy30 points

Is there an application note regarding the procedure to use to read/write the registers of the BQ32000 Real Time Clock?

In particular, should I set the STOP bit in the seconds register before I set the clock?

If I want to read the date/time registers, how do I do so to prevent roll-over while I'm reading?  Even though the register update happens internally all at the same time (so the output is glitch free), what happens if I read seconds, then it rolls over, then I read minutes? 

Is the normal process to read the device twice and compare the two reads to make sure they are the same?  Or is there an alternate/preferred method?  i.e. If I read all date/time registers in one I2C read cycle, will that guarantee that there is no roll-over in the registers during the read?  Or should I stop the oscillator (yuk), read the registers, and then start the oscillator again?

Thanks for your help.

-dean

 

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Ryan Kehr
    Posted by Ryan Kehr
    on Apr 05 2012 15:59 PM
    Genius13805 points

    Dean,

    I believe that all this information is in the datasheet.  Please take a look and let me know if anything is still missing.

    http://www.ti.com/lit/ds/symlink/bq32000.pdf

    Ryan Kehr

    Motor Drive Application Manager

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dean Ter Haar
    Posted by Dean Ter Haar
    on Apr 05 2012 16:28 PM
    Prodigy30 points

    Hi Ryan,

    Unless I can't see the forest through the trees, the only mention that I've found in the data sheet is, "The time registers are normally updated once per second, and all the registers are updated at the same time to prevent a timekeeping glitch." (p.1 in Description section)

    I'm currently running a continuous test where I set the clock by writing registers 0-6 in one I2C transfer and I read them back in one transfer.  So far, I haven't seen any issues with the read-back being different than expected  (some tests wait 1.5 sec for the clock to rollover before reading back the time ... all tests assume that the timer could increment once between the write and the read and take that into consideration when determining whether the value read is correct).

    I'm assuming that the BQ32000 has an intermediate buffer, or similar, that all the registers are copied into when an I2C address match with Read is detected and that this intermediate buffer is what feeds the SDA line so that there's no chance of one register changing while another one is being shifted out.

    I also assume that if I set up my test read method to read registers 0-6 one register at a time, that I would see occasional roll-over errors if SECONDS was read at 59 on one I2C read, then it rolled over to 0, then MINUTES was read on the next I2C read.  (even if the two reads were very close together)

    The data sheet doesn't comment on this.  It says that the registers are all updated at the same time.  Meaning, I assume, that at any particular instant there is no error internally in the presented data.  Unfortunately, since I can't read all registers in the same instant, because they have to be shifted out serially, I'm not guaranteed that the values read will be glitch free. (unless there's an intermediate buffer of sorts)

    So I was just wondering if there was a preferred method for reading the part to guarantee that the values read were correct.

    Thanks for taking a look at my request.

    -dean

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Ryan Kehr
    Posted by Ryan Kehr
    on Apr 09 2012 14:20 PM
    Genius13805 points

    Dean,

    The BQ32000 has an internal buffer which is updated with the RTC counter data every second. The user only has access to this internal buffer and not the real time keeping counters. If the user is in the process of reading the time from the internal buffer, the 1 second update is stopped until the read is complete. The internal buffer is then updated immediately after the read is complete (instead of waiting for the next 1 second update).

     

    As a result the user will never see a rollover condition while doing a read of the registers. I hope this answers your question.

     

    Ryan Kehr

    Motor Drive Application Manager

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Dean Ter Haar
    Posted by Dean Ter Haar
    on Apr 09 2012 14:50 PM
    Prodigy30 points

    Thanks Ryan.  I believe I have the answer to my question, which is that I need to read registers 0-6 in one operation to prevent rollovers in *my* accumulated result.  i.e. your description tells me that the scenario I painted earlier would cause a rollover in the data if I assembled it by reading the RTC one register at a time.

    e.g.

    RTC has 10:01:59 (hh:mm:ss) on the clock

    Read SECONDS (get the value 59)

    RTC "one second" update occurs during the previous read, but is held off until read is complete

    RTC now has the value "10:02:00" on the clock

    Read MINUTES (get value 02)

    RTC still has the value "10:02:00" on the clock

    Read HOURS (get value 10)

    Assemble time inside microprocessor from values read produces the time 10:02:59 -- clearly this is not correct.  It should be either 10:01:59 or 10:02:00 but because the registers were read one at a time, instead of six at a time, the rollover in the RTC found its way into the microprocessor.

    Reading the registers the other direction (from HOURS to MINUTES to SECONDS) wouldn't help as a rollover between minutes and seconds would produce a time of 10:01:00.

    So, I have to use one TWI bus transaction to read registers 0-6 in a single operation.

    Please forgive me for being so pedantic and thank you for giving me a better idea of what's happening inside the RTC.

    -dean

     

     

     

     

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use