I’m using a trial of Tracealyzer and see something pretty concerning.
I’m using the AWS FreeRTOS wifi reference implementation, FreeRTOS v10.4.x. Here is the config.h:
#define configTICK_SOURCE FREERTOS_USE_RTC
#define configUSE_PREEMPTION 1
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
#define configUSE_TICKLESS_IDLE 0
#define configUSE_TICKLESS_IDLE_SIMPLE_DEBUG 1 /* See into vPortSuppressTicksAndSleep source code for explanation */
#define configCPU_CLOCK_HZ ( SystemCoreClock )
#define configTICK_RATE_HZ 1000
#define configMAX_PRIORITIES ( 15 )
#define configMINIMAL_STACK_SIZE ( 600 )
#define configTOTAL_HEAP_SIZE ( 175000 )
#define configMAX_TASK_NAME_LEN ( 15 )
#define configUSE_16_BIT_TICKS 0
#define configIDLE_SHOULD_YIELD 1
#define configUSE_MUTEXES 1
#define configUSE_RECURSIVE_MUTEXES 1
#define configUSE_COUNTING_SEMAPHORES 1
#define configUSE_ALTERNATIVE_API 0 /* Deprecated! */
#define configQUEUE_REGISTRY_SIZE 2
#define configUSE_QUEUE_SETS 0
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
#define configSUPPORT_STATIC_ALLOCATION 1
#define configUSE_APPLICATION_TASK_TAG 1
#define configUSE_POSIX_ERRNO 1
#define configMESSAGE_BUFFER_LENGTH_TYPE uint8_t
I asked two separate tasks to vTaskDelay(1), both show they are resuming early occasionally.
The average INTERVAL, time between the last end and the next start is right at 1ms, which is great. Issue is I have some short and long extremes.
Shortest: 212us
Average: 1.051ms
Longest: 3.305ms
The longest I think I can explain. There are higher priority tasks, it makes sense my intervals can run longer than desired, and this is fine.
How on earth am I calling vTaskDelay(1) and getting a wake pretty reliably at 250-400us? What mechanism would do this? Is there some way to figure out why the scheduler decided a task was ready?