11 Replies Latest reply on Jun 15, 2020 9:01 PM by JuSe_4659276

    ADC SAR SEQ interrupt triggering continuously irrespective of threshold limit set!!

      Hi Support Team,


      Could you help solve a problem I am facing.


      I am expecting a ADC SAR SEQ interrupt to fire whenever the threshold limit compare mode is matched. But I find that the local interrupt is firing every time whether or not the threshold limit condition is met.


      Here is the code snippet I am using -


          uint32 intr_status;
          uint32 range_status;


          /* Read interrupt status registers */
          intr_status = ADC_SAR_SEQ_SAR_INTR_MASKED_REG;
          /* Check for End of Scan interrupt */
          if((intr_status & ADC_SAR_SEQ_EOS_MASK) != 0u)
              /* Read range detect status */
              range_status = ADC_SAR_SEQ_SAR_RANGE_INTR_MASKED_REG;
              if((range_status & (uint32)(1ul << CH0_Vin)) != 0u)
                  result[CH0_Vin] = ADC_SAR_SEQ_GetResult16(CH0_Vin);            


              /* Clear range detect status */
              ADC_SAR_SEQ_SAR_RANGE_INTR_REG = range_status;
              dataReady |= ADC_SAR_SEQ_EOS_MASK;


          /* Check for Injection End of Conversion */
          if((intr_status & ADC_SAR_SEQ_INJ_EOC_MASK) != 0u)
              result[TEMP_CH] = ADC_SAR_SEQ_GetResult16(TEMP_CH);
              dataReady |= ADC_SAR_SEQ_INJ_EOC_MASK;


          /* Clear handled interrupt */
          ADC_SAR_SEQ_SAR_INTR_REG = intr_status;




      int main()




          /* Init and start sequencing SAR ADC */
          /* Enable interrupt and set interrupt handler to local routine */
          Timer_Int_StartEx( Timer_Int_Handler );






      Am I missing anything here. Any help would be greatly appreciated.




      Also I looked into the ADC datasheet and find below -


      Limit detect
      This option allows you to enable an interrupt if any of the channels 0 through 7(15) or the injection channel trigger the limit criteria set by the Low limit or High limit and the Compare mode parameter.


      As per above statement, Interrupt should fire whenever limit criteria is matched.