3 Replies Latest reply on Aug 2, 2019 3:39 AM by LePo_1062026

    ADC_SAR_Seq v2 Stops giving Interrupts

    vina_1473901

      Hi ,

        IN CY8C5468AXI-LP106 , We have used ADC_SAR_Seq for reading some senors . And used a timer to trigger the reading (every 10ms ). On completion ADC_SAR_Seq ISR we are reading sensor data to a global buffer .

      Block.JPG

      CY_ISR_PROTO(ADC_ISR);

      ADCSensor_Start();

      ADCSensor_IRQ_Enable();  

      ADCSensor_IRQ_StartEx(ADC_ISR);

       

      CY_ISR(ADC_ISR)

      {

          // NON BLOCKING LOGIC of reading

       

          /* Re intialize the timer count  */

          Timer_WriteCounter(Timer_INIT_PERIOD);

          /* Read and clear Timer ISR */

          Timer_STATUS;

      }

       

      We are facing one strange problem.  Out of thousands of units in few places this ADC reading ISR is stopped . When we powered off and ON the unit the ADC reading resumed as expected .

       

      ADC ISR code is really straight forward .  We have ruled out Stack overflow / corruption scenarios .

       

       

      So my question is ,

      from the above implementation anyone seeing any issue ? 

      Is there any known issues in ADC_SAR_Seq   that can cause this behaviors ?

      Any internal error can cause ADC_SAR_Seq  to stop giving ISR ? .

       

      any help would be greatly appreciated .  

        • 1. Re: ADC_SAR_Seq v2 Stops giving Interrupts
          LePo_1062026

          vina,

           

          You are using a hardware interrupt to generate the soc input of the SAR.  Are you performing any API calls to the Timer outside the ISR?  If so, you may be unintentionally resetting and clearing the Timer register preventing the ISR from being executed.  This might be the equivalent of the "chicken and egg" problem.

           

          Additionally, are you changing the period value to different values?  If not, don't execute Timer_WriteCounter(Timer_INIT_PERIOD);  It's not needed.

           

          If you want to generate 10ms soc signal with less CPU intervention, set the Period to 10000 and connect the soc input to the tc output of the Timer.

           

          Once you start it with your above code, the ISR is not needed.  The soc input will get a strobe every 10ms without further CPU intervention.  As long as the Timer is not stopped, the Timer will reload the Period itself and start the counting over again and again.  This is much simpler and more dependable and doesn't depend on having enough CPU bandwidth or if you accidentally turned off Global interrupts.

           

          Len

          • 2. Re: ADC_SAR_Seq v2 Stops giving Interrupts
            vina_1473901

            Hi Len ,

            Thank you for the reply .

             

            Q- Are you performing any API calls to the Timer outside the ISR?

             

            Ans - No , This timer is only used for SAR

             

            Q - are you changing the period value to different values?

             

            Ans -  No , But Timer_WriteCounter(Timer_INIT_PERIOD); is used to get exact 10ms after reading ADC data .

             

            Using TC instead of an ISR is a very good suggestion .

             

            The problem I am facing is this issue is not reproducible , unit will run days without any issue . Interestingly all other ISR and FreeRTOS tasks are running properly during this issue . Only this timer stopped .

            • 3. Re: ADC_SAR_Seq v2 Stops giving Interrupts
              LePo_1062026

              vina,

               

              By using the Timer's TC only instead of the ISR, you eliminate potential CPU generated issues.  It's all HW driven once the HW is launched (started).  If you also place a output pin attached to the TC output, you can monitor if the Timer is stopped.

               

              If the Timer is stopped, TC will not pulse.  If the Timer is not stopped but the ADC conversions have stopped, the problem is on the ADC side of the SW (or HW).  Likewise, you can place a output pin on the ADC EOC output to monitor the HW state of the ADC.

               

              Len