2022-05-24 05:58 AM
I have a STM32L081KZT and I am using the LPUART.
I want to create my own Interrupt (handler) based on UART_FLAG_TXE. So basically a function that gets called whenever the UART_FLAG_TXE bit is set.
In the GCC compiler manual I have found this:
void f () __attribute__ ((interrupt ("IRQ")));
But I am totally at a loss for the syntax on how to link this with my own function.
2022-05-24 07:47 AM
This works in a very different way for Cortex-M / STM32. There are many tutorials... around. It also depends on whether you are using bare metal/register level prog, HAL etc.
hth
KnarfB
2022-05-24 11:25 PM
Thanks for your answer.
Basically I want a function that is automatically called, when the UART_FLAG_TXE Bit is set in the LPUART_CR1 Register. My first approach was to create an IRQ Handler just for this, but I dont know how to do it. Is there any way to specifically generate an Interrupt just for this Bit?
2022-05-25 01:13 AM
First, Read The Fine Manual (the Reference Manual for your microcontroller) - you will find there most of the info you need. In STM32, there is a single interrupt for each UART and it may be triggered by many different events. Have a look at functional description of the UART, then registers CR1 and ISR/SR. There are thousands of examples of USART/UART interrupt handling on the net, including this forum - see some of them, then try to implement your solution.