-
Notifications
You must be signed in to change notification settings - Fork 7.6k
1.0.5 source code execution on ESP32 much slower than with 1.0.4 #4973
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Having the same issue unfortunately. Hardware: Board: ESP32 Dev Module Loaded Libs: There is huge difference after 1.0.4 where the slowdowns result in panics and corrupt heap. Been searching for ages for a solution as I thought it would be in one of the loaded libs. Reverting back to 1.0.4 makes a huge speed difference in for example mqtt sending, but also all the panics and crashes have disappeared. As soon I compile against 1.0.5 or 1.0.6, within 15 minutes it crashes again.
|
For my project I found out that it is just the analogRead() function which is much slower in version 1.0.5 and also 1.0.6. As far as I understand, this is the corresponding change in the library: #3377. As a workaround, I have written my own my_analogRead() function now. |
I am not using analogRead, only 3 digital reads. It's hard to tell where it's coming from. I've just disabled ESPAsyncWebserver and that makes it run more stable, but if in turn I just disable AsyncMQTT, it also runs more stable. But running both will make it crash. I've patched all the libs with the fixes I could find and not able to pinpoint an exact cause. This problem has costed me 2 weeks already and I am glad with 1.0.4 it works perfect. When the project is finished, I'll try to revisit this and see where the hiccups are coming from. |
Please keep this on topic. The issue is about slowdowns from analogRead, not crashes (likely memory issues). OP has posted a workaround. |
Just FYI for people stumbling upon this issue: workaround code is here |
I just observed the same when I upgraded from v1.0.4 to v1.0.6. The benchmarks for one of my libraries say that
Interestingly, the new
Fortunately, I need a sampling rate of only about 200Hz, so I don't have any problems. But I can see why a sampling rate of 8kHz would no longer work. That would require |
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions. |
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions. |
I have the same problem. 1.0.4 is fast. after upgrading, 1.0.5 and 1.0.6 super slow. I don't have analogRead in my loop(). In the meantime, has anybody figured out what causes the problem? |
The same problem, below a part of the sketch. Please help! #include <driver/adc.h>
#define data_buf_size 15000
uint16_t data_buf[data_buf_size]; // Buffer for storing sensor data.
uint16_t data_buf_pointer_write=0;
int samples = 10000;
void setup()
{
Serial.begin(115200);
adcAttachPin(35); //
analogSetAttenuation(ADC_11db);
analogSetClockDiv(1);
analogSetCycles(1); // not available above V1.04
analogReadResolution(12);
// adc1_config_width(ADC_WIDTH_BIT_12);
// adc1_config_channel_atten(ADC1_CHANNEL_0,ADC_ATTEN_DB_0);
}
void loop()
{
data_buf_pointer_write=0;
samples = 1000;
unsigned long start_time = micros();
do
{
data_buf[data_buf_pointer_write++] = analogRead(35);
} while (data_buf_pointer_write < samples);
unsigned long spent_time = micros() - start_time;
Serial.println(String(1000000/(spent_time)) + "KHz"); // works because samples = 1000
delay(1000);
} |
We have started to use the ESP-IDF API for ADC. In 1.0.4 we had a custom driver. |
My program does not use ADC, still, loop time went up massively. I use all 3 Serials, can bus, several timers, wifi tcp, udp, http
-------- Original message --------From: Me No Dev ***@***.***> Date: 07/10/2021 23:59 (GMT-10:00) To: espressif/arduino-esp32 ***@***.***> Cc: ch-fb ***@***.***>, Comment ***@***.***> Subject: Re: [espressif/arduino-esp32] 1.0.5 source code execution on ESP32 much slower than with 1.0.4 (#4973)
We have started to use the ESP-IDF API for ADC. In 1.0.4 we had a custom driver.
—You are receiving this because you commented.Reply to this email directly, view it on GitHub, or unsubscribe.Triage notifications on the go with GitHub Mobile for iOS or Android.
|
Hardware:
Board: ESP32 Dev Module
Core Installation version: 1.0.5
IDE name: Arduino IDE
Flash Frequency: 40Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10
Description:
I am developing an open source edrum module (source code at Github: https://github.com/corrados/edrumulus) on my ESP32 dev module (NodeMCU with dual core ESP32). For that I need to sample from multiple ADC at a rate of 8 kHz and do some digital signal processing. I have worked with version 1.0.4 and could successfully process up to 7 channels. After upgrading to version 1.0.5, now I cannot even process just one single channel. So, the same source code executes much slower now.
Basically, I am using a "hw_timer_t" and check with "hw_timer_t" to get a constant sampling rate. Then I am using analogRead(), the MIDI-library and some floating point calculations.
The text was updated successfully, but these errors were encountered: