6 Replies Latest reply on Jun 7, 2017 6:00 PM by yuhua64_2322796

    May I start two timers concurrently

    yuhua64_2322796

      Hi, 

         

      May I start two timers concurrently ?  How to do ?

         

      I have two timers need to start concurrently,  (1). may I tie these two start pin together and start them using a signal(Pin_TimerStart) to enable it ? 

         

      Or, (2) May I use the cc signal of Timer_Begin to start Timer_End, Only use firmware to start Timer_Begin, then cc to trigger End_Timer.

         

      And the event timing is enough to trigger or not ?    

         

      I can start them individually, I use these to two timers cc event path to activate different task, and functional work. But, timing is critical, the timing difference can not be allowed. 

         

      Thanks

        • 1. Re: May I start two timers concurrently
          user_1377889

          Best would be to use a common signal to start the two timers. This could be a hardware generated signal, an IO-pin or the output of a software controlled control register component. Yes, of course you may tie some input signals together and control them with a single signal.

             

           

             

          Bob

          • 2. Re: May I start two timers concurrently
            user_1377889

            Deep sleep will shutdown the fast clocks which you use for your timers. Can you try to evaluate your problem without using WDT and deep sleep?

               

            You may not see the LEDs flashing, they will be turned on for a few 100ns only.

               

            Your pins are not locked and may change with every build.

               

            Starting the timers do not require a pin (except you want that). you may use a control register component.

               

             

               

            Bob

            • 3. Re: May I start two timers concurrently
              e.pratt_1639216

              Timer Components will not be able to run while in deep-sleep mode.

                 

              Also, you can start the timers by calling Timer_Begin_Start(); and Timer_End_Start(); rather than using a hardware pin to start both of them at the same time. (the different will be a few clock cycles of ns timing)

              • 4. Re: May I start two timers concurrently
                yuhua64_2322796

                Pratt, 

                   

                Thanks for your response! 

                • 5. Re: May I start two timers concurrently
                  yuhua64_2322796

                  Hi, Bob, 

                     

                  I tried to use one port/pin ( Pin_StartTimer connect to Pin_1 via a physical wire ) to control two timers start concurrently, not work! 

                     

                  I have to start them individually,  I attached my testing file, please point the failure cause. Thanks!  

                     

                  CY_ISR(isr_WDT)
                  {
                      /* clear interrupt flag to enable next interrupt */
                      CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);  

                     

                  /* it work when enable below two lines. */
                  //    Timer_Begin_Enable();     
                  //    Timer_End_Enable();

                     

                  /* generate a trigger start signal */
                      Pin_StartTimer_Write(0u);  
                      Pin_StartTimer_Write(1u);
                      Pin_StartTimer_Write(0u);
                  }

                  • 6. Re: May I start two timers concurrently
                    yuhua64_2322796

                    Bob,

                       

                    Thanks for your answer.  

                       

                    I lost to lock pin, after I fixed this mistake, it still is not work. So, I use Control register component to Timer_Start Port.

                       

                    CY_ISR(isr_WDT)
                    {   /* It will wakeup from deep sleep, if  it could enter into this service routine. */ 
                        /* clear interrupt flag to enable next interrupt */
                        CySysWdtClearInterrupt(CY_SYS_WDT_COUNTER0_INT);  

                       

                    #if IndividualControlAndSequential
                        Timer_Begin_Enable();
                        Timer_End_Enable(); // it is work, but result is not well for some reason.

                       

                    #endif

                       

                    #if UseHardwarePinControl
                    /* Failed */    
                        Pin_StartTimer_Write(0u);
                        Pin_StartTimer_Write(1u);
                        Pin_StartTimer_Write(1u);
                        Pin_StartTimer_Write(1u);
                        Pin_StartTimer_Write(0u); // NG

                       

                    #endif

                       

                    #if UseControlRegisterComponent 
                        Control_Reg_1_Write(0u);
                        Control_Reg_1_Write(1u);
                        Control_Reg_1_Write(1u);
                        Control_Reg_1_Write(1u);
                        Control_Reg_1_Write(0u); // NG.

                       

                    #endif
                    }