2017-03-08 08:10 AM
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();&sharpifndef 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(); } &sharpendif /* USER CODE BEGIN 3 */}
..........
#stop1 #stm32l4 #uart2017-03-09 05:14 AM
Hi
TARRAGO.DANIEL
,I recommend you to have a look to this example under the STM32L4 firmware package :
STM32Cube_FW_L4_V1.7.0\Projects\STM32L476RG-Nucleo\Examples\UART\UART_WakeUpFromStop
-Nesrine-
2017-03-10 04:21 AM
Hello,
This is what I did but I does not work. What about my questions related to the different functions I have mentioned ('
HAL_UARTEx_WakeupCallback', '
HAL_UART_TxCpltCallback','HAL_UART_RxCpltCallback')
?Best regards.