cancel
Showing results for 
Search instead for 
Did you mean: 

Not sure why I cannot enter UARTn_IRQHandler

dchen
Associate II

I have three UARTs on the board, all passed the loopback test (wire the tx and rx pin together on the same UART)

Then I connect UART 1 to UART2 while UART 1 is transmitter and UART2 is receiver.

UART 1 is using HAL_UART_Transmit() to send data to UART2.

On the UART2 side, after initialization, I did

__HAL_UART_ENABLE_IT(uart_interrupt_config.huart, UART_IT_RXNE); // read data register not empty interruption

IRQ_SetPriority(UART2_IRQn, 0);

IRQ_Enable(UART2_IRQn);

I put a break point inside UART2_IRQhandler but never reaches there.

What am I missing here?

Thanks in advance

5 REPLIES 5
KnarfB
Principal III

If using HAL_UART_Transmit(), why not using HAL_UART_Receive_IT() for the other UART beforehand? Shall work, and you can optimize later by looking at the HAL source code.

hth

KnarfB

Thank you @KnarfB​ 

But what do I do wrong in my original approach?

Hmm, the devil is in the details. UART2_IRQhandler is definitively misspelled. And your're mixing different levels like HAL, __HAL, and IRQ_, not NVIC_EnableIRQ ?, are all clocks enabled? I simply don't see enough. Try the HAL-only approach and refine after that is working.

hth

KnarfB

I took these functions from the HAL_driver. I think there are difference between cortex A and Cortex M HAL drivers

dchen
Associate II

Just to clarify the variable in my original post

UART_HandleTypeDef *huart; (This variable is in a struct)

uart_interrupt_config.huart = UART2;

__HAL_UART_ENABLE_IT(uart_interrupt_config.huart, UART_IT_RXNE);