One Cache Setting Cuts ESP32-P4 Camera Draw Time by 30%, Overtaking the ESP32-S31

User Avatar Aswinth Raj
Author
Share
ESP32-S31 And ESP32-P4 Benchmark Comparison

In a camera preview benchmark by the YouTube channel That Project, the ESP32-S31 drew each 800 x 480 frame in 17.0 ms, compared with 20.6 ms on the ESP32-P4 in its original test configuration. Both boards kept up with their cameras, displaying 25 fps on the S31 setup and 30 fps on the P4 setup. Increasing the P4's L2 cache line size from 64 to 128 bytes brought its draw time down to 14.5 ms, the lowest of the three runs.

The test

The S31 ran on an ESP32-S31-Korvo-1 board with a 1 MP SC101IOT camera on a parallel DVP interface. The P4 ran on an ESP32-P4-Function-EV-Board with a 2 MP SC2336 camera over MIPI-CSI. Both were built with ESP-IDF v6.1.1, and every number was measured live on the boards.

The change on the P4 side was the L2 cache line size. Raising it from 64 to 128 bytes, with the total L2 cache capacity unchanged, cut the P4's draw time from 20.6 ms to 14.5 ms, about 30% less, putting it ahead of the S31. The creator also points to the P4's larger display and its row-by-row framebuffer copy as factors in the original gap. A cache line is the block of memory the chip fetches at once from slower external RAM; for large, sequential frame buffers, bigger lines mean fewer trips to memory, which is exactly the access pattern of a camera image being pushed to a display.

Our take

In this demo, framebuffer layout, display traffic and cache configuration all affected how long a camera preview frame took to draw, so one build setting was enough to change which board came out ahead. The maker's own verdict is practical: if the camera is one feature of your project, the S31 does the job; if the camera is the centre of it, go with the P4. One caveat he flags himself is that his P4 is an early v0.1 chip that tops out at 360 MHz; he did not test the newer 400 MHz ESP32-P4 revision v3.x. For how the S31 compares with the chip most makers already use, see our ESP32-S31 vs ESP32-S3 comparison.

Image credit: That Project, YouTube, cropped and resized.

About the author: Aswinth Raj is an electronics engineer and the editor of CircuitDigest, where he has published more than 150 hands-on projects and tutorials across Arduino, PIC, ESP32, Raspberry Pi and EV battery systems. He selects the stories on this page for what engineers and makers can actually learn or build from. Connect on LinkedIn

Have any question related to this Article?

Add a comment

No account needed. Your comment appears once a moderator has reviewed it.

Never shown publicly.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.