2019-08-16 02:09 AM
Hi all,
I am trying to use the USART1 with RX interrupt but I cannot make it working with code generated using STM32Cube IDE running on Linux.
The MCU is an STM32F407VG.
The ISR function (the only part of the code I modified according to the MCU TRM) is the following:
/**
* @brief This function handles USART1 global interrupt.
*/
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
if(LL_USART_IsActiveFlag_RXNE(USART1) && LL_USART_IsEnabledIT_RXNE(USART1))
{
char x = LL_USART_ReceiveData8(USART1);
LL_USART_TransmitData8(USART1, x);
}
/* USER CODE END USART1_IRQn 0 */
/* USER CODE BEGIN USART1_IRQn 1 */
/* USER CODE END USART1_IRQn 1 */
}
Could someone please suggest what could be wrong that makes the peripheral not working properly using its interrupt ?
Thanks.
s
2019-08-16 02:34 AM
JW
2019-08-16 05:05 AM
@Community member ,
Shouldn't this setup be automatically be done by STM32Cube ???
s.
2019-08-16 05:34 AM
Do you want to get it working, or do you want to argue who's responsible?
JW
2019-08-16 06:30 AM
@simo zz So what is not working? does the interrupt arrive at all? You get spurious interrupts and cannot get out? Something else?
When using LL routines for USART, Cube should generate initialization code and the interrupt handler function, and enable the interrupt in NVIC.
But it won't create any code in the interrupt handler and won't enable any individual interrupts such as RXNE.
The latter is likely the missing part if you don't get interrupts at all.
- pa
2019-08-16 07:16 AM
Actually, when I press debug, I cannot reproduce the correct behaviour of the interrupt.
To achieve so, I have to stop the debug and manually reset my board.
I strongly miss a simple "Flash chip" or "Run" button into STM32Cube.