This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320F280049: ADC Power-Up Sequence delay time

Part Number: TMS320F280049

Hi Champ,

From the F280049 TRM ,there have below description, :

13.12 Power-Up Sequence

Upon device power-up or system level reset, the ADC will be powered down and disabled. When

powering up the ADC, use the following sequence:

1. Set the bit to enable the desired ADC clock in the PCLKCR13 register.

2. Set the desired ADC clock divider in the PRESCALE field of ADCCTL2.

3. Power up the ADC by setting the ADCPWDNZ bit in ADCCTL1.

4. Allow a delay before sampling. See the data manual for the necessary time.

 

 

I have below question :

1.The delay time means power Up Time( which Max value is 500uS in the datasheet)?

2.If no delay time or delay time is not enough , what will happen? does it possible that the ADC will stop converting even the SOC  trigger  always  generated.


  • Hi Johnson,

    The ADC has an internal bandgap that is used for proper operation.  This bandgap has to powerup first before ADC operation can take place and the bandgap powers up when ADCPWDNZ is set.  If bandgap has not settled by not allowing time after powerup, conversions will not be reliable.

    Regards,

    Joseph

  • Hi Joseph,

    If bandgap has not settled by not allowing time after powerup, conversions will not be reliable.

    Does it possible that the ADC module will stop conversion? even the  SOC always  generated?

    My customer met issue after ADCPWDNZ is set ,with1000us delay, the ADC module will stop conversion sometimes, if the ADC stop conversion ,   just power off / on  the board again then the ADC can  working normal. when the issue happened , the ADC related ADC control register value are correct.

  • Hi Joseph,

    Sorry , i made mistake , customer code with 1000us delay , the code like below:

    ADC_enableConverter(ADCA_BASE);
    DEVICE_DELAY_US(1000);

    By the way ,from the datasheet  when using internal reference mode the power up  max time  is 5000us, but  our example code just 1000us.

    you can refer to following driverlib code. This is bug or no issue?

    ADC_enableConverter(ADCA_BASE);
    DEVICE_DELAY_US(1000);

  • Hi Joseph,

    If possible , i'd like to discuss with you by E-mail, my E-mail is :Huihuang-chen@ti.com.

    Thanks!

  • Hi Huihuang,

    The example codes were written as basis for application and is always good to reference the datasheet.  I think in this case the power up time used in the example codes were intended for the external reference mode.  Using internal reference mode, user has to allow more time for bandgap to power up so for the case of internal reference this delay time has to be accounted for.  I do not necessarily consider this as a bug since there is no way to predict what the customer will end up configuring the voltage reference mode to be.   Maybe we can add a note somewhere in the ADC power routine that will state that datasheet has to be checked for the exact delay time required after ADC power up, if this is beneficial for the customer?

    On your other question regarding generation of SOC, ADC will still continue to convert as SOC will be independent of bandgap.  It is just that the conversions will not be accurate since bandgap has not yet settled.

    Hope this answers your questions.

    Regards,

    Joseph

  • Hi Joseph ,

    My customer met issue that the ADC will stop converting, sometimes,

    the ADC initial code as following, the CPUTIMER0 and EPWM1_SOCA be initialed before ADCDriverInitialize(); TCPUTIMER0 is 1mS, EPWM1_SOCA  period is 10us  ,sometimes the ADCA module will stop converting, but ADCB and ADCC are working normal,other function like CAN communication also no issue.

    When the ADCA issue happened ,just power OFF/ON the board again  then the  ADCA can resume working.

    void ADCDriverInitialize(void)
    {
    ADCInitialize();

    /* Configure SOCs of ADCA */
    //ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_DCS_EN5, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN5, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_LV_12V_VOLTAGE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN6, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_CHARGE_GUN_TEMP1, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN9, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_OUTPUT_DC_VOLTAGE, ADC_TRIGGER_EPWM1_SOCA, ADC_CH_ADCIN1, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_OUTPUT_DC_CURRENT, ADC_TRIGGER_EPWM1_SOCA, ADC_CH_ADCIN0, 10);

    /* Configure SOCs of ADCB */
    ADC_setupSOC(ADCB_BASE, (ADC_SOCNumber)SOC_CP_VOLTAGE, ADC_TRIGGER_SW_ONLY, ADC_CH_ADCIN1, 10);

    /* Configure SOCs of ADCC */
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_THS2_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN3, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_TAIR_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN4, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_THS_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN5, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_CHARGE_GUN_TEMP2, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN8, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_CC_VOLTAGE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN14,10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_OBC_EN_DT, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN1 ,10);
    }

    static void ADCInitialize(void)
    {
    /* Setup VREF as internal */
    ADC_setVREF(ADCA_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_3_3V);

    /* Set ADCCLK divider to /4 */
    ADC_setPrescaler(ADCA_BASE, ADC_CLK_DIV_4_0);

    /* Set pulse positions to late */
    ADC_setInterruptPulseMode(ADCA_BASE, ADC_PULSE_END_OF_CONV);

    /* Setup VREF as internal */
    ADC_setVREF(ADCB_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_3_3V);

    /* Set ADCCLK divider to /4 */
    ADC_setPrescaler(ADCB_BASE, ADC_CLK_DIV_4_0);

    /* Set pulse positions to late */
    ADC_setInterruptPulseMode(ADCB_BASE, ADC_PULSE_END_OF_CONV);

    /* Setup VREF as internal */
    ADC_setVREF(ADCC_BASE, ADC_REFERENCE_INTERNAL, ADC_REFERENCE_3_3V);

    /* Set ADCCLK divider to /4 */
    ADC_setPrescaler(ADCC_BASE, ADC_CLK_DIV_4_0);

    /* Set pulse positions to late */
    ADC_setInterruptPulseMode(ADCC_BASE, ADC_PULSE_END_OF_CONV);

    /* Power up the ADCS */
    ADC_enableConverter(ADCA_BASE);
    ADC_enableConverter(ADCB_BASE);
    ADC_enableConverter(ADCC_BASE);

    /* delay for 1 ms */
    DEVICE_DELAY_US(1000);
    }

    Attached are the ADC register value when ADC working normal and not working.

    ADCRGE.doc

    The main difference are ADCSOCFLG1 and  ADCSOCOVF1  value, when ADCA working normal these two register are 0x00, when ADCA not working  these two register are 0x243.

    Customer have done one more testing , which just changed the SOC configure sequence , the code as following, then ADCC module will stop converting sometimes. ADCA and ADCB module  are working normal.

    void ADCDriverInitialize(void)
    {
    ADCInitialize();

    /* Configure SOCs of ADCC */
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_THS2_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN3, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_TAIR_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN4, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_THS_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN5, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_CHARGE_GUN_TEMP2, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN8, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_CC_VOLTAGE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN14,10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_OBC_EN_DT, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN1 ,10);

    /* Configure SOCs of ADCA */
    //ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_DCS_EN5, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN5, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_LV_12V_VOLTAGE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN6, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_CHARGE_GUN_TEMP1, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN9, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_OUTPUT_DC_VOLTAGE, ADC_TRIGGER_EPWM1_SOCA, ADC_CH_ADCIN1, 10);
    ADC_setupSOC(ADCA_BASE, (ADC_SOCNumber)SOC_OUTPUT_DC_CURRENT, ADC_TRIGGER_EPWM1_SOCA, ADC_CH_ADCIN0, 10);

    /* Configure SOCs of ADCB */
    ADC_setupSOC(ADCB_BASE, (ADC_SOCNumber)SOC_CP_VOLTAGE, ADC_TRIGGER_SW_ONLY, ADC_CH_ADCIN1, 10);


    }

    Could you advise the possibility  of this issue?

    I worry the issue be cause by power up time delay time not enough.

  • ADD SOC number define.

    the SOC number define as following:

    typedef enum
    {
    //SOC_DCS_EN5 = ADC_SOC_NUMBER5,
    SOC_LV_12V_VOLTAGE= ADC_SOC_NUMBER6,
    SOC_CHARGE_GUN_TEMP1 = ADC_SOC_NUMBER9,
    SOC_OUTPUT_DC_VOLTAGE = ADC_SOC_NUMBER1,
    SOC_OUTPUT_DC_CURRENT = ADC_SOC_NUMBER0,

    SOC_ADCA_MAX_TYPE
    }TE_ADCA_SOC_CHOOSE;

    /* choose SOC */
    typedef enum
    {
    SOC_CP_VOLTAGE = ADC_SOC_NUMBER1,

    SOC_ADCB_MAX_TYPE
    }TE_ADCB_SOC_CHOOSE;

    /* choose SOC */
    typedef enum
    {
    SOC_OBC_EN_DT = ADC_SOC_NUMBER1,
    SOC_THS2_TEMPERATURE = ADC_SOC_NUMBER3,
    SOC_TAIR_TEMPERATURE = ADC_SOC_NUMBER4,
    SOC_THS_TEMPERATURE = ADC_SOC_NUMBER5,
    SOC_CHARGE_GUN_TEMP2 = ADC_SOC_NUMBER8,
    SOC_CC_VOLTAGE = ADC_SOC_NUMBER14,

    SOC_ADCC_MAX_TYPE
    }TE_ADCC_SOC_CHOOSE;

  • HI Joseph,

    Sorry, Forget the ADD SOC number define.

    the SOC number define as following:

    typedef enum
    {
    //SOC_DCS_EN5 = ADC_SOC_NUMBER5,
    SOC_LV_12V_VOLTAGE= ADC_SOC_NUMBER6,
    SOC_CHARGE_GUN_TEMP1 = ADC_SOC_NUMBER9,
    SOC_OUTPUT_DC_VOLTAGE = ADC_SOC_NUMBER1,
    SOC_OUTPUT_DC_CURRENT = ADC_SOC_NUMBER0,

    SOC_ADCA_MAX_TYPE
    }TE_ADCA_SOC_CHOOSE;

    /* choose SOC */
    typedef enum
    {
    SOC_CP_VOLTAGE = ADC_SOC_NUMBER1,

    SOC_ADCB_MAX_TYPE
    }TE_ADCB_SOC_CHOOSE;

    /* choose SOC */
    typedef enum
    {
    SOC_OBC_EN_DT = ADC_SOC_NUMBER1,
    SOC_THS2_TEMPERATURE = ADC_SOC_NUMBER3,
    SOC_TAIR_TEMPERATURE = ADC_SOC_NUMBER4,
    SOC_THS_TEMPERATURE = ADC_SOC_NUMBER5,
    SOC_CHARGE_GUN_TEMP2 = ADC_SOC_NUMBER8,
    SOC_CC_VOLTAGE = ADC_SOC_NUMBER14,

    SOC_ADCC_MAX_TYPE
    }TE_ADCC_SOC_CHOOSE;

  • Hi Huihuang,

    I noticed that ADC setup is internal VREF mode so to get better results especially on the first conversions, recommend using a delay of 5000us to ensure bandgap settling.  This however is not the reason why ADCA stopped converting.  Based from your attached register dumps, there is SOC overflow and it shows that all SOCs associated with ADCA (SOC9, SOC6, SOC1 and SOC0) have pending conversions.  This happened because the triggers for ADCA occur at different periods (10us and 1ms) and if such is the case there will be a duration when all the 4 SOCs will be receiving triggers while conversion is still happening.  This is what causes the overflow flag to be set and this will prevent ADCA from converting and ADC will be in this state (frozen) unless the flag is cleared by writing to ADCSOCOVFCLR1.

    One way to deal with overflow is to regularly poll for the OVF flag and clear it as soon as a bit is set but with the current trigger set up on ADCA where 2 SOCs are  converting at faster 10us intervals and 2 channels at slower 1ms intervals, overflow may always happen and polling/clearing the SOC overflow flag will affect the throughput.  Another idea is to move the longer 1ms trigger period to ADCB if it is easy to modify the HW so that ADCA will only be triggered by 10us period and likelihood of having SOC overflow will be minimized.

    Regards,

    Joseph

  • HI  Joseph,

    Thanks a lot for your feedback.

    I still have below qestion:

    1.ADCC just use CPU TIMER0(1mS)  as SOC trigger , it is impossible Overfolw. You can refer to below code.

    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_THS2_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN3, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_TAIR_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN4, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_THS_TEMPERATURE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN5, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_CHARGE_GUN_TEMP2, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN8, 10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_CC_VOLTAGE, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN14,10);
    ADC_setupSOC(ADCC_BASE, (ADC_SOCNumber)SOC_OBC_EN_DT, ADC_TRIGGER_CPU1_TINT0, ADC_CH_ADCIN1 ,10);

    2. Based on my understanding the SOC overflow should not stop ADC converting , but just hardware trigger was missed.

    Could you double confirm the SOC overflow will case ADC stop converting?

    when the issue happened , the ADC will always stop converting(the ADC result register  will not update keeping the last time result), but the SOC will always generated, just power off/power on the board then  the ADC will work again.

  • Hi Johnson,

    That depends on how the customer is polling for end of conversion for an SOC.  Would you please check how this done? is the ADCINTx flag(s) polled and cleared after successful conversion?

    Thanks,

    Joseph

  • Hi Joseph,

    Based on my understanding If  ADCINTX  be not clear that  means ADCINTX will not generate any more.

    But that should not stop ADC conversion?

    Please correct me if my understanding is wrong !

    The issue is that ADC will stop converting the ADC result will not update anymore.

    If it is  ADCINTx flag(s) polling and clear issue, why just change ADCA and ADCC  SOC initial sequence then ADCA module will no issue, but ADCC module will have same  issue?

  • Hi Johnson,

    You are correct, not clearing the interrupt should not stop the ADC from converting however if the polling/clearing of ADCINT or OVF flag uses a while loop which is something like this:

    while(!ADCINTFLG.bit.ADCINT1);

          ADCINTFLGCLR.bit.ADCINT1 = 1; // clear the interrupt bit

    and the interrupts are happening quite often and are not serviced or not cleared fast enough then code will be stuck in the polling statement (while loop in example above).  It would appear as if the ADC stopped converting in this case.  Maybe this is what is happening with the code.  I don't think i have seen the code snippet where ADC results are ready to be read after EOC/ADCINTx.  Is it possible you can share that too?

    Thanks,

    Joseph

       

  • HI Joseph,

    As i mentioned before, the code function except the ADC  are both working normal, CAN communication ,  main loop both working.

    The ADC result register and control register are both be send out by CAN, when issue happened, the ADC result will not update any more and the ADC control register value are shared before . the failure has no relation with ADCINT.

    I wound advise we focus on below two points:

    1.In which case the ADC will stop converting when the ADC control register are both correct and SOC also generate.

    2.Why just change the ADCA and ADCC SOC configuration sequence, then the failure ADC module will changed from ADCA to ADCC?

  • Hi Johnson,

    I understand your point but we really have to know how the customer is polling for end of conversion and reading out the data.  I have ran experiments on bench to cause overflow and still issuing SOC triggers and confirmed that the result registers are updating.  The code snippet below is typically used in the SW examples. 

    //
    // Wait for ADCA to complete, then acknowledge flag
    //
    while(ADC_getInterruptStatus(ADCB_BASE, ADC_INT_NUMBER1) == false)
    {
    }
    ADC_clearInterruptStatus(ADCB_BASE, ADC_INT_NUMBER1);
    sensorSample += ADC_readResult(ADCBRESULT_BASE, ADC_SOC_NUMBER0);

    If customer is using the similar polling scheme and not clearing the interrupts or overflow flags then code will be stuck in the while loop which would seemingly indicate that ADC stopped working. 

    Regards,

    Joseph

  • Hi Joseph,

    I understood your point!

    Customer CAN communication using polling not interrupt.

    The CAN send out  ADC RESULT register is direct access to the the ADC result register address  not though other variable.

    If this is ADC polling issue, then change ADCA and ADCC SOC configure sequence also will has the same issue.

    So please ignore the ADCINT issue. this issue is not happen every time, this is random failure, not happen every time, but if failure happened, just power off and power on the board ,then the ADC can working normal.

    Customer has many project which with the same PWM, CPUTIMER0, ADC initial sequence, but just this project met this issue, seems the issue related  with the code execute timing.

  • HI Joseph,

    Customer did polling ADCINT in their code.

    Also didn't enable ADCINT in PIE.

    More information for your reference:

    Before ADCDriverInitialize() function, customer code already done below configuration:

    1.initial the PWM1 module and CPUTIMER0 , and PWM1 and CPUTIMER0 start working,

    2.Configure the  EPWM1_SOCA or TINT0 as ADCA SOC trigger.

    So the EPWM1_SOCA or TINT0 may generated during execute following ADC power up code

    ADC_enableConverter(ADCA_BASE);
    ADC_enableConverter(ADCB_BASE);
    ADC_enableConverter(ADCC_BASE);

    if not configure  the  EPWM1_SOCA or TINT0 as ADCA SOC trigger before ADCDriverInitialize() function, the ADC will working normal.

    So we suspect the issue be caused by  SOC generated during ADC Power up, then caused the ADC stuck under unknowning reason.

    Please advise it is possible or not?

  • Hi Huihuang,

    There isn't any way for the ADC to get stuck that I know, especially if you are sure the ADC control registers are the same in both cases. 

    Do the results make sense, or are they saturated at one of the extremes (0 or 4095)?  If they are saturated, they could still be updating, but you can't tell because something is forcing the results to be invalid.

    Otherwise I think you need to investigate the trigger sources.  Is it possible that something in the ADC setup code is disabling or otherwise modifying the trigger sources?  

  • Hi Devin,

    I summary customer initial  sequence as following:

    Step 1.Configure the ADCA SOC0 and SOC1 trigger by EPWM1_SOCA  ,ADCC SOC0 also trigger by EPWM1_SOCA  

    Step 2.Configure the EPWM1 and EPWM1 TBCTR start running.

    Step 3.Configure the CPUTIMER0 (1mS) and start running.

    Step 4.Initial the ADC(will power up the ADC)

    Step 5.Configure the ADCA, ADCB, ADCC SOC.

    After above  initialized, the code never change the ADC configuration , also when issue happen  the readback ADC control register are both sames.

    The ADCA using EPWM1_SOCA and CPUTIMER0 as trigger source,since  the ADCA and ADCC both using CPUTIMER0 as trigger, the ADCC still working normal , that means the CPUTIMER0 trigger generated.

    The EPWM1 also working normal will issue happen, customer has confirm it by monitor the PWM ouput.

    The EPWM1_SOCA  also never change after initialized,

    The ADCA SOC0 and SOC1 trigger by EPWM1_SOCA  ,、SOC6 and SOC9 trigger by CPUTIMER0。

    When issue happened , the ADC  SOC0 result  are 2260, ADC SOC6 and SOC9  result are both 0.

    but the ADC result is not correct, and never update with the external input signal.

    if remove the step 1(1.Configure the ADCA SOC0 and SOC1 trigger by EPWM1_SOCA  ,ADCC SOC0 also trigger by EPWM1_SOCA ) 

    The ADC will working normal!

    So we suspect the issue happened during  during ADC power on the ADCA SOC0 and SOC1 be triggered by ePWM-SOCA.

    Which caused the ADC stuck under unknown reason.

    This issue happened randomly not happened on every time power on.  10 times power on may met issue 2 times , but when issue happened, the issue will always exist till power off. 

  • Hi Huihuang,

    What is the purpose of step 1?  It must also configure the ePWM?  Is it possible that the step changes something in the ePWM which still allows the ePWM to output a waveform, but which otherwise modifies the ePWM-->ADC trigger?  Does it modify the ePWM sync. scheme?  Does it modify EALLOW/EDIS? 

    Probably the next step would be to see if you and/or the customer can reduce the issue to a reproducible code example.  More or less cut away as much unrelated code as possible until you have a minimal example that demonstrates the issue on the Launchpad or ControlCard.     

  • Hi Devin,

    Based on the function we can say step 1 is no means , but customer initial code just  has step1. Customer  have workaround for this issue, but they just want to found the root cause why the ADC will stop converting. Otherwise they still without confidence  about this workaround.

    There has no other place to disable the PWM ADC trigger, And ADCA also used TINT0 as trigger , but the SOC6 and SOC9  also stop converting.

    When issue happened, the ADCSOCOVF1 and ADCSOCFLG1 alwasy 0x243 that means SOC9,SOC6,SOC0,SOC1 generated, but overflow.

    (The ADCA SOC0 and SOC1 trigger by EPWM1_SOCA  ,SOC6 and SOC9 trigger by CPUTIMER0).

    It is hard to try repeat the issue with minimum project ,because:

    1.Change some code that no relation to the ADC or PWM,or CPUTIMER0 ,the issue will also not happen.

    2.the issue is happen randomly.

    it seems the issue related to the code execute timing. i will let customer try to repeat the issue with a minimum project.

    Please also help to analysis the possibility that may cause the ADC stop converting.