2017-11-26 04:58 AM
hi everyone~
Before enter stop mode ,I called HAL_UART_DeInit(&huart3) an after it was wake up from stop mode(wake up by rtc), I called HAL_UART_Init(&huart3),but after wake up uart3 can't work. What should I do?
before enter stop mode:
huart3.Instance = USART3;
if (HAL_UART_DeInit(&huart3) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }wake up from stop mode:
huart3.Instance = USART3;
huart3.Init.BaudRate = 9600; huart3.Init.WordLength = UART_WORDLENGTH_8B; huart3.Init.StopBits = UART_STOPBITS_1; huart3.Init.Parity = UART_PARITY_NONE; huart3.Init.Mode = UART_MODE_TX_RX; huart3.Init.HwFlowCtl = UART_HWCONTROL_NONE; huart3.Init.OverSampling = UART_OVERSAMPLING_16; if (HAL_UART_Init(&huart3) != HAL_OK) { _Error_Handler(__FILE__, __LINE__); }2017-11-26 08:21 AM
Look at peripheral view in debugger, make sure no error status in USART which needs clearing. Code robustly so you can identify and clear errors.
Make sure _Error_Handler() and other potential paths of silent death output blinking LED or GPIO, or output via USART as available, so you know what might be happening when debugger not usable. Output from Hard Fault Handler also strongly recommended.
Exits from sleep mode may be with different clocks.
STM32L1 family?