cancel
Showing results for 
Search instead for 
Did you mean: 

HardFault_Handler when trying to UART_Transmit interrupt - FreeRTOS STM32F767ZI

AMott.2
Associate II

I've just started to learn FreeRTOS on CMSIS and im trying to make an interactive menu on a task and I also have another task with an HAL_GPIO_TogglePin just to coexist and see that both tasks are working. The menu text itself is sent to the terminal with no issues, then I send a character thar corresponds to one of the options available. The character is identified correctly and I've setted an informative message to confirm the option and give more instructions, but only the 2 or 3 first characters of the message are sent, then HardFault_Handler is activated.

I've tried some solutions like changing the TIM6 to Systick for the Timebase Source, because some people say that Youtube Tutorials are wrong about changing it to TIM6.

On the image below you can see my Transmit_Callback that I've been using in all my programs before starting to use FreeRtos.

0693W00000NrEkzQAF.pngThese are the functions that I call on the tasks to send the messages

0693W00000NrElJQAV.pngThis is the Menu task:

0693W00000NrElOQAV.pngThis is the new_Message function and the option function

0693W00000NrElnQAF.png0693W00000NrEo3QAF.pngThe set_rx funtion is to make the Rx flag to 1, in order to let the rx_callback recieve the characters from the user.

Ask if you need more information!

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @Andrés Motta​ ,

How do you configure the priority of interrupts? Make sure you have configured the priority correctly.

As well, try to perform a stack overflow check. If the main task in the environment or another task exceeds the available stack space, unpredictable behavior will occur.

Otherwise, you can refer to the FreeRTOS examples provided under the F7 Firmware Package.

I hope this helps.

BeST Regards,

Walid

View solution in original post

4 REPLIES 4

Hello @Andrés Motta​ ,

How do you configure the priority of interrupts? Make sure you have configured the priority correctly.

As well, try to perform a stack overflow check. If the main task in the environment or another task exceeds the available stack space, unpredictable behavior will occur.

Otherwise, you can refer to the FreeRTOS examples provided under the F7 Firmware Package.

I hope this helps.

BeST Regards,

Walid

AMott.2
Associate II

Hello @Walid ZRELLI​ ,

Bellow you can see my interrups priority, I haven't changed them:

0693W00000NrGMpQAN.pngAbout the stack overflow, I dont really know how to verify that on the STM32CubeIDE.

Thank you for the examples, I'll be checking them out too!

I appreciate the fast answer!

Best Regards,

Andrés

[EDIT]: I've removed the workedMessage() function from the option() switch case, to see if the tasks would still be interrupted and they do, so maybe isn't an issue caused by the UART (?), because when I tried to call the workedMessage function in the menuTask() condition without any option verification it worked and printed all the characters and didn't stop the tasks

 [EDIT2]: I was wondering if the problem came from the Recieve, but I tried to echo my messages and it worked just fine, is something in the option() function that I can't have?

AMott.2
Associate II

@Walid ZRELLI​ It was a stack overflow, I incremented the available stack space for the menu task and solved the issue, thank you very much!

Great news! glad to help you 😊