PSRAM Write Performance

Koepisch
Posts: 3
Joined: Wed Sep 12, 2018 7:02 am

PSRAM Write Performance

Postby Koepisch » Wed Sep 12, 2018 7:14 am

Hello,

i'm planning to use the I2S interface to attach a camera with parallel interface. Thats very challenging and there is a DMA implementation which uses a small video buffer. I need a matured video buffer with 2-3 MBytes. So i evaluate to send the single HLINE Data of 1000-1500 Bytes to the PSRAM in a very short time (HSYNC time). I don't have the ESP32 yet and i couldn't find any performance figures how much time a 1000 byte transfer to the PSRAM need (at max. SPI speed that is possible). Reading is not performance relevant, because i need to read the buffer once after the capture is done.

Are there any options to transfer from DMA-controlled RAM to the PSRAM (is there a DMA controlled transfer possible)?

Please can anybody share the performance figures of the PSRAM transfer time (and options) with me?

Thanks,
Koepisch

ESP_Angus
Posts: 2344
Joined: Sun May 08, 2016 4:11 am

Re: PSRAM Write Performance

Postby ESP_Angus » Thu Sep 13, 2018 12:33 am

Hi Koepisch,

The answer is "it depends".

With flash configured in quad I/O mode and 80MHz clock speed, theoretical transfer time for 1000 bytes is 25us (plus protocol overheads, which are significant).

If I make a program that only copies 1000 bytes, it actually copies it in about 10us. Why? Because PSRAM contents are cached in the internal ESP32 RAM, and the cache isn't full so the 1000 bytes are copied to internal memory only and not flushed to PSRAM.

If I make a program that copies 1000000 bytes instead, it copies in 135,708us (135.7us per 1000 bytes), because now the cache is having to flush to the PSRAM.

This is probably a reasonable expectation for max write speed (a little over 7Mbytes/sec), in a program which isn't doing anything else. In a real program, the PSRAM cache is also the flash cache which caches the flash contents, and the PSRAM shares the same SPI bus as the SPI flash chip which holds most of the program code.

So you can expect some overhead, depending on what else the ESP32 is doing at the same time - if the system is mostly idle (and if the routines using PSRAM can be moved to run from IRAM) then you can expect max performance. If other tasks are running and causing data (code) to be read into the cache periodically, this will impact the max write speed - and it really will depend on the workload and the relative priorities of the task(s) which are running.

I know for a fact there are applications using PSRAM to capture from a camera in this way, however I don't know what the maximum capture rate they've achieved is (someone else may know this).

Koepisch
Posts: 3
Joined: Wed Sep 12, 2018 7:02 am

Re: PSRAM Write Performance

Postby Koepisch » Thu Sep 13, 2018 9:03 am

Hi Angus,

thanks for the detailed answer. I think i were a little bit to optimistic in that topic. I think i have to outsource the camera grabbing (Altera MAX10 with SDRAM?) and use the fastest data transfer method to get the data into the ESP32 to send them via Wifi. I will further study the I/O functions of the ESP32.

Regards,
Koepisch

Who is online

Users browsing this forum: No registered users and 113 guests