I'm trying to wake up the MCU STM32L051T6 from stop mode using I2C.
i saw that it is a very common problem.
i read the errata sheet and it reports tha on X revision the problem is fixed.
Now i'm using the revision X.
My target is to wake up by an address match. This is the code:
// Make sure that no I2C transfer is on-going
while(LL_I2C_IsActiveFlag_BUSY(I2C1) == 1)
DBGMCU -> CR |= DBGMCU_CR_DBG_STOP;
// Set I2C1 clock source as HSI
RCC -> CR |= 0x00000002; //Enable HSIKERON clock on stop mode
LL_I2C_ConfigFilters(I2C1, LL_I2C_ANALOGFILTER_DISABLE, 0x00);
PWR->CR |= PWR_CR_CWUF; // clear the WUF flag after 2 clock cycles
PWR->CR &= ~( PWR_CR_PDDS ); // Enter stop mode when the CPU enters deepsleep
RCC->CFGR |= RCC_CFGR_STOPWUCK; // HSI16 oscillator is wake-up from stop clock
SCB->SCR |= SCB_SCR_SLEEPDEEP_Msk; // low-power mode = stop mode
__WFI(); // enter low-power mode
it goes in Stop mode.
when i try to send an'I2c message the SCL goes down for ever. I can't send the address.
Can somebody help me?
I hope that this discussion will be useful for the community