5 Replies Latest reply on Apr 28, 2017 3:52 AM by leoan_2394561

    CY14B101PA  calibration investigating

    leoan_2394561

      Hi

         

      I’m investigating calibration of CY14B101PA with using NTP (Network Tine Protocol) in Linux. As a first step of investigation, for testing I’m writing (and reading for check) value 0x1f in the register 0x08 CAL. For writing  I use the same sequence as for writing RTC date-time via SPI (WREN; write 2 in reg.  0x00; WREN; write CAL; delay 1ms; STORE; delay 8ms;  WREN; write 0 in reg.  0x00;).

         

      Then using INT, SQWE, SQ0=SQ1=0 (1Hz ) I watching for number of processor ticks each second (each INT). After 5 minutes of watching I writing (and reading for check) other value 0x3f  in the register 0x08 CAL. Аnd watching for number of processor ticks between 1 Hz INT’s during 5 minutes. After that I compare average quantity of ticks.

         

      I believe that I will see the difference about 186 ppm (or 186000 processor ticks) but I see difference ~30 ticks only (fluctuation).
      I can do so? What do I perform incorrectly?

         

      Leonid

        • 1. Re: CY14B101PA  calibration investigating
          leoan_2394561

          Is SQW (square wave output) derived from CAL register 0x08 and calibration circuitry?

             

          In the document “AN53313 Real Time Clock Calibration in Cypress nvSRAM”  (Author: Shivendra Singh) the Figure 2. “Oscillator Divider Circuit” I see the output named as “1 Hz signal calibrated over a 64 min cycle”. How can I get that calibrated 1Hz output?

          • 2. Re: CY14B101PA  calibration investigating
            medu

            Hi Leonid,

               

            The square wave output and 512 HZ calibration output on INT is derived from the RTC crystal output. Hence it would give an indication of ppm error but won't show the calibrated output. Calibration is applied directly on the RTC time registers. You should see the difference in time (few seconds) if run for a day with 0x1F and 0x3F CAL settings.

               

            Regards,

               

            Harsha

            • 3. Re: CY14B101PA  calibration investigating
              leoan_2394561

              It is a pity that it is impossible to get INT signal when changing second in RTC.

                 

              In the Linux operating system and in the utility of hwclock many efforts to coordinate a read and write in RTC by the time of change of second become (for increase in accuracy). For example, reading time from RTC in a cycle becomes so far second won't change. Or other tricks and waiting of the estimated moment of change is performed.

                 

              INT signal on change of seconds is required to many programs working with RTC.

                 

              At the same time there is a redundancy in CY14B101PA. I mean bit of the M (D7) in “Alarm seconds”  the register 0x02. Documentation says:

                 

              “There are four alarm match fields: date, hours, minutes, and

                 

              seconds. Each of these fields has a match bit that is used to

                 

              determine if the field is used in the alarm match logic. Setting the

                 

              match bit to ‘0’ indicates that the corresponding field is used in

                 

              the match process. Depending on the match bits, the alarm

                 

              occurs as specifically as once a month or as frequently as once

                 

              every minute. Selecting none of the match bits (all 1s) indicates

                 

              that no match is required and therefore, alarm is disabled.

                 

              Selecting all match bits (all 0s) causes an exact time and date

                 

              match.”

                 

              There is other way to set alarm is disabled. It is the bit AIE (D6) in the "Interrupts register" 0x06. The best application of state “Selecting none of the match bits (all 1s)” is to give the calibrated signal of 1 Hz at everyone to change of the RTC seconds.

              • 4. Re: CY14B101PA  calibration investigating
                medu

                Hi Leonid,

                   

                     It's a very good feedback. We will definitely consider for future products.

                   

                Regards,

                   

                Harsha

                • 5. Re: CY14B101PA  calibration investigating
                  leoan_2394561

                  Hi,

                     

                  I cold write a Linux driver and test for said future product.

                     

                  1. There is microprocessors which can get Pulse Per Second signals from GPS receiver or other external source.
                      But CY14B101PA  1 Hz is used to keep synchronous wall clock time in _all processors for not expensive computer systems.

                     

                  2. Linux uses software factor for time correction. Using hardware CAL register releases CPU from that work. And it is more exact method because it does not depend on non-deterministic interrupts latency.

                     

                  Leonid