Part Number: MSPM0C1104
I tried optimizing the power consumption of my device and can get as low as ~4.5uA on my custom hardware in STANDBY1. When requesting a short ADC measurement. however, my current consumption jumps to over 1mA. I did narrow it down to a snippet where I shortly initialise my ADC and start the conversion, then after the conversion stop it again.
This is roughly what my low power mode initialisation does.
DL_TimerA_stopCounter(PWM_INST);
DL_TimerA_disablePower(PWM_INST);
DL_I2C_disableController(I2C_0_INST);
DL_I2C_disablePower(I2C_0_INST);
DL_VREF_disableInternalRef(VREF);
DL_VREF_disablePower(VREF);
DL_ADC12_disableConversions(ADC12_INST);
DL_ADC12_disablePower(ADC12_INST);
delay_cycles(POWER_STARTUP_DELAY);
This is my problematic code. Inserting a delay_cycles with ~300us or more wait time fixes the issue.
void adc_off(void) {
DL_VREF_disableInternalRef(VREF);
DL_VREF_disablePower(VREF);
DL_ADC12_disableConversions(ADC12_INST);
DL_ADC12_disablePower(ADC12_INST);
delay_cycles(POWER_STARTUP_DELAY);
}
void adc_on(void){
DL_VREF_enablePower(VREF);
DL_VREF_enableInternalRef(VREF);
DL_ADC12_enablePower(ADC12_INST);
DL_ADC12_setStartAddress(ADC12_INST, DL_ADC12_SEQ_START_ADDR_00); // manual repeat of ADC sequence
DL_ADC12_enableConversions(ADC12_INST);
DL_ADC12_startConversion(ADC12_INST);
delay_cycles(POWER_STARTUP_DELAY);
}
void my_conversion(void) {
adc_on();
while (interrupt_received == false) {;}
delay_cycles(24*100*3); // fixes issue
adc_off();
}
Why exactly could this occur? Why does a delay annul this issue? Why 300us? The time seems quite long to me for a 24MHz device.
When I remove the while loop and the delay, the issue also doesn't occur (no optimization). In that case, however, I assume that the registers have not been processed before turning ADC off again.
CTL0 = 0x05000000 CTL1 = 0x00010000 CTL2 = 0x03000000
