cancel
Showing results for 
Search instead for 
Did you mean: 

Dealing with interrupts. Diff Atmega - STM32.

Haddock
Associate III

The Atmega project that I trying to get into a STM32 uses two UART ports and each have its own sets of IRQ vectors. That is RX- and UDRE irq. The last one gives an IRQ when the TX-register is empty.

As I said in the latter post, I haven't worked with STM32 before so the questions is from a newbie.

The STM32 on the other hand has a common HAL_UART_TxCpltCallback() where I can load the TX reg again with next byte depending on what port is sending (That's normal?)

Question 1: Doesn't the uarts in STM32 has its own irq-vector for TX-register empty or is it USARTxx_IRQHandler() that deals with "TX-reg empty" and "RX irq"?

The function HAL_UART_IRQHandler(*huart) seems to handle errors and does not have any space for user_code.

Question 2: When does USARTxx_IRQHandler() been called?

I have search for app.notes and documents regarding this but I haven't found any good ones. Only the 900 pages big manual...

3 REPLIES 3
AScha.3
Chief II

which STM32 ? there are many cpu...

so for F103: in rm -> usart

0693W00000WLbyrQAD.pngad 1: 1 irq , when using callbacks you get automatic the one you want

ad 2: always called, when corresponding flag is set ("enable irq on event xx ")

example:

in xx_it.c you get (generated by Cube):

0693W00000WLc0OQAT.pngyou can write there , in "user area" (begin .... end)

or use a callback (can enable call backs in Cube->project settings)

0693W00000WLc12QAD.pngok now ?

If you feel a post has answered your question, please click "Accept as Solution".
Haddock
Associate III

It is a SMT32L031C6T6.

Yes. You confirm what I suspected. I'm already using RxClpt...

Yes. I will investigate the callbacks. They are disabled now.

Haddock
Associate III

Because HAL_UART_RxCpltCallback() dealing with both UART:s I need a if() that can distinguish between the two port-handles. �? have one buffer for each port with head/tail variables.

That should work I think.