5 years, 3 months ago.

How do I stop ADC using power after analog read on NUCLEO F411RE?

The mcu uses 14.6mA in the following test program until the button is pushed and AnalogIn on PA_0 is read. After that, the power usage is 16.1mA.

Is there anyway to disable the ADC without a reset so it stops using the extra 1.5mA until the next reading? Here is some sample code.

Test Program

#include "mbed.h"
AnalogIn vin(PA_0);
DigitalIn mybutton(USER_BUTTON);
int main()
{
    while (true) {
    	//Current is 14.6 mA 
        if(mybutton == 0) {
        	//After reading vin current goes to 
        	// 16.1 mA 
        	vin.read();
               // Reading is over for quite a while.  I want it to stop using ADC
               // and go back to 14.6mA until the next time I push the button.
        }
    }
}

1 Answer

5 years, 3 months ago.

You could check the ADC api in the Mbed library, there may be something to disable or free the ADC section of the MCU. I had a similar problem with some early Freescale MCU's with the same issue when going into deep sleep, the only way to disable the ADC was to do an nRST.

Your not saving a lot of power there, the 'F' series STM's aren't the best low power Targets, I use the 'L' series in particular the L476RG, good all-rounder, quite fast, low run power, about 12mA (80Mhz clock) and very low power sleep modes 4-5uA.

Thanks for the info. I was looking into the ADC api but haven't found anything, yet. I am kinda new at this so I may be missing things due to lack of knowledge of what to look. We are running about 16 mA with the F411RE so a 1.5mA drop is nearly a 10% savings which helps, but in the end is not a deal breaker. I am just trying to trim the fat as much as I can. I will look into using the 'L' series. We don't need speed by any means. It is imperative that we are able to put our own bootloader though. As long as we can do that and have at least 512+ of Flash and 128KB of SRAM, which the L476RG does, we should be good. We may just skip using the internal ADC and use the LTC2408 that we have on our board instead. I will post if I find the solution.

posted by Paul Moen 25 Jan 2019

Okay if energy if paramount her then yes look at the L series (I use L476RG), and incorporate sleep functions when the MCU is 'hanging about' as it were and doing nothing. Try the Nucleo version its good value . https://www.mouser.co.uk/ProductDetail/STMicroelectronics/NUCLEO-L476RG?qs=sGAEpiMZZMvc81WFyF5EdrL2yzGi9HGfJJ72E2OvwAY%3d

You can check the power consumption across JP6.

posted by Paul Staron 25 Jan 2019