2021-12-02 03:23 AM
Hi,
i write code in bare metal so every time i initialize a project in STM32CubeIDE i do it as an empty project. I made a project for STM32L011K4 and try to initialize the LPUART, in the startup file i can find that the handler for the LPUART1 name is AES_RNG_LPUART1_IRQHandler. I try to write my code for this handler but when i debug the code hang in loopforever at the default handler. Next step i proceed it was to make the same project as STM32Cube and not as empty. The startup file there was different the handler's name is LPUART1_IRQHandler, i copy and paste the code from the startup file of STM32Cube in my empty project, write code for LPUART1_IRQHandler and it worked. So did i miss something or it is a bug?
OS: Arch Linux
IDE: STM32CubeIDE 1.7.0
Steps to reproduce:
2021-12-02 06:12 AM
In order for the appropriate IRQ handler to be called, the function name in your code needs to match the function name given in the vector table (typically in startup_*.s). It doesn't really matter what they're called.
They should probably be the same name here for consistency, but it's weird how creating an "empty project" creates code at all.
2021-12-02 11:56 PM
Yes i know that and i name my function AES_RNG_LPUART1_IRQHandler because that was the only handler that has LPUART at its name, i enable the AES_RNG_LPUART1_IRQ interrupt and when i run it it just go to default handler, which it mean that an interrupt has occur (LPUART) that cannot find its handler. After creating an CubeIDE project i just copy the code from the startup file(which is older) and change the name to LPUART1_IRQHandler and LPUART1_IRQ respectively and everything run fine. To me it seems like a bug.
Reproduce:
2022-02-12 08:39 PM
Hello.
I have the same situation. The RXNEIE interrupt for LPUART did not work until I replaced the startup_stm32l031f6px.s file with the same one from the STM32Cube project.
Thanks to @XKeto.1 for this workaround.
MCU: STM32L031F6.
IDE: STM32CubeIDE 1.8.0
LPUART_init.c
...
// Enable transmitter, receiver and receive-interrupt of LPUART1
LPUART1->CR1 = USART_CR1_TE | USART_CR1_RE | USART_CR1_RXNEIE | USART_CR1_UE;
...