7 Replies Latest reply on May 18, 2011 10:19 AM by userc_42932

    RTC Clock Input



      The datasheet for the RTC component says that it's based on a 1 PPS interrupt from a 32.768 kHz crystal.


      It would be really nice for me (and probably others) if it was possible to configure it to be based on a different signal. I'd like to run the local RTC on the PSoC chip based on the 1 PPS output signal from my GPS module. That way I would only have one clock and wouldn't need to access the GPS RTC over the UART.


      It seems like it might not be a huge change, because all the logic of responding to that interrupt would remain the same, but I might be wrong about that.


      This isn't possible, right?

        • 1. Re: RTC Clock Input

          Hi Doug Mclean,




          Are you getting a 1Hz pulse from GPS module? If so, then there is one way you can use RTC.


          I haven't tried this method yet, but it may be implemented in the following way.


          1) Use a PICU interrupt and set it to Rising edge. This pin will be connected to the 1Hz signal from the GPS module.


          2) The CY_ISR(RTC_ISR) which is available in the RTC_INT.c file (assuming the name of the RTC component used is 'RTC') is placed in the executable part of the ISR of the PICU.


          3) There is no need of using an RTC component in this project as only PICU will take care of the all the parameters.


          4) The RTC component available in PSoC Creator is a software implementation which uses 1pps clock from the 32.768KHz crystal. Hence, this can be implemented in software.

          • 2. Re: RTC Clock Input

            Wow, that is absolutely perfect, thank you very much.

            • 3. Re: RTC Clock Input

              Except that I do need to have an RTC component so that the RTC code will be generated, right?


              Will anything go wrong if I add the component, copy the code into a different place, remove the component and call the copy?

              • 4. Re: RTC Clock Input

                Hey Doug,




                Are you using the Alarm feature available in the RTC component?

                • 5. Re: RTC Clock Input

                  Hi Doug McClean,




                  There is another rather simple way to do this.


                  1) You can place an RTC Component and configure it in accordance with your requirement.


                  2) Now place a digital input pin and connect it to an Interrupt Component. This Pin must be connected to the 1 Hz Pulse from GPS.


                  3) In the main( ) function, initialize all the parameters of RTC such as sec, min, hour, date, etc But donot start the RTC Component.


                  4) In the CY_ISR of Interrupt, call the RTC_ISR( ) function which is found in the RTC_INT.c file.




                  Now the project will perform all the functions of the RTC except for the fact that the interrupt source is not the PPS from external 32.768KHz but is from an external 1Hz clock (which in this case is received from the GPS module).


                  This method is better than the previous method suggested as there is no possibility of encountering any error which may arise due to incorrect copying of the APIs and header files of the RTC component to the Pin Interrupt's ISR file.




                  A sample project was constructed and for testing purpose a 1Hz clock was brought out from a pin. The digital input pin and the clock output pins were externally connected using a wire.


                  The schematic is as shown below.











                  In the isr_1.c, the RTC_ISR( ) is called. This is shown in the snap-shot given below:









                  The project has been attached along with this post.

                  • 6. Re: RTC Clock Input



                    Thanks again.

                    • 7. Re: RTC Clock Input

                      Brilliant! This is just what I needed.