5 Replies Latest reply on Jan 15, 2019 8:06 AM by user_246598725

    How do I test if a 32K XTAL is installed?

    user_119654

      To all,

      I have a PSoC 5LP and I enable the XTAL 32KHz in the clock editor.   Is there an official way to detect if a 32K watch XTAL is installed on the PCB?

       

      Note: If the XTAL is installed, my XTAL clock out is 32768 Hz (as expected).  If not installed, the XTAL clock out is about 1984 Hz.  Although I could perform a rough sanity check of the XTAL_32K out to the IMO, I'd prefer not to allocate the counter.

       

      I've read the CY_CLK_XTAL32_CR_REG for the analog stabilization status.  I always get a "stable" reading with or without a XTAL.

      I'm not supporting the ILO @ 32K therefore I don't expect the digital stabilization status to be valid.

       

      Len

        • 1. Re: How do I test if a 32K XTAL is installed?
          user_246598725

          Hi Len,

           

          please provide your project, so we can check.

          You wrote that you used CY_CLK_XTAL32_CR_REG. Did you use this directly or did you use the corresponding API function, along with CyXTAL_32KHZ_Start() function?

           

          Regards

          • 2. Re: How do I test if a 32K XTAL is installed?
            user_119654

            user_246598725,

             

            I've attached a very simple project.

             

            To answer your questions:  I used CY_CLK_XTAL32_CR_REG directly and CyXTAL_32KHZ_ReadStatus().  Either resulted in an answer of 0x20 = ANA_STAT = stable with or without the XTAL_32K installed.

             

            Len

            • 3. Re: How do I test if a 32K XTAL is installed?
              user_119654

              user_246598725,

               

              I may have more information.

               

              The TopDesign in the project archive has the following pin assignments:

              Pin nameOutput FreqPin #
              Pin_ILO~1000HzP0[0]
              Pin_XTAL_32Kto1K1024HkzP0[1]
              Pin_IMOto1K1000HzP0[2]
              Pin_PLLto1K1000Hz

              P0[3]

              This pin configuration always yields ANA_STAT = stable even with the XTAL_32K not installed.

               

              If I change the pin # configuration to the following:  ANA_STAT = not stable with the XTAL_32K not installed.

              Pin nameOutput FreqPin #
              Pin_ILO~1000HzP0[0]
              Pin_XTAL_32Kto1K1024HkzP0[1]
              Pin_IMOto1K1000HzP2[0]
              Pin_PLLto1K1000Hz

              P2[1]

               

              Apparently changing the other outputs "fixed" the issue.

               

              Len

              • 4. Re: How do I test if a 32K XTAL is installed?
                user_119654

                Here's some additional information from testing I've performed.

                 

                I placed the pin #s back to the original assignments.   However I changed the outputs P0[2] and P0[3] from STRONG to RESISTIVE_PULLUP_PULLDOWN. (ie. decreased the slew-rate of output changes).  This allowed the ANA_STAT = not stable when no XTAL_32K is installed!  Yeah!

                 

                Pin name

                Output Freq

                Pin #

                Drive

                Pin_ILO~1000HzP0[0]STRONG
                Pin_XTAL_32Kto1K1024HkzP0[1]STRONG
                Pin_IMOto1K1000HzP0[2]RESISTIVE_PULLUP_PULLDOWN
                Pin_PLLto1K1000Hz

                P0[3]

                RESISTIVE_PULLUP_PULLDOWN

                 

                I decided to try another test.  I was curious if the problem I'm having I associated with the fact that the CY8CKIT-059 I'm using has external 1uF caps to ground on them.  (Hence the reason I slowed the slew-rate in the test above).  For this test I changed the pin drive back to STRONG and moved them to P0[5] and P0[6] which have no external caps on the pins.  Results:  ANA_STAT = not stable when no XTAL_32K is installed!  Yeah again!

                 

                Pin name

                Output Freq

                Pin #

                Drive

                Pin_ILO~1000HzP0[0]STRONG
                Pin_XTAL_32Kto1K1024HkzP0[1]STRONG
                Pin_IMOto1K1000HzP0[5]STRONG
                Pin_PLLto1K1000Hz

                P0[6]

                STRONG

                 

                Len

                • 5. Re: How do I test if a 32K XTAL is installed?
                  user_246598725

                  Hello Len,

                   

                  glad that you got it to work. I hadn't enough time to test the initial project, sorry. I wondered why you didn't use CyXTAL_32KHZ_Start() function, which does a bit more than only starting the oscillator.

                  What confuses me is that port pins which aren't related to the XTAL are influencing the behaviour of the XTAL.

                   

                  Regards