ESP32 PSRAM performance drop

copych
Posts: 20
Joined: Tue Mar 07, 2023 6:04 pm

ESP32 PSRAM performance drop

Postby copych » Tue Mar 07, 2023 6:27 pm

I experience strange behaviour of my sketch. It deals with playing audio samples thru i2s ADC. First I allocate 3MB of PSRAM with ps_alloc(), and then cache sample data from LittleFS files to PSRAM byte array cause flash performance is not enough. Initially I only used only 300-500kB of the reserved 3MB, and it was all ok. But when I loaded almost all 3MB of data, It began to stumble. And the strange thing is that it stumbles at the same data in the first 300-500kB which was doing ok, when there were no following data. I can't understand what consumes those extra microseconds. Any ideas, please?

copych
Posts: 20
Joined: Tue Mar 07, 2023 6:04 pm

Re: ESP32 PSRAM performance drop

Postby copych » Thu Mar 09, 2023 3:36 pm

I still got no remedy, but of what I have found out, such behavior might be caused by the quite limited size of the intermediate cache between flash/PSRAM and RAM. It seems that slowing down is happening due to the growth of the struct, servicing playing back the samples, not to the growing of samples itself. At some point the struct can no longer fully reside in RAM and begins moving forth and back thru the cache.
PS. Confirm. I have moved filename char array out of the struct, and somehow performance was improved to the acceptable level.

Who is online

Users browsing this forum: No registered users and 73 guests