1 2 Previous Next 21 Replies Latest reply on Nov 6, 2018 12:46 PM by TeMa_1467596

    Battery/Super Capacitor backup power / RTC


      I added the RTC component to my project which is running on a CY8CKIT-062-BLE board and start the RTC with...




      I can read the time from the RTC and it runs fine but Ievery time I power up, it starts from 00:00:00 and need it to keep tracking the time when the power is removed from the PCB.  I'm not sure what the default settings are on the CY8CKIT-062-BLE board regarding backup power and maybe this is all I need to fix? From the datasheet it seems that the default startup for the RTC is to not reset the time if it detects that it has already been set but clearly this doesn't survive a power cycle at present.


      I'm also confused by many components that seem to have 2 sets of API commands, those starting with the component name like RTCC_Start() and then those that becgin Cy_...


      Any help appreciated.



        • 1. Re: Battery/Super Capacitor backup power / RTC

          Hi Ted,


          There is a SuperCap soldered on the board (the thing that looks like a coincell on the bottom). Next to it you have SW7 that can be used to select the powersource for the backup domain. But be aware that the super cap is charging very slowly, so a precharge by connection VDD to the SuperCap plus pole via a 100-200 resistor for a short time might be an option.


          There is a SysCalls provided to enable the supercap Charging.



          If the date is still reset with this option it has to be the software.



          Regarding the 2 APIs:

          The Cy_.. functions are the general functions provided by the driver (PDL). But to adapt to the previous (PSoC4/5LP) concept, where you only had functions generated based on the component alias, those wrappers were added/ generated as well for PSoC 6.

          Personally I like that concept as it is easier to understand that you write to the "DEBUG_UART" rather than a simple "UART instance No 5"




          1 of 1 people found this helpful
          • 2. Re: Battery/Super Capacitor backup power / RTC



            Thanks for the reply.  A few questions if I may...


            1.     Please explain what you mean by "If the date is still reset with this option it has to be the software."

            2.     Can the Cy_.. commands be mixed with the others safely or should I stick with one or the other?


            I'll try the suggestions to get the backup battery running today.



            • 3. Re: Battery/Super Capacitor backup power / RTC

              One additional point to Achim's post - all PSoC Creator projects, by default, assume VBACKUP and VDDD are shorted together and sets the VBACKUP source in cywdr file as VDDD. This results in the backup domain resetting on every POR and XRES. If you have dedicated VBACKUP supply (can be configured in the kit as explained by Achim), then you can change the VBACKUP setting to Dedicated (as shown below). This makes sure the backup domain is not reset on every power-up or XRES.





              Meenakshi Sundaram R

              1 of 1 people found this helpful
              • 4. Re: Battery/Super Capacitor backup power / RTC

                Thanks for the suggestions, I tried adding the line...




                into main and I also changed the system tab setting that says that Vbackup comes from a 'dedicated supply'. Then I set SW7 to the supercap position; on power up, the system reboots continuously which is not surprising as the PSoC Vdd 3.3 volts looks like this


                I measured the voltage on the supercap and it was 0.9 volts so I used a 100 ohm resistor to charge it up to 2.9 volts but the reboot cycle and waveform are still the same. If I switch SW7 back, it runs just fine.  I think I'm missing something?


                FWIW, I'm running the CY8KIT-062-BLE board by supplying 12V to J1 pin 1.


                Any Ideas?

                • 5. Re: Battery/Super Capacitor backup power / RTC

                  Did you mean you get the same reboot cycle and waveform once you supply 12V to J1 pin1? Have you ever tried to just supply VDDD through Type-C connector J10? The device should normally run as long as VDDD is valid, no matter what kind of power source to VBACKUP. 

                  • 6. Re: Battery/Super Capacitor backup power / RTC

                    I tested it, it makes no difference whether the power comes in via 12V to J1 pin 1 or just from the USB Type C connector; if I switch SW7 to the SuperCap position, I get that waveform and the never ending boot cycle.


                    My Code does get into main to the point of sending a welcome message out of the UART and then it reboots, maybe it's a watchdog timer or something?

                    • 7. Re: Battery/Super Capacitor backup power / RTC

                      I think there is an issue with the RTC driver, as it looks to me that the checkbox "Time Reset on Start" isn't doing anything. The Init function does not check such a parameter and just writes the time every time it is called


                      To prevent the time reset you either have to use Cy_RTC_IsExternalResetOccurred() or Cy_SysLib_GetResetReason() to determine the reset reason and check if you want to do the reset or not.


                          if(Cy_RTC_IsExternalResetOccurred() == false)


                              if(Cy_RTC_Init(&RTC_config) != CY_RTC_SUCCESS)


                                  /* If RTC initialization failed */




                      Alternatively you could use a variable stored in one of the backup registers (value is retained as long as VBAT is present) to signal that the RTC is configured.I have to look how this is done and come back with a code snipped. Easier than I thought, looks like it is working with regular register access (0xA119 is just a random key). LED is used to indicate when the RTC is updated.


                          if(CY_GET_REG32(CYREG_BACKUP_BREG0)!= 0xA119)


                              Cy_GPIO_Clr(LED_0_PORT, LED_0_NUM);

                              if(Cy_RTC_Init(&RTC_config) != CY_RTC_SUCCESS)


                                  /* If RTC initialization failed */



                              CY_SET_REG32(CYREG_BACKUP_BREG0, 0xA119);



                      I will create an internal bug report for the issue and sincerely apologize for the inconvenience this may have caused.


                      kind regards,


                      • 8. Re: Battery/Super Capacitor backup power / RTC

                        Can you please try the attached project for test of backup domain?


                        I set the VBACKUP as power source of backup domain and comment the RTC initializing code in the project. This project is verified on 062-kit baord that the RTC still running during VDDD powered off. After re - power on, the time printed from UART can be used for verifying this.


                        Because the super cap on the board is charged very slowly, I bypassed it and introduced a power supplier fixed at 2.5V to for VBACKUP when it is tested.

                        • 9. Re: Battery/Super Capacitor backup power / RTC

                          My bad above with the "Time Reset on Start" it is working correctly, but of course only when using the generated functions (RTC_xxx ) instead of the generic ones we use in the RTC_Basics example.


                          The RTC_Start() function has also the above reset handling already included.

                          • 10. Re: Battery/Super Capacitor backup power / RTC



                            I did some more tests with another 062-kit board and the behavior is the same.  I think this may be an issue associated with the circuitry that charges the SuperCap or the combination of supplies and switch settings.  If I charge up the Cap and leave SW7 in the non-SuperCap position (away from the SuperCap), my code works and if I disconnect power, count to 10, and reapply power. the time is not reset.


                            If I put SW7 in the SuperCap position with power off and then connect power (USB3 plugged into a USB 2 port in my case), the board does not power up but when I meter Vddd, I find that it runs up to 1.8 volts only; disconnect power, move SW7 to the non-SuperCap position, count to 10, and reapply power, Vdd comes up as 3.3 volts.


                            Looking at the schematic, it looks like P0[5] on the PSoC 6 is an output that causes U11 to feed P6_PMIC_EN_OUT to go to 1.8V and that is routed through SW7 becoming PMIC_EN that feeds into U6 presumably causing the adjustable (1.8 - 3.3V) regulator to come on.  Maybe there's a logic loop issues that causing my power up sequence above?


                            Here's the summary of my settings.


                            1. My target PSoC 6 Vddd is 3.3 volts.

                            2. For the purposes of this investigation, assume that I'm powering the 062-Kit board from the USB Type C connector only and plugging that into a USB port (it behaves the same if I feed +12V into J1)

                            3. It is my design intention that the board will only be supplied with +12V through J1 so the Kitporg2 should not be controlling Vbackup


                            Any more ideas?

                            • 11. Re: Battery/Super Capacitor backup power / RTC

                              Oh and I have a Rev 11 and 2 Rev 13 CY8CKIT-062-BLE PCBs, the issue has been tested on one Rev 11 and one Rev 13 PCB.


                              Also I tried this.


                              1. My white switch is set to center (+3.3V position)

                              2. Connect a voltmeter to measure between P6. Vdd (a via on the PCB right next to the SuperCap -ve terminal) and ground, I get +3.3V

                              3. Move SW7 to the SuperCap position and the measurement changes to +1.59V in my case and my code stops running

                              4. Move SW7 away from the SuperCap position and the measured voltage changes to +3.3V and my code starts running again

                              5. The observed voltages associated with the SW7 position are the same if SW7 is moved before power is applied.

                              • 12. Re: Battery/Super Capacitor backup power / RTC

                                Here it is working.


                                - New project created based on RTC Basic example

                                - changed the vBackup Source to dedicated supply (post #3)

                                - Added the check of the reset cause to not overwrite the RTC (post #7)

                                - Enabled SuperCap charging (post #1)

                                - programmed the chip

                                - SW7 to CuperCap position

                                - Precharge of the SuperCap.


                                With this I could unplug the board now for almost 6 hours and the RTC was still counting.

                                1 of 1 people found this helpful
                                • 13. Re: Battery/Super Capacitor backup power / RTC



                                  Can you upload your project please and I'll try it?





                                  1 2 Previous Next