AD_MSG
HI_THERE!

POP_UP_MESSAGE_CONTENT

US_MESSAGE
SEND_MESSAGE
+86 13430584894

SD2400 Real Time Clock FAQ

  • Dec 06,2024
  • 43 VIEWS
1. Q: Why is SD2400 not accurate?
    A: 1. Check if the reference time is accurate. You can use our company's online timing tool "About Time" to calibrate your computer.
        2. The low internal battery level caused the clock oscillation circuit to stop working (can be confirmed by testing the voltage of the TEST pin).
       3. Check if the digital adjustment register has been reset to zero.
       4. The high or low ambient temperature can affect the accuracy of travel time.

2. Q: Why doesn't SD2400 return an ACK and all the values read are 0xFF?
    A: 1. VDD voltage is low, less than 3.3V;
        2. The SDA port is not equipped with a pull-up resistor (usually 2-10K);
        3. SCL and SDA port definitions are reversed;
        4. IO port is reused;
        5. The device address of SD2400 is not set correctly, and its device address should be 0x64;
        6. There are address conflicts between other devices on the I2C bus and SD2400 devices;
        7. There are many issues with the communication program of I2C, such as microcontroller port configuration, non-standard timing, fast bus, IO reuse, etc., as shown in the appendix;
       8. RTC is damaged.


3. Q: Why can't I detect RTC returning ACK when using the emulator for single step debugging?

    A: Because the I2C bus of RTC has a 0.5s timeout automatic reset function.


4. Q: Why is there a jump in time when reading from SD2400. If it jumps directly from 9 seconds to 16 seconds, and it will be greater than 60 seconds?

    A: RTC uses BCD code for timing, where 0x10 represents 10 seconds in decimal. When viewed in decimal, it shows a jump from 9 to 16 (0x10=16).


5. Q: Why do I sometimes read the time in garbled characters?

    A: 1. The internal battery is fully depleted and the chip has completely lost power. When it is powered on again, the time read is garbled;

        2. The overall speed is too fast or there are non-standard aspects in the timing of the communication program (see appendix);

       3. Control the multiplexing of the IO ports of SCL and SDA;

       4. The SDA port of the chip is not equipped with a pull-up resistor.


6. Q: Why do hours run until 25 o'clock, 26 o'clock?

    A: The 12/24-hour clock is not set correctly. Set the 12/24 hour clock at the highest bit of the hour register (02H).


7. Q: Why does the hour display 90 o'clock, 91 o'clock?

    A: After reading the hourly data, the highest bit (12/24 hour control bit) was not masked.


8. Q: When the clock chip generates an interrupt output, is the INT pin high or low?

    A: The INT port is an N-channel open circuit output port, usually connected to a pull-up resistor during use. When there is no interrupt output, it is high level, and when an interrupt occurs, it becomes low level.


9. Q: Can the INT pin of the clock chip be suspended when not in use?

    A: It's possible.


10. Q: SD2401 and SD2405 are RTC with rechargeable batteries. How long does it take to fully charge and how long does it take to fully charge when there is no battery?

     A: After being fully charged, it can last for about 6 months, and can be fully charged in 72 hours when the battery is depleted.


11. Q: Why can it be set up on February 30th? Can't the chip be fault-tolerant?

      A: The RTC chip does not have fault tolerance function, please make sure to ensure the writing time. Setting non-existent time or date data will cause the counter to fail to count properly.


12. Q: After setting the year, month, and day for RTC, can it automatically adjust the week?

      A: The week system corresponding to the calendar cannot be automatically adjusted, and can be achieved through certain algorithms. Below is a commonly used formula:

          A: The most common formula:

         W = [Y-1] + [(Y-1)/4] - [(Y-1)/100] + [(Y-1)/400] + D

         Y is the number of years, and D is the cumulative number of days on this day in the year, which is the day on which this day is in the year.

         B: The best formula to use is the Zeisler formula:

         W = [C/4] - 2C + y + [y/4] + [13 * (M+1) / 5] + d - 1

         C is the century minus one, y is the last two digits of the year, M is the month, and d is the day. January and February should be calculated based on the 13th and 14th months of the previous year, and both C and y should be calculated based on the previous year.

         The [...] in both formulas refers to taking only the integer part of the calculated result. What is the remainder of W divided by 7, which is the day of the week. If the remainder is 0, then it is Sunday.


