cancel
Showing results for 
Search instead for 
Did you mean: 

Help establishing USART Receive Interrupt

Justin1
Senior

We are using the NUCLEO-F091RC and need help establishing a working demo of a USART-Rx interrupt. We have put much effort into this with no success, here is the process we are at:

   Demo Attempt Process:

  1. Open CubeMX->Board Selector->NUCLEO-F091RC
  2. Default?: Yes
  3. Pin/Config->USART2->NVIC->Enabled?: Yes [#3F38]
  4. Transmit & delay in main ('HAL_UART_Transmit()')
  5. Enable interrupts in main ('__enable_irq()')
  6. Place a counter increment in IRQ Handler ('rx_ct++') [#DCD5]

   Source Code: (GitHub)

This is not working for Rx, what is missing here?

1 REPLY 1

If you want to use HAL, then you don't interact with the USART interrupt directly, you use the *_IT (IT = interrupt) family of functions, for example HAL_UART_Transmit_IT, which will do the work using interrupts.

Otherwise, use the LL drivers (you can configure Cube to generate code with LL drivers instead of HAL) or CMSIS. [Click Show More]

There are many examples available in Cube repository for the LL driver and in STM32Snippets for CMSIS.

Repository - under STM32Cube_FW_F0_V1.9.0\Projects\STM32F072RB-Nucleo\Examples_LL\USART

STM32Snippets - https://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32snippets.html?querycriteria=productId=LN1898