Zym Dap

STM32L0 Stop Mode with COMP wake-up

Discussion created by Zym Dap on Apr 14, 2018
Latest reply on Apr 16, 2018 by Tilen MAJERLE

Hello colleagues!


I'm trying to implement Stop Mode example from the latest FW  (v1.10.0) to my STM32L053C8 uC. Now I'm totally lost how to enter Stop mode and wake up ONLY by using my COMP2 pin (interrupt mode) properly... I'd like to wake up my uC with photodiode by using 2nd uC comparator with Vrefint enabled (IT Rising interrupt).


if(MyStopModeFlag == 1){


/* Configure the system Power */

/* Enter Stop Mode */

/* Configures system clock after wake-up from STOP: enable HSE, PLL and select
PLL as system clock source (HSE and PLL are disabled in STOP mode) */
MyStopModeFlag = 0;



But the problem is that in my project I'm using an ADC, UART (both DMA), I2C channels and some I/O GPIOs... These are the Init functions:

static void MX_GPIO_Init(void);
static void MX_DMA_Init(void);
static void MX_USART1_UART_Init(void);
static void MX_I2C1_Init(void);
static void MX_COMP2_Init(void);
static void MX_ADC_Init(void);


How should I disable them all except the COMP2? Maybe it's enought to disable all the IRQs and leave only the COMP2 IRQ? Maybe it is possible to "play" only with Init and DeInit functions to achieve my goal? Maybe I can somehow use COMP event and wait for event in my code?


Any ideas appreciated!