13. Q: How do I determine if the battery inside the clock chip is running low?

      A: Test the voltage at the TEST pin of the chip when VDD is not powered on. If it is less than 1.0V, it indicates that the internal battery level is low; For SD2405, a TEST pin voltage less than 2.0V indicates low internal battery power.


14. Q: How to determine from software whether RTC has lost power?

      A: Read the 0FH register and check if the lowest bit (RTCF) of the register is 1. If it is 1, it indicates that the RTC is powered off.


15. Q: Why can I read the RTC time but not write the time?

      A: RTC has three built-in protection soft locks (WRTC1~WRTC3), which need to be set to position 1 before writing to the registers. The unlocking order for setting 1 is: WRTC1->WRTC2, WRTC3; After the write register operation is completed, protect the register data with these three lock positions 0. The order of locking with 0 is WRTC2, WRTC3->WRTC1. You can refer to the demo routine on the relevant official website for details.


16. Q: What is the voltage of the TEST pin when RTC leaves the factory?

      A:SD2401:1.75V≥Vtest≥1.18V

           SD2400、SD2404:1.75V≥Vtest≥1.20V

           SD2405:3.0V≥Vtest≥2.30V


17. Q: What is the reason why RTC with built-in rechargeable battery cannot charge?

      A: Check if the Vout pin is grounded. The Vout pin cannot be charged by grounding, please hang this pin in the air.


18. Q: Can SD2400 undergo wave soldering and reflow soldering?

      A: Wave soldering is possible, but reflow soldering is not.


19.Q;Can SD2400 be cleaned using ultrasonic waves?

     A: It is not recommended to use ultrasound for cleaning clock chips. Ultrasonic cleaning can sometimes cause resonance damage to the crystal oscillator. Due to the uncertain usage conditions (such as the type of washing machine, power supply, time, and tank status), the effectiveness of ultrasonic cleaning cannot be guaranteed.


Appendix: Examples of Program Issues

When switching port directions, a STOP signal was introduced.

     This function sets the input and output of the IO port from the beginning, and there was no error. SCL was low before this operation, but some microcontrollers set the SCL port to output, which causes SCL to become high. The problem is that when SDA is set as input, SDA will also change from low to high, forming a STOP signal. The bus is immediately released, and the previously sent data is cleared, so we cannot wait for an ACK response.

    The SCL line has only one direction and is always the output. It only needs to be set once in the START function. The modification method is to mask the statement DDRA |=0x08.


2.Introducing START when sending the STOP signal may also cause the I2C slave device to malfunction.

     The function that sends the STOP signal above doesn't seem to have any errors, but if the SCL line is in a high state before calling this function, a START signal will be generated when the function starts calling. A safer approach is to first lower SCL, then lower SDA, and swap the positions of SDA1_CLR and SCL1_CLR.


3. Familiarity with the I2C protocol bus protocol resulted in a failure to read the specified address register.

     The above program seems to have no problem, but in fact, it does not understand the I2C transmission protocol. It assumes that after sending the read command, sending another address will read the data in the specified register. The correct timing diagram is as follows:

The address of the register is not sent out with a read command, but with a write command. The correct way to write it is as follows:

4. If the holding time of the start signal, data establishment, or data retention is too short, it may cause the bus to fail to respond.

     The problem with the above program is that the SDA data establishment time is too short. For some MCU with fast processing speed, data is sent out and RTC cannot respond. The correct approach is to set p_Block_CLK=1; Add a delay before:

5. Device address error causing read/write register failure.

    The above program is obviously an error in understanding the device address and is not familiar with the I2C bus operation process, and has not figured out the read and write operations of the device address.