cancel
Showing results for 
Search instead for 
Did you mean: 

UART RX Interrupt disable

Kim.Andy
Associate III

Hello,

I want to disable the uart rx interrupt during transmitting the data like the following flow.

  1. UART Rx interrupt disable(Only uart rx interrupt)
  2. UART Data Tx
  3. UART Rx interrupt enable

Which HAL Library I could use for this process?

Thanks

1 REPLY 1

Which STM32?

Assuming 'F4 (and probably good for most of other STM32 families):

https://github.com/STMicroelectronics/STM32CubeF4/blob/4aba24d78fef03d797a82b258f37dbc84728bbb5/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_usart.h#L418 with USART_IT_RXNE.

Note, that this will lead to Rx overflow, which may both trigger an error interrupt if enabled (USART_IT_ERR), and if unhandled, prevents further Rx. So that would need to be handled before turning to Rx again.

You may want, rather than disabling the Rx interrupt, disable Rx altogether, by clearing/setting USART_CR1.RE; while using direct access to registers this is only flipping one bit, there's probably no direct interface to this in Cube/HAL other than complete deinit/init.

JW