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.

BQ32002: BQ32002 improper time

Part Number: BQ32002

Hi,

We are using the BQ32002 RTC  in our custom board. When board is powered off for one day and powered on again next day the time is coming with 5 seconds delay.

How to correct this timing delay?



Thank you,

Sharmila

  • You need to apply the programmable calibration feature to compensate for crystal frequency error. The basic flow to calibrate the frequency is as follows:

    Configure the IRQ pin to 1 Hz by setting FTF bit and FT bit to 1.

    Measure the 1 Hz output signal with a precision frequency counter with the resolution required (suggest at least 12-digit counter).

    Compute the absolute error in ppm: Absolute Error (ppm) = |1e6 × ( fMEASURED – 1Hz) / 1Hz|.

    Adjust the frequency, by performing the following:
    If the frequency is too low, set S = 1 and apply the appropriate CAL bits, where CAL = Absolute Error (ppm) / (1e6 / 245760), rounded to the nearest integer.
    If the frequency is too high, clear S = 0 and apply the appropriate CAL bits, where CAL = Absolute Error (ppm) / (1e6 / 491520), rounded to the nearest integer.
    NOTE: Because the frequency change is small and infrequent over a very long time interval (observable every 8 or 16 minutes depending on the calibration sign), it requires some patience to observe the calibration effect on a precision frequency counter.

    Example 1:
    Assume the measured IRQ output is 0.999933203125 Hz. The frequency error is about 66.8 ppm low. To increase the frequency by ~66.8 ppm, S would be set = 1, and CAL would be set to 16 (66.8/4.069).

    Example 2:
    Assume the measured IRQ output is 1.0000244140625Hz. The frequency error is about 24.4 ppm high. To decrease the frequency by ~24.4 ppm, S would be cleared = 0, and CAL would be set to 12 (24.4 / 2.035).

    The calibration corrects only initial offsets and does not adjust for temperature and aging effects. This can be handled by periodically measuring temperature and using the crystal's characteristic curve to adjust the ppm based on temperature as required.

    Alan
  • Hi Alan,

    We are not able set  FTF bit to 1 in SFR register (0x22).  After writing the new value to register , when we are trying to read the register it will revert to default value.

    Please suggest me  how Configure the IRQ pin to 1 Hz ?

    Regards,

    Sharmila

  • Hi,

    What value of ppm do i need to set for a 5 sec delay in the time  ? Please tell me the alternative Software method for calibration.

    Please tell me the CAL value (Approx) to resolve 5 sec delay in timing.

  • Shamila,

    Alan and several others on the clocking team are out this week and I don't know the answer to this. They will repond next week when they return.

    Regards,
    Dean
  • Please see section 7.6.3 Special Function Registers.

    The SF KEY 1 and SF KEY 2 registers are used to enable access to the main special function register (SFR). Access to
    SFR is granted only after the special function keys are written sequentially to SF KEY 1 and SF KEY 2. Each write to the
    SFR must be preceded by writing the SF keys to the SF key registers, in order, SF KEY 1 then SF KEY 2.

    Write 0x5E to Register 0x20 (SF KEY 1).
    Write 0xC7 to Register 0x21 (SF KEY 2).
    Write 0x01 to Register 0x22 (SFR) to set 1-Hz calibration output.

    Then you can configure the programmable calibration feature as described previously.

    Alan
  • Hi Alan,

    I have configured the IRQ bit to 1Hz. Is it possible to read the frequency of the IRQ and correct the error through software. ? so that it will easy for us to calibrate the device during mass production.

    The issue is not consistent and it is varying from board to board.  So it will be very helpful if u could suggest some software method to resolve the issue.

    Thank You,

    Sharmila

  • I found this resource which may be helpful. www.ti.com/.../slap107.pdf. It discusses the factors affecting the crystal accuracy (inherent tolerance, crystal loading, handling, temperature, ageing) and compensation method of using MSP430/MCU with temp sensor. You may find other resources for RTC compensation on the web. Unfortunately, I don't have much experience on the system/software implementation, since this product is relatively new for me to support.

    Alan
  • Hi Alan,

    Thank you for your support.

    It would be very helpful if u check internally and tell me how to solve the issue with software method and how to get the frequency using software.

    Thank you,

    Sharmila

  • If the RTC is 5 seconds slow per day, this translates to an initial frequency error of about -58 ppm ( = -5 sec/day / 86400 sec/day).  Based on this rough calculation and the calibration flow described early, try programming S = 1 and CAL = 14 to increase the frequency and calibrate-out the initial error at nominal conditions. 

    If you know have the crystal's frequency vs. temperature characteristic curve, you can use a nearby temp sensor and look-up the +/- frequency offset from the nominal temperature condition, then compensate the temperature-related offset by adjusting the CAL value from initial CAL setting at nominal condition.

    Alan

  • Hi Alan,
    Thank you for your support.

    Can u please tell me how to calculate seconds to ppm. Is there any formula available to calculate the same ?

    Thank you,
    Sharmila
  • 1 sec/day = 1 / (60 * 60 * 24) = 11.57e-6 = 11.57 ppm

    Alan

  • Hi Alan,

    Thank you for your support.

    I am successfully able to calibrate and get the  proper timing.

    I cant use this method in mass production since the drift is not constant in all the board.

    It would be very helpful if u could suggest some method to use in mass production.

    Thank you,

    Sharmila

  • Please see attached for some compensation methods using MCU for you to consider.  You can also search Google for "RTC compensation" for other ideas.

    Alan

    MSP430 RTC Temperature Compensation.pdf

  • Hi Alan,
    Thank you for your support.
    Can you just tell me any hardware changes which will resolve the issue.
    Thank you,
    Sharmila
  • In Table 6.5 of the datasheet the pre-calibration accuracy of the RTC is given as +/-35 ppm (typical).

    +/-35 ppm * 3600 sec/hr * 24 hr = +/-3.03 sec.

    Per Note 2 in Table 6.5: Typical accuracy is measured using reference board design and KDS DMX-26S surface-mount 32.768-kHz crystal. Variation in board design and crystal section results in different typical accuracy. 

    KDS DMX-26S frequency tolerance contributes +/-20 ppm (at 25 degC) toward the +/-35 ppm pre-calibration accuracy spec.  So, the remaining +/-15 ppm error could be attributed to variation in load capacitance from the device and board.

    If you're seeing a consistent time lag (-5 s --> -58 ppm pre-calibration accuracy) in your boards, it indicates the effective/actual load capacitance seen by the crystal is higher than the C_Load (12 pF?) specified for your crystal model.

    Did you take care to minimize PCB stray capacitance on the crystal nets?  Things you can try to minimize stray capacitance:

    1. Use shortest possible trace lengths from crystal pins to device OSCI/OSCO pins.
    2. Cut-out ground/power layers underneath below crystal pads and traces.  Also avoid routing below or near crystal traces.
    3. Do not use vias in crystal routing (keep crystal and IC on the same PCB side).
    4. If using a thru-hole crystal, use large anti-pad from planes and clearance from other traces.

    Also, check the crystal frequency tolerance spec is +/-20 ppm or lower; otherwise, this could cause a higher pre-calibration frequency error beyond what we typically specify in our datasheet.

    Lastly, if you redesign your crystal layout to reduce stray capacitance, it is possible to overdo it and cause the actual load to be lower than the C_Load spec of your crystal; in this case, you could see a consistent time lead (+ ppm error) instead of time lag.  So, you may consider adding the option to try external trim capacitors (DNP initially) to test different crystal trim capacitor values until you can get the pre-calibration accuracy within the datasheet typical spec.

    Alan

  • Hi Alan,
    Thank you for your through out support in fixing the issue.
    Actually only calibration method which you suggested is resolving the issue. We have tried to fix the issue by some hardware change, ,unfortunately which didn't help. We are not able to use calibration method in mass production since issue is not constant in every device. Could you please suggest any c application is available to check the time drift and calibrate according to that?

    Thank you,
    Sharmila
  • Unfortunately, I don't know of any C application.  If you're using a TI MCU, perhaps you can post your request on the MCU forum.  Also, you can try testing a 32 kHz XTAL with tighter frequency tolerance.

    Regards,
    Alan