ADC: ASF: SAMD20: Unexpected 50uA in sleep (standby). How to really turn off ADC?

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've been seeing 1.9uA going into my SAMD20 whenever I call sleepmgr_sleep(SLEEPMGR_STANDBY);

 

Except now when I started to use the ADC, I get 55uA in standby.  I isolated the line of code, which is taken straight from the ASF example:

 

void ADC_Init(void)
{
    configure_adc();
    //configure_adc_callbacks();
}

 

void configure_adc(void)
{
    struct adc_config config_adc;
    adc_get_config_defaults(&config_adc);
    

    adc_init(&adc_instance, ADC, &config_adc);
    adc_enable(&adc_instance);
}

 

It is the adc_init() function that causes the extra 53uA to show up.  Comment out the adc_enable() and I get the same current.  Put in adc_disable() right after adc_enable() and I still get the same current.

 

So I want to disable the ADC, but adc_disable() isn't doing it.  How do I "undo" the effects of adc_init() ?  The struct adc_config doesn't have a member named like "disabled", or a choice for reference disabled or dont take a clock input.

 

 

 

ANSWER:  it was the voltage reference.  disable it with system_voltage_reference_disable(SYSTEM_VOLTAGE_REFERENCE_BANDGAP);  why ASF doesn't have that inside of adc.c, I don't understand.

 

Last Edited: Thu. Oct 15, 2015 - 11:33 PM