Hi.
I’m using a wroom32 with visual studio 2022. I need to have a real time task running to 250Hz frequency. I tried to modify “Hello world” sample in order to achieve the target: I set 1000 Hz tick rate for freeRTOs. The best result is 125 Hz, if I try to get better rate it fails.
My task is this:
static void yys_rtc_task(void* arg)
{
static int64_t time = 0;
static int64_t endTime = 0;
static int64_t deltaT = 0;
static TickType_t xLastWakeTime;
static const TickType_t xFrequency = 7;
static BaseType_t xWasDelayed;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount();
for (;;)
{
time = esp_timer_get_time();
deltaT = time - endTime;
endTime = time;
// Wait for the next cycle.
//xWasDelayed = xTaskDelayUntil(&xLastWakeTime, xFrequency);
vTaskDelayUntil(&xLastWakeTime, xFrequency);
// time = esp_timer_get_time();
// deltaT = time - endTime;
// endTime = time;
// Perform action here. xWasDelayed value can be used to determine
// whether a deadline was missed if the code here took too long.
ESP_LOGE("TEST", "time %lld -- deltaT %lld -- xWasDelayed %d", time, deltaT, xWasDelayed);
}
}
-
This topic was modified 2 years, 1 month ago by support. Reason: formatting