Skip to content

[STM32L0] Add USART force/release Reset at Init phase #1895

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions hal/targets/hal/TARGET_STM/TARGET_STM32L0/serial_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,30 +93,40 @@ void serial_init(serial_t *obj, PinName tx, PinName rx)
// Enable UART clock
#if defined(USART1_BASE)
if (obj->uart == UART_1) {
__HAL_RCC_USART1_FORCE_RESET();
__HAL_RCC_USART1_RELEASE_RESET();
__HAL_RCC_USART1_CLK_ENABLE();
obj->index = 0;
}
#endif

if (obj->uart == UART_2) {
__HAL_RCC_USART2_FORCE_RESET();
__HAL_RCC_USART2_RELEASE_RESET();
__HAL_RCC_USART2_CLK_ENABLE();
obj->index = 1;
}

if (obj->uart == LPUART_1) {
__HAL_RCC_LPUART1_FORCE_RESET();
__HAL_RCC_LPUART1_RELEASE_RESET();
__HAL_RCC_LPUART1_CLK_ENABLE();
obj->index = 2;
}

#if defined(USART4_BASE)
if (obj->uart == UART_4) {
__HAL_RCC_USART4_FORCE_RESET();
__HAL_RCC_USART4_RELEASE_RESET();
__HAL_RCC_USART4_CLK_ENABLE();
obj->index = 3;
}
#endif

#if defined(USART5_BASE)
if (obj->uart == UART_5) {
__HAL_RCC_USART5_FORCE_RESET();
__HAL_RCC_USART5_RELEASE_RESET();
__HAL_RCC_USART5_CLK_ENABLE();
obj->index = 4;
}
Expand Down