cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX incorrectly making USART3_4_LPUART1_IRQHandler whe using TRACER_EMB and USART4: STM32G0X

Ben5
Associate

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 */
}

 

1 ACCEPTED SOLUTION

Accepted Solutions
STTwo-32
ST Employee

Hello @Ben5 and welcome to the ST Community 😊.

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.

View solution in original post

1 REPLY 1
STTwo-32
ST Employee

Hello @Ben5 and welcome to the ST Community 😊.

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.