2021-02-09 04:55 AM
Good day community,
I'm experiencing difficulty with debugging my project. I'm using FreeRTOS with a STM32L433 Nucleo.
The software is stuck in the task with the breakpoint and it won't hit the next breakpoint I have in my Timer1 interrupt.
STM32CubeIDE v1.5.1
MAC OS Catalina 10.15.5
void usartIT_H(void const * argument)
{
/* USER CODE BEGIN usartIT_H */
/* Infinite loop */
for(;;)
{
if (SerialFlag) //If value == 1
{
if((Rx_Data[0] == 0x3C) && (Rx_Data[5] == 0x3E))
{
liveButton.pageNr = Rx_Data[1];
liveButton.btnID = Rx_Data[2];
liveButton.btnVal = Rx_Data[3];
liveButton.btnPress = Rx_Data[4];
}
if((Rx_Data[0] == 0x66) && (Rx_Data[2] == 0xFF) && (Rx_Data[3] == 0xFF))
{
switch (Rx_Data[0])
{
case 0x66:
PageNrFromNex = Rx_Data[1];
break;
default: break;
}
}
// TODO: Clear Rx_Data MEMSET 0
dataPtr = 0;
SerialFlag = 0;
}
osDelay(10);
}
/* USER CODE END usartIT_H */
}
2021-02-09 11:55 PM
Remove or disable all breakpoints but the Timer1 one? Doublecheck the Breakpoints View in STM32CubeIDE for active breakpoints. Can you prove that the timer is running at all?
2021-02-10 04:59 AM
Hello and thanks for the reply. I can indeed confirm that my timer is working - I changed my parameters to flash the onboard LED every 100ms.
I've conducted a Google search on the issue and the various results seem to point to the timer - I'm using TIM6 for my SysTick.
The same result occurs when I only have one breakpoint in my USART IRQ Handler - it just continuously stays in the IRQ Handler.
I'm using the LL drivers for the USART if that makes any difference.
void USART1_IRQHandler(void)
{
/* USER CODE BEGIN USART1_IRQn 0 */
if ((READ_BIT(USART1->ISR, USART_ISR_RXNE) == USART_ISR_RXNE))
//if ((USART1->ISR & USART_ISR_RXNE) == USART_ISR_RXNE)
{
USART2_Timeout = 21; //Need to change variable name to USART1_Timeout
Rx_Data[dataPtr++] = USART1->RDR;
}
/* USER CODE END USART1_IRQn 0 */
/* USER CODE BEGIN USART1_IRQn 1 */
/* USER CODE END USART1_IRQn 1 */
}
Here is the code snippet for my TIM6 Interrupt Handler: (I'm using the standard HAL Libraries for it)
void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
{
/* USER CODE BEGIN Callback 0 */
if (htim->Instance == TIM16)
{
//HAL_GPIO_TogglePin(GPIOB, LD4_Pin);
if (USART2_Timeout) //If value > 0
{
USART2_Timeout--;
if(USART2_Timeout == 0)
{
SerialFlag = 1;
}
}
}
/* USER CODE END Callback 0 */
if (htim->Instance == TIM6) {
HAL_IncTick();
}
/* USER CODE BEGIN Callback 1 */
/* USER CODE END Callback 1 */
}
I've tried the various solutions to no avail on my side:
I'm a complete novice to the ARM world - I've completed some courses on Udemy and YouTube tutorials.
I just don't have enough knowledge as yet on how to properly debug my project and the inner workings of FreeRTOS.
I'm almost 100% sure it has something to do with FreeRTOS and the interrupt for it.
Any advice is highly appreciated.
Thanks.
2021-02-19 05:37 AM
I believe this issue is related to my other problem relating to the debugger plugged into USB-C with MAC OS:
https://community.st.com/s/question/0D53W00000aIMIxSAO/debugging-issue-with-usbc?t=1613740695804