AnsweredAssumed Answered

UART AND STOP1 MODE

Question asked by Daniel Tarrago on Mar 8, 2017
Latest reply on Mar 10, 2017 by Daniel Tarrago

I'm developping an application based on STM32L475. In this application I'm controlling a device that is managed via UART2 interface with AT commands. This device is correctly working in run mode but problem comes when working in Stop1 mode. I use UART2 with interrupts but, when going to Stop1 mode, are the functions 'HAL_UART_TxCpltCallback' and 'HAL_UART_RxCpltCallback' also working? Which is the functionality of the 'HAL_UARTEx_WakeupCallback' function?

Please, find here below a piece of my code when implementation to go to Stop1 mode is implemented (note, that I2C also wakes up device from Stop1 mode and it is correctly working):

 

......

 

/* Ensure that HSI is wake-up system clock => per poder despertar de Stop1 a causa de I2C o UART */
__HAL_RCC_WAKEUPSTOP_CLK_CONFIG(RCC_STOP_WAKEUPCLOCK_HSI);
/* USER CODE END 2 */

/* Infinite loop */
/* USER CODE BEGIN WHILE */

while (1)
{
/* USER CODE END WHILE */

// Full equipment functionality
Tasques();

 

#ifndef EN_DEBUG

if((HAL_I2C_GetState(&H_i2c1)==HAL_I2C_STATE_READY))&&(__HAL_UART_GET_FLAG(&H_uart2, USART_ISR_BUSY) == RESET)&&(__HAL_UART_GET_FLAG(&H_uart2, USART_ISR_REACK) == SET))
{
//I2C enabled to wake up from Stop1
HAL_I2CEx_EnableWakeUp(&H_i2c1);

//UART enabled to wake up from Stop1
/* set the wake-up event:
* specify wake-up on RXNE flag */
WakeUpSelection_UART.WakeUpEvent=UART_WAKEUP_ON_READDATA_NONEMPTY;
if (HAL_UARTEx_StopModeWakeUpSourceConfig(&H_uart2, WakeUpSelection_UART)!= HAL_OK)
{
Error_Handler();
}
/* Enable the UART Wake UP from STOP1 mode Interrupt */
__HAL_UART_ENABLE_IT(&H_uart2, UART_IT_WUF);
/* enable MCU wake-up by UART */
HAL_UARTEx_EnableStopMode(&H_uart2);



//Stop1
HAL_PWREx_EnterSTOP1Mode(PWR_STOPENTRY_WFI);
SYSCLKConfig_STOP();
}

#endif


/* USER CODE BEGIN 3 */

}

..........

Outcomes