Code: Select all
E (33283) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (33283) task_wdt: - IDLE1 (CPU 1)
E (33283) task_wdt: Tasks currently running:
E (33283) task_wdt: CPU 0: esp_timer
E (33283) task_wdt: CPU 1: vWhite
I'm trying to execute a function every 125us (effectively 8kHz). I think this is too fined-grained for RTOS for a delay, so I need another mechanism. So what I do is create a call-back that sets "hit" to true every 125us:
Code: Select all
volatile int8_t hit;
static void timcb(void* arg)
{
hit = 1;
}
Code: Select all
const esp_timer_create_args_t timargs = {
.callback = &timcb,
.name = "marksperiodic"
};
esp_timer_handle_t every;
esp_timer_create(&timargs, &every);
esp_timer_start_periodic(every, 125);
Code: Select all
void vWhite(void* param)
{
int idx =0;
for(;;) {
taskYIELD();
esp_task_wdt_reset();
if(!hit) continue;
hit = 0;
dac_output_voltage(DAC_CHANNEL_1, track_raw[idx++]);
if(idx>= track_raw_len) idx = 0;
}
}
Code: Select all
TaskHandle_t hnd1 = NULL;
esp_task_wdt_init(3, false);
esp_task_wdt_add(xTaskGetIdleTaskHandleForCPU(1));
xTaskCreatePinnedToCore(vWhite, "vWhite", 10000, (void*) 1, configMAX_PRIORITIES/2, &hnd1, 1);
The complete code is https://gist.github.com/blippy/c13cab82 ... 6bbf0835fa