Hi,
I have to drive a stepper motor with my esp32, with a frequency that requires a delay below milliseconds (for example 100 microseconds). The esp32 has WiFi and ESP-NOW active at the same time, receiving some data from another esp32. My idea was to create a freeRTOS task for the stepper motor on core 0, so that core 1 can run WiFi ESP-NOW, but I have a hard time managing microseconds delay by doing so. I know that the vTaskDelay() cannot go higher than 1kHz.
Any suggestions? Thanks in advance!
Stepper motor using freeRTOS task
-
- Posts: 2
- Joined: Thu Feb 03, 2022 11:33 am
Re: Stepper motor using freeRTOS task
Maybe this will help you. You can use ets_delay_us(stepper_delay); between steps. But, for example, every step 50 execute vTaskDelay(1);
or you can disable wtd in stepper task
esp_task_wdt_delete(NULL);
esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(0));
in the stepper task before the infinite loop
or you can disable wtd in stepper task
esp_task_wdt_delete(NULL);
esp_task_wdt_delete(xTaskGetIdleTaskHandleForCPU(0));
in the stepper task before the infinite loop
-
- Posts: 9759
- Joined: Thu Nov 26, 2015 4:08 am
Re: Stepper motor using freeRTOS task
Suggest not using ets_delay_us, as it's polling. The proper way to get low-jitter sub-ms timing would be to use a hardware timer.
Who is online
Users browsing this forum: Bing [Bot] and 177 guests