Issue with isolating a cpu1 core ESP-IDF

SauliusJ
Posts: 5
Joined: Thu Mar 16, 2023 7:47 am

Issue with isolating a cpu1 core ESP-IDF

Postby SauliusJ » Thu Mar 16, 2023 2:43 pm

Hey,

I am struggling to find a solution for my problem. Here are the details:
DevKit - ESP-WROVER-KIT-E, using ESP-IDF framework

My goal is to use ESP32 both cores separately - CPU1 have to be responsible ONLY for data measurement, CPU0 - http server, connection to wifi and etc.
Data measurement goal - 10 kHz, no jitter, measurement time - around 20-30% of single core RAM consumption, MAX priority (data measurement cannot be interrupted by any source (wifi, wdt, http, etc.)
Here comes the problem - I am unable to exclude all the tasks from core0. All the affinity settings i can find in menuconfig are set to cpu0, the measurement task - pinned to cpu1. However, there is still an enormous amount of jitter, while connecting to the http server, which would make the measurement unreliable. (1) Is there a possible way to COMPLETELY exclude all the other stuff from cpu1 and use it only for data measurement? if not, whats the reason of having dual core?

(2) Triggering the measurement - i have created a esp_timer, dispatch_mode configured as ISR, it is registered properly (i think). I am deciding between 2 options - either modifying a global variable, whilst constantly checking its value in data measurement task OR notifying the task that it should start. Second way is harder to implement, but should save a lot of RAM (as from what i have read already). Which way i should choose? I want to dedicate CPU1 only for data measurement part, so the polling doesn't sound as bad. Accessing global variable from both ISR and measurement task also does not scare me since it's only "a switch", no sensitive data being passed.

Sorry for the long post, I hope someone can help me.
Thanks in advance !
Best regards,
Saulius J

SauliusJ
Posts: 5
Joined: Thu Mar 16, 2023 7:47 am

Re: Issue with isolating a cpu1 core ESP-IDF

Postby SauliusJ » Mon Mar 20, 2023 9:20 am

TLDR:
(1) Is there a possible way to COMPLETELY exclude all the other stuff from cpu1 and use it only for data measurement? if not, whats the reason of having dual core?

(2) When trying to connect to created http server port, the procpu resets. doubleExceptionVector error. Tips on solving it?

MicroController
Posts: 1709
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Issue with isolating a cpu1 core ESP-IDF

Postby MicroController » Wed Mar 22, 2023 9:42 am

For the lowest jitter and latency, you may want to look into using a dedicated gp timer which you set up to execute a callback you provide. In your callback handler you could directly, synchronously start the measurement and possibly notify a task that the measurement is running and that the task should process the result when it becomes available.

The "normal" esp_timer is used/shared by other components of the IDF and may pick up a lot of jitter from that fact alone.

Who is online

Users browsing this forum: 137502805@qq.com, Bing [Bot], cartersm57@gmail.com, Majestic-12 [Bot] and 108 guests