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.

MSPM0G1519: CTL0.ENC bit and MEMCTL[y] configuration issue

Part Number: MSPM0G1519


Tool/software:

Hello,

the MSPM0G1519 reference manual states that CTL0.ENC bit must be 0 before MEMCTL[y] can be written.

Yet it is also stated that after CTL0.ENC has been set to 0 the current conversion will finish and result stored in corresponding MEMRESx.

There is an additional BUSY flag in the STATUS register offering the possibility to check if the last conversion has finished (e.g. after setting ENC=0).

Question: What happens if I set  CTL0.ENC=0 and write MEMCTL[y] immediately (which is allowed according my interpretation of the reference manual) and there is still an ongoing conversion?

In above scenario we observe that the if enabling conversions again (CTL0.ENC=1) the conversions are actually not started. The code below shows the sequence.

DL_ADC12_disableConversions(ADC1);
DL_ADC12_configConversionMem(ADC1, ...);
DL_ADC12_enableConversions(ADC1);

Yet if we wait after disabling conversion until STATUS.BUSY=0 (which is not mentioned in reference manual) then it works as expected. Working pseudo code below.

DL_ADC12_disableConversions(ADC1);
while(DL_ADC12_getStatus(ADC1) & DL_ADC12_STATUS_CONVERSION_ACTIVE) {};
DL_ADC12_configConversionMem(ADC1, ...);
DL_ADC12_enableConversions(ADC1);

Is this to be expected? Is this information missing in the reference manual?

Best Regards

Marco Marder

  • Hi Marco,

    Question: What happens if I set  CTL0.ENC=0 and write MEMCTL[y] immediately (which is allowed according my interpretation of the reference manual) and there is still an ongoing conversion

    No, this is not expexted to happen. Make sure there is no on-going ADC conversion when configure the ADC configuration register. This is not safe.

    In above scenario we observe that the if enabling conversions again (CTL0.ENC=1) the conversions are actually not started. The code below shows the sequence.

    Where the DL_ADC12_startConversion()? i think there requires a trigger signal to start the ADC Conversion.

    B.R.

    Sal

  • Hello Sal Ye,

    thank you for your feedback.


    1. Good to have confirmation that it is not allowed to change ADC configuration register when conversion is ongoing. Maybe you can state this more clearly in the reference manual.

    2. The code I provided is only pseudo-code. The conversions are triggered by hardware via a timer generating PWM signals for motor control. In the first code snippet the conversions are not enabled in cases where the config register MEMCCTL was written when there was still an ongoing conversion.

    Yet as it is not allowed to do this we are good. We will make sure to wait until conversion is finished after writing CTL0.ENC=0 before reconfig MEMCTL.

    Marco