Hi,
I’m using FreeRTOS for the first time on a STM32F411 and used an example from the Arduino ide as a starting point.
I have it running mostly ok with two tasks, one which takes care of a websocket server and another which does background task processing.
It will run indefinately but when I add a simple function to detect a button press it’s crashes immediately the button is pressed and the led flashes 4 time indicating a stack overflow.
The button generates an IRQ
void set_pressed()
{
BaseType_t taskYieldRequired = 0;
static unsigned long last_interrupt_time = 0;
unsigned long interrupt_time = millis();
// If interrupts come faster than 300ms, assume it's a bounce and ignore
if (interrupt_time - last_interrupt_time > 300)
{
set_event_flag = true ;
}
last_interrupt_time = interrupt_time;
taskYieldRequired = xTaskResumeFromISR(TunerControlHandle);
taskYieldRequired = xTaskResumeFromISR(WebsocketHandle);
}
I created the tasks as per below:
xTaskCreate (TaskWebsocketRxRead , (const portCHAR *)“DigitalRead” , 8192 , NULL, 1 , &WebsocketHandle );
xTaskCreate (TaskTunerControl , (const portCHAR *) “AnalogRead” , 16384 , NULL , 3 , &TunerControlHandle );
I only have
#include <STM32FreeRTOS.h>
in use and I’m not sure what and where I should change to increase the stack size for either task.
This problem has only arisen as I’ve added more code so pretty sure its a stack overflow issue.
Hopefully I can learn from some experts here and fix what I’m doing wrong.
Regards Tim