Help needed - ESP32S3 analogRead execution time πŸ™‹

Hey guys,
Unfortunately, I don’t own one of the esp32s3 boards I was wondering if some of you guys could help me testing :smiley:

I would like to know what is the elapsed time of analogRead on that board.
So if someone could let me know what would be the output of this code that would be very very helpful.

void setup() {
  Serial.begin(115200);
}

int t = 0;
unsigned int timestamp = micros();

int tmp_read;
void loop() {

  tmp_read = analogRead(A0); // read analog input from any analog pin - feel free to change it 

  if(t++> 10000){ // 10k analog reads
     t = 0;
     Serial.println(micros() - timestamp);
     timestamp = micros();
  }
}

Thanks a lot!

602636
602635
602653
602651
602661
602642
602628
602651
602721
602654
602647
602639
602648
602679
602672
602703
I hope this is what you expected.

Module is Esp32-S3-Wroom-1U

1 Like

Yep that’s it, thanks!

Unfortunately, it’s very long. Arround 60us for one analogRead. It is the same for ESP32 based boards.
With the custom driver in our library we are reading analog output with latency of around 10us, which is still very long, but manageable.

Since this driver is not working with ESP-S3, we will not be able to support the low side current sensing with the ESP32-S3 for now.

https://github.com/simplefoc/Arduino-FOC/issues/198

I’ll update the dev branch so that the ESP32 compile does not break any more. Once when it’s done I’ll post in the followup of this thread. :smiley:

1 Like

For interest sake I repeated this test with an ESP32-S3-Wroom-1 and got similar results

21:24:36.447 β†’ 596155
21:24:37.060 β†’ 596155
21:24:37.675 β†’ 596160
21:24:38.243 β†’ 596155
21:24:38.851 β†’ 596155
21:24:39.459 β†’ 596152
21:24:40.065 β†’ 596153
21:24:40.628 β†’ 596162
21:24:41.235 β†’ 596156
21:24:41.847 β†’ 596153
21:24:42.415 β†’ 596154
21:24:43.023 β†’ 596153
21:24:43.629 β†’ 596154
21:24:44.230 β†’ 596161
21:24:44.789 β†’ 596154
21:24:45.393 β†’ 596155
21:24:45.994 β†’ 596152
21:24:46.600 β†’ 596154

I am busy trawling through looking for a way to get the analogue working on the S3

1 Like

Hello,
I am also working on this issue, as porting FOC towards ESP32 would create new perspectives on IOT. Unfortunately, on the new ESP32-C6, I am limited at 27 kHz using newest ESP IDF. Our usual implementation is on S32K3, where we can implement nearly isochronous AD of two phase currents. For our motors the discrepency in time is not usable. Did you try i2s with triggering, I am fuddling with the implementation.

Some people on the discord were discussing using i2s.