cancel
Showing results for 
Search instead for 
Did you mean: 

Nucleo F042K6 and Standby mode

aa bb_2
Associate II
Posted on April 11, 2018 at 08:47

Hi all,

I am trying to put my nucleo F042 into standby mode. 

I have a very simple configuration (no GPIOs). 

The MCU enters Standby mode after doing all the inits. 

I measure the current on JP1 but it gives me something like 700uA where the datasheet says ~3uA.

I need some help with this . I must be missing something..

Here is the code : 

int main(void)

{

/* USER CODE BEGIN 1 */

/* USER CODE END 1 */

/* MCU Configuration----------------------------------------------------------*/

/* Reset of all peripherals, Initializes the Flash interface and the Systick. */

HAL_Init();

/* USER CODE BEGIN Init */

/* USER CODE END Init */

/* Configure the system clock */

SystemClock_Config();

/* USER CODE BEGIN SysInit */

/* USER CODE END SysInit */

/* Initialize all configured peripherals */

MX_GPIO_Init();

/* USER CODE BEGIN 2 */

/* USER CODE END 2 */

/* Infinite loop */

/* USER CODE BEGIN WHILE */

while (1)

{

GPIO_InitTypeDef GPIO_InitStruct;

GPIO_InitStruct.Pin = GPIO_PIN_All;

GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;

GPIO_InitStruct.Pull = GPIO_NOPULL;

HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

HAL_GPIO_Init(GPIOF, &GPIO_InitStruct);

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

HAL_SuspendTick();

HAL_PWREx_DisableVddio2Monitor();

HAL_PWR_DisableBkUpAccess();

HAL_PWR_DisablePVD();

HAL_PWR_DisableSEVOnPend();

HAL_PWR_DisableSleepOnExit();

HAL_PWR_DisableWakeUpPin(PWR_WAKEUP_PIN1);

HAL_RCC_DeInit();

__HAL_RCC_CRC_CLK_DISABLE();

__HAL_RCC_DMA1_CLK_DISABLE();

__HAL_RCC_SRAM_CLK_DISABLE();

__HAL_RCC_GPIOF_CLK_DISABLE();

__HAL_RCC_GPIOB_CLK_DISABLE();

__HAL_RCC_GPIOA_CLK_DISABLE();

HAL_DeInit();

RCC_OscInitTypeDef s_RCC_OscInitStruct;

/**Initializes the CPU, AHB and APB busses clocks

*/

s_RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_NONE;

s_RCC_OscInitStruct.HSEState = RCC_HSE_OFF;

s_RCC_OscInitStruct.LSIState = RCC_LSI_OFF;

s_RCC_OscInitStruct.PLL.PLLState = RCC_PLL_OFF;

s_RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;

s_RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL2;

s_RCC_OscInitStruct.PLL.PREDIV = RCC_PREDIV_DIV1;

if (HAL_RCC_OscConfig(&s_RCC_OscInitStruct) != HAL_OK)

{

_Error_Handler(__FILE__, __LINE__);

}

HAL_PWR_EnterSTANDBYMode();

/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */

}

/* USER CODE END 3 */

}

Thanks for your help.

A.

0 REPLIES 0