Thank you for your quick reply.
I looked in the FAQ but couldn’t find an answer.
PlatformIo does not have a debuq mode with M5Stack. :
Debugging currently does not support M5Stack Core ESP32 board.
I adapted my code with your comments but it doesn’t work
Here is the ESP error message:
[D][esp32-hal-i2c.c:1344] i2cProcQueue(): Busy Timeout start=0x29d4, end=0x2a06, =50, max=50 error=1
[E][esp32-hal-i2c.c:318] i2cDumpI2c(): i2c=0x3ffbdd54
[I][esp32-hal-i2c.c:319] i2cDumpI2c(): dev=0x60013000 date=0x16042000
[I][esp32-hal-i2c.c:321] i2cDumpI2c(): lock=0x3ffb8604
[I][esp32-hal-i2c.c:323] i2cDumpI2c(): num=0
[I][esp32-hal-i2c.c:324] i2cDumpI2c(): mode=1
[I][esp32-hal-i2c.c:325] i2cDumpI2c(): stage=3
[I][esp32-hal-i2c.c:326] i2cDumpI2c(): error=1
[I][esp32-hal-i2c.c:327] i2cDumpI2c(): event=0x3ffb8668 bits=0
[I][esp32-hal-i2c.c:328] i2cDumpI2c(): intr_handle=0x3ffb869c
[I][esp32-hal-i2c.c:329] i2cDumpI2c(): dq=0x3ffdf100
[I][esp32-hal-i2c.c:330] i2cDumpI2c(): queueCount=1
[I][esp32-hal-i2c.c:331] i2cDumpI2c(): queuePos=0
[I][esp32-hal-i2c.c:332] i2cDumpI2c(): errorByteCnt=0
[I][esp32-hal-i2c.c:333] i2cDumpI2c(): errorQueue=0
[I][esp32-hal-i2c.c:334] i2cDumpI2c(): debugFlags=0x00000000
[I][esp32-hal-i2c.c:311] i2cDumpDqData(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:354] i2cDumpInts(): Debug Buffer not Enabled
[I][esp32-hal-i2c.c:1138] i2cProcQueue(): Bus busy, reinit
I can be an explanation.
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"
Do you have an idea ?
Thanks in advance.