2022-12-21 10:46 PM
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...
2022-12-22 12:59 AM
which STM32 ? there are many cpu...
so for F103: in rm -> usart
ad 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):
you can write there , in "user area" (begin .... end)
or use a callback (can enable call backs in Cube->project settings)
ok now ?
2022-12-22 01:05 AM
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.
2022-12-22 01:49 AM
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.