Setting RTC in CY14B101P-SFXI

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

I having some trouble setting the real time clock with this particular NVRAM device. The exact sequence of events is as follows:

   

1. WREN

   

2. Write 0x02 to RTC register 0x00.

   

3. WREN

   

4. Write 7 bytes to RTC registers 0x09-0x0f.

   

5. WREN

   

6. Write 1 byte to RTC register 0x01.

   

7. WREN

   

8. Write 0x00 to RTC register 0x00.

   

 

   

Each of the above steps is standalone SPI transaction; the CS is pulled low for each and returns high before the next step. All values are legal BCD according to the data sheet. However, reading the RTC registers yields incorrect data and several bytes with values outside valid BCD values, which seems to mean that incorrect BCD data was loaded to begin with.

0 Likes
1 Solution
ShivendraSingh
Employee
Employee
25 solutions authored 50 replies posted 10 solutions authored

Hi,

   

RTC not updating time correcty migh be due to one of the following probable reasons.

   

1. C1 and C2 load capacitance are not matching with datasheet recommended values.

   

2. Crystal load spec is different than recommended 12.5 pF load.

   

3. You can measure the crystal clock output on either Xin or Xout pin using a CRO. It should measure ~32768 Hz sinusoidal wave output signal. (Please note that standard passive CRO probes loads the circuit which will impact on crystal oscillation due to additional load.Therefore, you should either use an active probe or may set the passive probe in 10x attenuation mode for better a better output result)

   

4. If you are unable to measure Xin/Xout directly on any of the crystal pin then you can probe on INT pin output after enabling "CAL" bit in the RTC flag register (bit 3 in Reg 0x00). It should measure 512 Hz square wave output on INT pin. Any standard CRO proble should be able to mesure digital output on INT pin.

   

5. In case if you are still unable to measure clock output in step 3 or step 4 then it resembles that crystal is not oscillating. This can happen either due to:

   

                a .Crystal oscillation bit is disabled in RTC register. OSCEN (active low) bit should be to "0" to enable the crystal oscillation.

   

                b. If step "5.a" is followed correctly and ok then most likely it is an issue with the crystal component and try to change the crystal and repeat step 3 or 4 to confirm.                

   

 If above debug methods didn't help you then try reading all 16 RTC address locations and send dump file to me for analysis. Please send atleast two readings taken at 10 seconds interval.

   

Thanks,

   

Shivendra

View solution in original post

0 Likes
5 Replies
ShivendraSingh
Employee
Employee
25 solutions authored 50 replies posted 10 solutions authored

Hi,

   

I am an Applications Engineer from Cypress Semiconductor and would like to assist you in resolving RTC issue.

   

Sequence of writing into RTC registers are correct. Please verify the following in your system

   

 1. Reading of nvSRAM RTC registers  are limited upto 25MHz SPI speed. Write can be done upto 40 MHz. Please ensure that you are reading at 25MHz or below SPI Speed. Reading at higher SPI speed than 25 MHz may result in reading incorrect (garbage) data.

   

2.  Read and verify whether 0x02 is correctly set into RTC register 0x00 ( Step 2 in your sequence).

   

3. Please read out all 16 RTC registers for  5 seconds. This is to ensure that seconds register is updating correctly if RTC crystal is running.

   

Thanks,

   

Shivendra

0 Likes
Anonymous
Not applicable

Hi,

   

I am new to Cypress Products.In my project i am using CY8C3246AXI-138,CY14B101p-SFXI.i want to read and write the SRAM.I tried to write by the steps followed.

   

CS_LOW

   

1.WREN

   

CS_HIGH

   

CS_LOW

   

2.WRITE Cmd

   

3.Address

   

CS_HIGH

   

CS_LOW

   

4.data bytes

   

CS_LOW

   

I am providing the Hardware and software that we made.Once check and give some suggesions for quick progress in our project.

   

 

   

Thank You.

0 Likes
ShivendraSingh
Employee
Employee
25 solutions authored 50 replies posted 10 solutions authored

Hi Sattipandu,

   

I reviewed your code sequence and found that there are two steps which you need to include for working with RTC.

   

     1.       It is must to set the ‘w’ bit in the flag register before initiating a write to RTC register

   

     2.            You must send the complete write command which include RTC write opcode, address, data with CS low. You have toggled CS between your steps 3 and 4.

   

Please follow the below steps and modify your code accordingly.

   

Step1:  Set the “WEN” bit in the status register. (You can read the status register and verify the "WEN" bit status- It must be set to “1” before going for further steps of writing)     

   

        

   

     CS_LOW     

   

         WREN =0x06     

   

      CS_HIGH     

   

     

            

   

Step 2: Set the "w" bit (Bit 2) in the RTC flag register (0x00) before initiating write into any RTC register (You can read the flag register and verify the "w" bit status- It must be set to “1”)     

   

     

            

   

     CS_LOW     

   

        WRITE Cmd =0x12     

   

        Address = 0x00     

   

        data bytes = 0x02     

   

     CS_HIGH     

   

     

            

   

Step 3: Once step 1 and step 2 are successful, the following Step 3 should be used to write a new value in the RTC time keeping registers.     

   

     

            

   

     

            

   

     CS_LOW     

   

        WRITE Cmd =0x12     

   

        Address = as desired     

   

        data bytes = as desired data byte/bytes (in bulk write mode)     

   

     CS_HIGH     

   

    

          

Once you complete RTC register/s write cycle , you can read back and confirm whether the data written is updated correctly or not? Please note that after a successful RTC register write, you should clear the ‘w’ bit so that the RTC registers (second, minutes, hrs….) starts getting updated automatically.    

Please let me know if you have any further clarification.

   

Shivendra Singh

   

Cypress Semiconductor

0 Likes
Anonymous
Not applicable

Hi,

   

I have succefully Completed the RTC Reading & Writing.But Now i am facing a new problem,that is my program is able to read and write RTC and Updating the time correctly in one PCB and not in other PCB.so i cross checked the Hard ware connections and also verified my program.but there is not mistake i found.So please suggest what could be the problem.

0 Likes
ShivendraSingh
Employee
Employee
25 solutions authored 50 replies posted 10 solutions authored

Hi,

   

RTC not updating time correcty migh be due to one of the following probable reasons.

   

1. C1 and C2 load capacitance are not matching with datasheet recommended values.

   

2. Crystal load spec is different than recommended 12.5 pF load.

   

3. You can measure the crystal clock output on either Xin or Xout pin using a CRO. It should measure ~32768 Hz sinusoidal wave output signal. (Please note that standard passive CRO probes loads the circuit which will impact on crystal oscillation due to additional load.Therefore, you should either use an active probe or may set the passive probe in 10x attenuation mode for better a better output result)

   

4. If you are unable to measure Xin/Xout directly on any of the crystal pin then you can probe on INT pin output after enabling "CAL" bit in the RTC flag register (bit 3 in Reg 0x00). It should measure 512 Hz square wave output on INT pin. Any standard CRO proble should be able to mesure digital output on INT pin.

   

5. In case if you are still unable to measure clock output in step 3 or step 4 then it resembles that crystal is not oscillating. This can happen either due to:

   

                a .Crystal oscillation bit is disabled in RTC register. OSCEN (active low) bit should be to "0" to enable the crystal oscillation.

   

                b. If step "5.a" is followed correctly and ok then most likely it is an issue with the crystal component and try to change the crystal and repeat step 3 or 4 to confirm.                

   

 If above debug methods didn't help you then try reading all 16 RTC address locations and send dump file to me for analysis. Please send atleast two readings taken at 10 seconds interval.

   

Thanks,

   

Shivendra

0 Likes