2014-10-07 06:24 AM
Hi,
I’m working with an stm32f4xx mounted on Discovery platform; my goal is to measure current consumption in stop mode, using a multimeter (configured as amperometer) linked to the JP1 jumper. I use the UART2 to link the mcu to the PC; by this, I can send a command to the mcu to enter in stop mode, while using the button linked to the port PA0 (configured as external interrupt), I can exit the mcu from stop mode. In my example code, I note in run mode a current consumption of 2mA while in stop mode drop down to the ~800uA; my problem is that I expected a current consumption of few tens of uA and not hundreds of uA. I read the reference manual and the STM32F401xC data sheet about low power modes, and I try what I have read to reduce power consumption in stop mode (flash in power down, etc.) but it was all useless. If it can be useful, I report the code relative to the enter/exit stop mode:
uint32_t temp;
blink(2);
// Flash memory in power-down when the device is in Stop mode
// Bit 9, FPDS, del power control register, = 1
temp = PWR->CR;
temp |= (uint32_t) 0x00000200;
PWR->CR = temp;
__HAL_RCC_HSI_ENABLE();//enable HSI RC oscillator
while((RCC->CR & (uint32_t)0x00000002)==0);//wait until HSI is stable
// Switch to HSI oscillator before enter stop mode
temp = RCC->CFGR;
temp &= (uint32_t) 0xFFFFFFFC;
RCC->CFGR = temp;
HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_STOPENTRY_WFI);//<- qui il codice si ferma
/* L'istruzione agisce sul power control register resettando il bit 1, PDDS,
e settando il bit 0, LPDS, in base al valore di 'Regulator' */
SystemClock_Config();//<- qui il codice riprende la sua esecuzione
HAL_GPIO_TogglePin(debugPin.port, debugPin.pin);
HAL_UART_Receive_IT(&huart2, rxBuffer, 12);
blink(2);
I really don’t know how can I reach the few uAs in stop mode; please, could anyone help me ?
Regards
2014-10-07 06:37 AM
Hi again
''I’m working with an stm32f4xx mounted on Discovery platform
'' I am not familiar with that dev board. ''I use the UART2 to link the mcu to the PC;
'' Does this have an on board RS232 level convertor? ''using a multimeter (configured as amperometer) linked to the JP1 jumper
'' As I said, I am not familiar with this dev board. Check if this measures just the current to the STM32 or whether it includes all the circuit on the dev board. Make sure any LEDs are turned off when in sleep mode, if they are on they will consume current. As I said, what does JP1 actually measure, does it include any circuits on the dev board. eg the RS232 level converter. The level converter will consume current itself. Also when making the measurement, disconnect the board from any off board things (eg the RS232 to the PC). Any off board connections may cause leakage currents which add to the measurement. (I found I got leakage current from the RS232 convertor connected to the PC) I have not used Stop or Standby mode, Sleep mode was OK for the application I am working on.2014-10-07 06:46 AM
Hi
I just had a look at the data sheet for STM32F405 (the part I am using) and800uA
does not sound too far off. ''Table 22. Typical and maximum current consumptions in Stop mode'' ''IDD_STOP, Supply current in Stop mode with main regulator in Run mode 0.60mA''2014-10-07 07:16 AM
To reach the lowest supply current, you must check the state of all GPIO. All of them must be in stable state:
* when I/O is an input, it must be tied to steady high or low, no oscillation * when I/O is an output, make sure there is no load sucking current, sometime it can help to turn the I/O in input config when the resulting voltage is guaranteed to stay stable. * When I/O is unconnected, turn it low output To check bad GPIO configuration, put your finger close to the MCU package or I/O connections and see if it make supply current to vary excessively. If yes, this is the sign that some I/O is still wrongly configured.2014-10-07 07:18 AM
Hi,
it's a pleasure to meet again..so, I'll try to answer to your questions; in the attached files you can find the schematic of Discovery platform...as you can see the JP1 jumper link the ''3V'' with ''VDD'' that feeds only the mcu, while the R29/33 are not fitted on the PCB. This platform has an stm32f401vc as core and an stm32F103 as USB debugger interface; by external pins of UART2 linked to the UART/USB FT232 converter it is possible to link the platform with PC; the leds that remain ON in stop mode are not feeded by VDD so their current is not add to the mcu current. If I try to unplug the UART/USB converter in stop mode, the meausured current rise a little bit... ________________ Attachments : Schematico.pdf : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I13T&d=%2Fa%2F0X0000000bjE%2Fvon5ggAAl9NPyNqIEEFLYUa7StkxgUzA1WozxWSLB0Y&asPdf=false2014-10-08 05:59 AM
void HAL_PWREx_EnableUltraLowPower(void)
{ /* Enable the Ultra Low Power mode */ PWR->CR |= PWR_CR_ULP; } HAL_PWR_EnterSTOPMode(PWR_LOWPOWERREGULATOR_ON, PWR_SLEEPENTRY_WFI);
2014-10-08 08:30 AM
Please, can you tell me what is the bit number of power control register of PWR_CR_ULP bit ? Maybe I have asserted this bit yet...
2014-10-08 12:00 PM
#define PWR_CR_ULP ((uint16_t)0x0200)
So you are already setting the correct bit. Did you measured the power consumption without your jtag debugger? To get a lower power consumption you need to make all the unsed gpio's input. On the discovery board your using there's more then only the cpu, the cpu got his power from VDD that's correct, however there are some chips connected with i2c and spi that can drain small amounts of power trough gpio ports. To be sure you measure only the cpu try all gpio as input and disabled all periphals to see if you can reach then the wanted 40uA, if you have then 40uA you can switch on again the different peripherals.
2014-10-09 12:51 AM
As I expected, I have setted yet this bit...in the discovery platform I have also disconnect the ST-LINK debugger but the result change a very little bit. If you have a look to the Discovery schematic, you can see the measured current by JP1 jumper, is the 'real' mcu current. About the unused pins, they are setted as analog, because in the CubeMX it's suggested to do this to reduce power consumption; do you think this choice is wrong ?