The configuration of my ADS1115 is correct.
My code works without FreeRTOS
When I run my program. ESP reboots automatically. Here is an excerpt from my code.
Can you help me ???
Tanks.
Pierre
xTaskCreatePinnedToCore(
task420mA, /* Function to implement the task */
"task420mA", /* Name of the task */
10000, /* Stack size in words */
NULL, /* Task input parameter */
0, /* Priority of the task */
NULL, /* Task handle. */
0); /* Core where the task should run */ ```
void task420mA( void * pvParameters ) {
for(;;) {
Serial.println(ads.readADC_Differential_0_1());
delay(1000);
} // fin for
} // fin task 420mA```
It will be hard to determine from a few lines of code. Have you looked through this page: https://freertos.org/FAQHelp.html - it contains a collection of debugging features and tips.
Probably not the problem, but note you are allocating 10,000 words, or 40KBytes as the task’s stack - that seems excessive.
What does the ESP give as the reason for the reboot?
If you put a break point at the beginning of your task does it ever get hit? If so, can you step through the function to see how far it gets?
Is it valid to call delay() - what does it do? I would expect to see a call to vTaskDelay().
The readADC function instructs the ADC to read a voltage on the desired pin.
Then readADC waits for this value to be ready (since it takes some time for an ADC to convert an analog value present on one of its pins, into a digital value)
and finally, readADC retrieves this value, to be able to communicate it to us.
I tried with a Semaphore but still not good.
I read the doc of the FreeRTOS page " xSemaphoreTake"
Pierre, please answer this question of Richard. To even take a remote guess as to what is happening, we need to know how far in your system setup you get. When you single step through the code, do you ever get as far as vTaskScheduler()? If yes, does your timer interrupt get invoked at all? And the task function as Richard asked? Which memory manager do you use and how much memory do you have available? Do you ever get to a call to pvPortMalloc()?
You should first try to get a rough understanding of how FreeRTOS gets initialized and a system under FreeRTOS works. A lot of questions answer themselves at that point.