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.

MSPM0G1506: When performing ADC, it is very rare that the AD count will reach 0.

Part Number: MSPM0G1506

Tool/software:

When using the ADC, the AD count may become 0.
I was only able to reproduce the issue once during debugging, so I'm having trouble figuring out the cause.
When I was able to reproduce the issue, Enable Conversion (ENC) was enabled and DL_ADC12_INTERRUPT_MEM0_RESULT_LOADED also occurred.


Breaking while it's happening will prevent the issue from reoccurring


Is there anything that could be causing this problem?
Sorry for the general question, but thank you in advance.

  • Hi,

    Usually, a low sampling time would cause the ADC readings abnormal. You can try with a higher sampling time and test. 

    Best regards,

    Cash Hao

  • Thank you.

    I understand that your opinion is that if the sampling time is too short, the AD count will be 0.
    I think there is no problem with the sampling time setting and the hardware, but sometimes the AD count becomes 0.
    Could the reason why sampling is not performed correctly and the AD count becomes 0 be that the sampling time is not being applied?

  • Hi,

    I do not think that could be the reason since the ADC module is working independently and the sampling time should always applied as expected since it is a part of ADC module. I think the issue is more relates to how you process the ADC results under debug mode. There could be some timing issue when approaching to the ADCMEM resisters and causes error. 

    Best regards,

    Cash Hao

  • Hello,

    Is the timing issue something that has been reported in Errata or similar?


    I have reproduced the problem and confirmed that when the AD count is 0, the MEMRES DATA is also 0.
    Therefore, by using debug operations to change CTL0>ENC from OFF to ON and set CTL1>SC to START, I was able to confirm that the MEMRES data was as expected.


    Is it possible that ENC is ON, but the conversion started before it was actually ready, causing the problem?
    After executing DL_ADC12_enableConversions, is it necessary to implement an API that notifies me that something has been prepared?

  • Hello,

    Additional information
    I did not implement the ADC STATUS REFBUFRDY check, could that cause problems?

  • Hi,

    About the timing issue, I mean it could relate to the debug mode. And it will not include in errata since it is not a device failure. 

    I am not quite understand the reproduce process. You were manually change the CTL0>ENC from OFF to ON and then set CTL1>SC to START in debug register interface. Then you will get zero result in MEMRES? Can you help confirm the process?

    Best regards,

    Cash Hao

  • Hello,

    Thank you for your reply.

    The problem occurs even when not in debug mode.


    When ENC⇒ON and SC⇒START are performed, the MEMRES value becomes a value other than 0.

  • Hi,

    I am a little confuse here. When ENC⇒ON and SC⇒START are performed, it is supposed to get a value here. 

    Best regards,

    Cash Hao

  • Hello,

    Explain the process
    The problem of ADC Count becoming 0 can be confirmed in ⑨ below.
    When the ADC Count becomes 0, the MEMRES DATA is always 0. At this time, ENC is ON.


    After that, if you change the debugger register to ENC ⇒ OFF ⇒ ON and SC ⇒ START, MEMRES DATA will become a non-zero value.


    ①ADC reset
    ②ADC enable power
    ③delay 50us
    ④ADC disable
    ⑤ADC setting
    ⑥ADC enable
    ⑦ADC start
    ⑧wait ADC MEMRESIFG set
    ⑨ADC get data
    ⑩clear ADC MEMRESIFG
    ⑪ Loop ⑧, ⑨, ⑩
    ⑫Complete

  • Hello,

    Additional information
    The ADC uses Single Channel, Repeat mode and Average mode.


    Also, the power-down mode is set to AUTO.
    The datasheet says that ADC wakeup requires 5us.
    Since the power-down mode is set to AUTO, you may need to set the SCOMP value taking into account the 5us wake-up time.

  • Hi,

    Okay. Let me run some test early next week and give you feedback then.

    Best regards,

    Cash Hao

  • Thank you.
    I'd like to give you one more thing to say.


    I don't understand the notes in the REF. MANUAL about when PWRDN is 0.


    At what point should I consider waking up?
    If you have any sample code, please share it.

  • Hi,

    This note means if you configure ADC power down policy to AUTO, then you need to use a longer sampling time configuration to cover the ADC enable time. 

    If you choose to use manually mode, then you do not need to care about this NOTE.

    Best regards,

    Cash Hao

  • Thank you.


    Is the sample time only considered once after the conversion has started?
    Do I have to consider the sample time when performing a conversion in REPEAT mode?


    If you set it to MANUAL, there is a concern that power consumption will increase.
    Currently I am using AUTO as it is not mentioned in the datasheet.

  • Hi,

    It only needs to consider once on the sampling time after starting the conversion. You do not need to consider it in REPEAT mode. 

    And yes, the power consumption will be increased using MANUAL mode comparing to AUTO mode.

     Best regards,

    Cash Hao

  • Hello,

    Thank you for answering my basic question.
    Regarding the SCOMP issue, we have determined that it is not the cause of the problem because REPEAT mode is being used.


    Please continue to provide feedback on the following:
    e2e.ti.com/.../5871188

  • TEST_adc12_internal_temp_sensor_mathacl_LP_MSPM0G3507_nortos_ticlang.zip

    Hello,

    I was able to reproduce the same issue by modifying the sample project.


    This may be difficult to understand, but could you please use this to check?

  • Hi,

    Okay. I will test on this project and give you feedback then.

    Best regards,

    Cash Hao

  • What is the status of confirmation?
    I want feedback as soon as possible

  • Hi,

    Sorry for the late response. 

    The description of your post and your code does not match. I do not know why you call DL_ADC12_configConversionMem twice with different settings in the while loop. But after I modify the ADC from AUTO trigger to software trigger mode and use a longer sampling time by calling DL_ADC12_setSampleTime0(ADC12_0_INST, 41);  I do not observe any issues on my side.

    Best regards,

    Cash Hao

  • Dear Cash Hao,

    thank you for your reply


    DL_ADC12_configConversionMem is called twice for convenience of processing, and there is no problem if it is consolidated into one call.


    Did you confirm that you were able to retrieve data by manipulating the register (ENC OFF→ON, SC START)?
    You can check this by setting a breakpoint at line 125, DL_ADC12_getMemResult.

    I'd like to understand exactly what the problem was.


    Thank you for suggesting the solution.
    The problem is still unclear, but why does changing the sampling time and SW trigger mode solve the problem?

  • Hi,

    I am going to share the modified test code here. You can compare the difference on this one. 

    7851.TEST_adc12_internal_temp_sensor_mathacl_LP_MSPM0G3507_nortos_ticlang.zip

    Best regards,

    Cash Hao

  • Dear Cash Hao,

    Thank you for your encouraging support.


    If you specify the SCOMP setting on line 118 as follows,
    DL_ADC12_setSampleTime0(ADC12_0_INST, 5);
    adcResult[0] records the value 224, but adcResult[1]~adcResult[99] are 0.

  • Hi,

    That just means the sampling time is not enough as set to 5. You need a longer sample time configuration. 

    Best regards,

    Cash Hao

  • Dear Cash Hao,

    thank you for your reply.


    Question 1
    Does changing ADC_MEMCTL.TRIG to Manual have anything to do with the issue of AD count becoming 0?


    Question 2
    This is a question that comes from knowing that the sampling time is short.
    Even if the sampling time is 5, if ADC_CTL0.PWRDN is MANUAL, the AD count will not become 0.
    Why is this?

  • Dear Cash Hao

    Question 1
    Does changing ADC_MEMCTL.TRIG to Manual have anything to do with the issue of AD count becoming 0?


    Question 2
    This is a question that comes from knowing that the sampling time is short.
    Even if the sampling time is 5, if ADC_CTL0.PWRDN is MANUAL, the AD count will not become 0.
    Why is this?

    I would like to know the status of this confirmation.

  • Hi,

    1. I do not think the trigger mode would impact the ADC sampling. I am using the manual because I can control the flow easier. 

    2. When the ADC_CTL0.PWRDN  is manual, the ADC will not be disabled unless you call disable ADC function in the software. The disabling and reenabling ADC cost extra time and requires a longer sampling time here. 

    Best regards,

    Cash Hao