cancel
Showing results for 
Search instead for 
Did you mean: 

Current Consumption of STM32F4DISCOVERY in STOP mode

marcopiovesan9
Associate II
Posted on November 06, 2013 at 12:32

Hi guys,

I am tryng to get the lowest power consumption from STM32F407ZG. In my board wakup will be triggered by CAN bus activity. After various approaches my lowest consumption in STOP mode is 0 mA. This value is obtained after a checking and minimizing of all possible current draw from various pin and after applying some suggestion from http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/DM00033pdf My next step to understand where is the error was moving on STM32F4DISCOVERY with STM32F407VG. Surprisingly the current measured at JP1 in STOP mode is 2 mA This is my code:

#include <stm32f4xx.h>
/* prototypes */
void
GeneralGPIOInitialization(
void
);
int
main(
void
)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/* Configure gpios for low power */
GeneralGPIOInitialization();
/* Configure button */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA, ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_Init(GPIOA, &GPIO_InitStructure);
/* Configure LED */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);
GPIO_StructInit(&GPIO_InitStructure);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|GPIO_Pin_13;
GPIO_Init(GPIOD, &GPIO_InitStructure);
/* Connect Button EXTI Line to Button GPIO Pin */
SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOA, EXTI_PinSource0);
/* Configure Button EXTI line */
EXTI_InitStructure.EXTI_Line = EXTI_Line0;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/* Enable and set Button EXTI Interrupt to the lowest priority */
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/* Disable PVD */
PWR_PVDCmd(DISABLE);
while
(1)
{
if
( GPIO_ReadInputDataBit(GPIOA, GPIO_Pin_0) == 0 )
{
GPIO_ResetBits(GPIOD, GPIO_Pin_12 ); 
/* green off */
GPIO_ResetBits(GPIOD, GPIO_Pin_13 ); 
/* red off */
PWR_EnterSTOPMode(PWR_Regulator_LowPower, PWR_STOPEntry_WFI);
GPIO_SetBits(GPIOD, GPIO_Pin_12 ); 
/* green on (short at wake-up) */
}
else
{
GPIO_ResetBits(GPIOD, GPIO_Pin_12 ); 
/* green off */
GPIO_SetBits(GPIOD, GPIO_Pin_13 ); 
/* red on */
}
}
}
/**
* @brief Catches the EXTI Line8 interrupt
* @param None
* @retval None
*/
void
EXTI0_IRQHandler(
void
)
{
EXTI_ClearITPendingBit(EXTI_Line0);
}
/* Initialize GPIO for lowest power consuption */
void
GeneralGPIOInitialization(
void
)
{
GPIO_InitTypeDef GPIO_InitStructure;
GPIO_StructInit(&GPIO_InitStructure);
/* Enable all GPIO clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD|RCC_AHB1Periph_GPIOE, ENABLE);
/* configure all GPIO in AIN mode */
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_All;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;
GPIO_Init(GPIOA, &GPIO_InitStructure);
GPIO_Init(GPIOB, &GPIO_InitStructure);
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_Init(GPIOD, &GPIO_InitStructure);
GPIO_Init(GPIOE, &GPIO_InitStructure);
/* Disable all GPIO clocks */
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA|RCC_AHB1Periph_GPIOB|RCC_AHB1Periph_GPIOC|RCC_AHB1Periph_GPIOD| RCC_AHB1Periph_GPIOE, DISABLE);
}

Is there anyone who can kindly suggest me how to decrease static power consumption (the clocks are stopped)? Thank you Marco
3 REPLIES 3
Amel NASRI
ST Employee
Posted on November 07, 2013 at 08:51

Hi Marco,

2 suggestions:

1- Enable the PWR clock: RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE)

2- Add GPIOF, GPIOG & GPIOH in the GPIO initialization.

-Mayla-

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

marcopiovesan9
Associate II
Posted on November 07, 2013 at 09:09

Hi Mayla,

Thank you, now I am at 26.8 mA that is lower but is still too high.

I will grateful if you have more suggestions.

Ciao

Marco

marcopiovesan9
Associate II
Posted on November 07, 2013 at 09:33

Hi Mayla,

I found ! My dev board is damaged, using a new one I have 1.3 mA.

Thank you.

Ciao