FreeRTOS trace macro implementation

dioghenes-0 wrote on Monday, June 04, 2018:

Good morning,

I’m trying to add some tracing features to my OS so I’m implementing the macro provided by the header FreeRTOS.h. Everything works but now I’ve tried to add a uart communication: for example, when a mutex is taken, a string is sent throug uart. Well, when I add such thing, the board crashes.

I’m usign FreeRTOS 9 and a STM32F3DISCO board.

I have done some debug and I have noticed that the system crashes on uxListRemove function, the WWDG_IRQHandler is raised and then the execution goes into a generic error handler that i’ve written, which is correct; I dont’ understand why the WWDG interrupt is raised…

Thank you in advance for the help,
Best regards

dioghenes-0 wrote on Monday, June 04, 2018:

I have done some more attempts and I have noticed that if I remove the HAL_UART_Transmit() function everything works correctly…I didn’t setup the WWDG so it’s strange its irq is raised…

richard_damon wrote on Monday, June 04, 2018:

One issue with sending out serial data in a trace is that the uart comm routine may hold up exection until the message is sent, slow things down greatly. If you have enabled the watchdog, you may now just be running to slow to keep up with kicking the dog enough.
The other possible issue is that doing the communnication might make some actions recursive (if you send on taking a mutex, and the sending routine takes a mutex, you get stuck in an infinite loop).
Generally you want the trace routines to do something very quick and self contained. Perhaps having an array where you store information on the last N traced operations (perhaps filtering out some that you know you don’t care about). You can then look at the array with a debugger or have a task dump the data out seperately from the trace logging.