Hi,
I have created a task to be executed every 500ms with the following code:
I set a breakpoint on the task and after the osKernelStart() I saw that the debugger executes the function only the first time and not again. The kernel is running without a hard fault or an other failure but the task is never called again. I changed randomly the stack size for the task from 128 bytes to 512 bytes and after this change the kernel is calling my task every 500ms.
Why I don’t have an error message or something similar?
How can avoid in the future same problems? and why 128 bytes of stack are not enough for a very small code example like on my example?
Why the task needs so much amount of stack?
/* USER CODE END Header_testTask500msFunc */
void testTask500msFunc(void *argument)
{
/* USER CODE BEGIN testTask500msFunc */
portTickType xLastWakeTime;
const portTickType xDelay = 500 / portTICK_RATE_MS;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount ();
/* Infinite loop */
for(;;)
{
// Wait for the next cycle.
vTaskDelayUntil( &xLastWakeTime, xDelay );
uint16_t intermediateVar[2]={0,0};
MX_DRV8304_Request_Status(intermediateVar,&hdrv8304);
HAL_GPIO_WritePin(GPIOB,DRV_INLC_Pin, GPIO_PIN_SET);
HAL_GPIO_TogglePin(GPIOB,DRV_INHC_Pin);
}
/* USER CODE END testTask500msFunc */
}
Thanks in advance,
Nikos