Page 2 of 2

Re: Esp32 crash on nvs_set_blob (memcpy in ROM)

Posted: Sun Dec 15, 2024 1:23 am
by MicroController

Code: Select all

...
        esp_err_t ret = adc_continuous_read(handle, p, sampleSize, &ret_num, 0); if (ret!=ESP_OK || ret_num!=sampleSize) return;
...
You may want to try a bigger buffer to get as many samples as possible from each call to adc_continuous_read().
And you probably don't want a timeout of 0.

Btw, the 'doc' says:
If the generated results fill up the internal pool, newly generated results will be lost. Next time when adc_continuous_read() is called, this function will return ESP_ERR_INVALID_STATE to indicate this situation.
Does this match what you observe?

Re: Esp32 crash on nvs_set_blob (memcpy in ROM)

Posted: Sun Dec 15, 2024 7:33 am
by brebisson
Hello,

Ok, message for others looking for the same problem.
I think that I found the issue...

I needed to add this line:

CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE=y

In the sdkconfig file in visual studio code / ESP-IDF...
To make the whole ISR IRAM safe...

Cyrille

Re: Esp32 crash on nvs_set_blob (memcpy in ROM)

Posted: Thu Jan 23, 2025 1:10 am
by CseaTec
Hello,

Ok, message for others looking for the same problem.
I think that I found the issue...

I needed to add this line:

CONFIG_ADC_CONTINUOUS_ISR_IRAM_SAFE=y

In the sdkconfig file in visual studio code / ESP-IDF...
To make the whole ISR IRAM safe...

Cyrille

OMG. Cyrille, I'm going to have to send you a box of chocolates, a case of beer, and a Christmas card later this year. I have been fighting the exact same problem all day today since I was changing my ADC architecture from one-shot to continuous. After about 10 straight hours of adding scope signals, debug printf statements, and dozens of code modifications to narrow in on what was going on, I was able to determine it was the nvs_set_blob commands colliding with the adc_continuous DMA updates. That finally led me to do a more appropriate Google search which ultimately revealed your post topic here.

I made the change you suggested here to the sdkconfig and all is now working as hoped. No more crashes. The ADC continuous was needed for my application and has made a *huge* difference in reducing the overhead of individual one-shot ADC conversions.

THANK YOU again for sharing your success. I have done this before in this forum, so I will continue to do so since it might help someone else like you helped me.