2024-03-20 10:46 PM
I've found a bug with how STM32CubeMX generates the USART3_4_LPUART1_IRQHandler function when using TRACER_EMB and USART4 on an STM32G071.
When just USART4 and its NVIC interrupt is enabled, the function is generated as follows:
void USART3_4_LPUART1_IRQHandler(void)
{
/* USER CODE BEGIN USART3_4_LPUART1_IRQn 0 */
/* USER CODE END USART3_4_LPUART1_IRQn 0 */
HAL_UART_IRQHandler(&huart4);
/* USER CODE BEGIN USART3_4_LPUART1_IRQn 1 */
/* USER CODE END USART3_4_LPUART1_IRQn 1 */
}
But when both TRACER_EMB with LPUART1 and UART4, with their NVIC interrupts enabled the following is generated.
void USART3_4_LPUART1_IRQHandler(void)
{
/* USER CODE BEGIN USART3_4_LPUART1_IRQn 0 */
/* USER CODE END USART3_4_LPUART1_IRQn 0 */
TRACER_EMB_IRQHandlerUSART();
/* USER CODE BEGIN USART3_4_LPUART1_IRQn 1 */
/* USER CODE END USART3_4_LPUART1_IRQn 1 */
}
When an interrupt for UART4 is raised, it is not being handled which causes USART3_4_LPUART1_IRQHandler to be continually called.
To reproduce, my setup is
STM32CubeIDE version: 1.14.1
with STM32CubeMX version: 6.10.0-RC9
The minimum steps are:
1) Create a new STM32 Project with the target chip being the STM32G071RBT6
2) In CubeMX, in the connectivity tab, enable LPUART1 with the NVIC interrupt enabled
also enable UCPD1 as Sink,
also enable USART4 and enable the NVIC interrupts.
3) Under the Middleware and Software Packs, enable UCPD as Port0: UCPD1
4) Under Utilities enable TRACER_EMB with LPUART1.
5) Generate the code.
This results in the USART3_4_LPUART1_IRQHandler located in the stm32g0xx_it.c file, to omit the call to "HAL_UART_IRQHandler(&huart4)".
The workaround is just to edit the USART3_4_LPUART1_IRQHandler to contain the call to HAL_UART_IRQHandler(&huart4) like below :
void USART3_4_LPUART1_IRQHandler(void)
{
/* USER CODE BEGIN USART3_4_LPUART1_IRQn 0 */
HAL_UART_IRQHandler(&huart4);
/* USER CODE END USART3_4_LPUART1_IRQn 0 */
TRACER_EMB_IRQHandlerUSART();
/* USER CODE BEGIN USART3_4_LPUART1_IRQn 1 */
/* USER CODE END USART3_4_LPUART1_IRQn 1 */
}
Solved! Go to Solution.
2024-03-21 12:13 AM - edited 2024-03-21 05:08 AM
Hello @Ben5 and welcome to the ST Community :smiling_face_with_smiling_eyes:.
Thank you for reporting this issue. I've escalated this to the concerned team for more investigation under The internal ticket number 176677 (not accessible by the community users) to confirm/fix the issue.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-03-21 12:13 AM - edited 2024-03-21 05:08 AM
Hello @Ben5 and welcome to the ST Community :smiling_face_with_smiling_eyes:.
Thank you for reporting this issue. I've escalated this to the concerned team for more investigation under The internal ticket number 176677 (not accessible by the community users) to confirm/fix the issue.
Best Regards.
STTwo-32
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.