mbed library sources
Dependents: frdm_kl05z_gpio_test
Fork of mbed-src by
Diff: targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/serial_api.c
- Revision:
- 293:2a9cf2ed1474
- Parent:
- 237:f3da66175598
--- a/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/serial_api.c Thu Aug 21 08:00:07 2014 +0100 +++ b/targets/hal/TARGET_STM/TARGET_NUCLEO_F334R8/serial_api.c Thu Aug 21 10:45:06 2014 +0100 @@ -91,6 +91,10 @@ UartHandle.Init.Mode = UART_MODE_TX_RX; } + // Disable the reception overrun detection + UartHandle.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_RXOVERRUNDISABLE_INIT; + UartHandle.AdvancedInit.OverrunDisable = UART_ADVFEATURE_OVERRUN_DISABLE; + HAL_UART_Init(&UartHandle); } @@ -219,9 +223,7 @@ } if (__HAL_UART_GET_FLAG(&UartHandle, UART_FLAG_RXNE) != RESET) { irq_handler(serial_irq_ids[id], RxIrq); - // [TODO] Check which line works the best - __HAL_UART_SEND_REQ(&UartHandle, UART_RXDATA_FLUSH_REQUEST); - //__HAL_UART_CLEAR_IT(&UartHandle, UART_FLAG_RXNE); + volatile uint32_t tmpval = UartHandle.Instance->RDR; // Clear RXNE bit } } } @@ -287,9 +289,9 @@ if (irq == RxIrq) { __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_RXNE); // Check if TxIrq is disabled too - if ((UartHandle.Instance->CR1 & USART_CR1_TXEIE) == 0) all_disabled = 1; + if ((UartHandle.Instance->CR1 & USART_CR1_TCIE) == 0) all_disabled = 1; } else { // TxIrq - __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TXE); + __HAL_UART_DISABLE_IT(&UartHandle, UART_IT_TC); // Check if RxIrq is disabled too if ((UartHandle.Instance->CR1 & USART_CR1_RXNEIE) == 0) all_disabled = 1; } @@ -346,8 +348,8 @@ void serial_clear(serial_t *obj) { UartHandle.Instance = (USART_TypeDef *)(obj->uart); - __HAL_UART_CLEAR_IT(&UartHandle, UART_FLAG_TXE); - __HAL_UART_CLEAR_IT(&UartHandle, UART_FLAG_RXNE); + __HAL_UART_CLEAR_IT(&UartHandle, UART_FLAG_TC); + __HAL_UART_SEND_REQ(&UartHandle, UART_RXDATA_FLUSH_REQUEST); } void serial_pinout_tx(PinName tx)