Realtime task with esp32

Sysprogs forums Forums VisualGDB Realtime task with esp32

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #33311
    edo76mal
    Participant

    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
    #33313
    support
    Keymaster

    Hi,

    This looks like a question about the ESP-IDF framework and not something specific to VisualGDB. Please consider asking on the Espressif forums instead. Any advice they may suggest will also work with VisualGDB.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.