Clonimus74

When the wake-up clock after Stop Mode is MSI and the LPUART is clocked by HSI it must be re-enabled

Discussion created by Clonimus74 on Feb 15, 2018
When the wake-up clock after Stop Mode is MSI and the LPUART is clocked by HSI it doesn't work unless you re-enable the HSI clock in the LPUART ISR.
The above contradicts (as far as I understand) what the datasheet says in 41.4.11:
41.4.11 Wakeup from Stop mode using LPUART
The LPUART is able to wake up the MCU from Stop mode when the UESM bit is set and the
LPUART clock is set to HSI16 or LSE (refer to the Reset and clock control (RCC) section.
• LPUART source clock is HSI
If during stop mode the HSI clock is switched OFF, when a falling edge on the LPUART
receive line is detected, the LPUART interface requests the HSI clock to be switched
ON. The HSI clock is then used for the frame reception.
– If the wakeup event is verified, the MCU wakes up from low-power mode and data
reception goes on normally.
My ISR code is as follows:
/* Check WUF flag value in ISR register */
  if(LL_LPUART_IsActiveFlag_WKUP(LPUART1) && LL_LPUART_IsEnabledIT_WKUP(LPUART1))
  {
    LL_RCC_HSI_Enable();
     /* Wait till HSI is ready */
    while(LL_RCC_HSI_IsReady() != 1)
    {
    }
    /* Configure LPUART1 transfer interrupts : */
    /* Disable the UART Wake UP from stop mode Interrupt */
    LL_LPUART_DisableIT_WKUP(LPUART1);
    /* WUF flag clearing */
    LL_LPUART_ClearFlag_WKUP(LPUART1);
    LL_LPUART_DisableInStopMode(LPUART1);
    ubReceivedChar = LL_LPUART_ReceiveData8(LPUART1);
    /* Echo received character on TX */
    LL_LPUART_TransmitData8(LPUART1, ubReceivedChar);
  }
  else if (LL_LPUART_IsActiveFlag_RXNE(LPUART1))
  {
    ubReceivedChar = LL_LPUART_ReceiveData8(LPUART1);
    /* Echo received character on TX */
    LL_LPUART_TransmitData8(LPUART1, ubReceivedChar);
  }
Without the re-enabling of the HSI it won't work

Outcomes