I'm working with an ESP32-CAM (AiThinker) module and I’m trying to capture and serve photos via an HTTP server with the highest quality using UXGA (1600×1200) resolution.
Here’s my situation:
- Direct Capture Works:
When I run a basic sketch that only captures the photo (without using an HTTP server), the module successfully captures an image at quality 0 (maximum quality) in UXGA mode. The output indicates that the buffer in PSRAM consumes approximately 3.8–3.9 MB.
- HTTP Server Integration Fails:
I integrated an HTTP server to serve the captured photo via a URL (e.g., http://<IP>/capture). With the high quality settings (jpeg_quality = 0 or 2), the camera capture often fails with errors such as "NO-EOI" (No End-Of-Image) and eventually returns a 0x105 (ESP_ERR_NOT_FOUND) error, meaning the JPEG doesn’t include the correct end marker.
- Memory Allocation Adjustments:
I modified the buffer allocation in the component to always allocate about 3,950,000 bytes (3.95 MB) for each frame, ensuring enough memory for the high-quality UXGA image. Despite this, the HTTP capture still fails, even though capturing without HTTP works fine.
- Quality Settings Impact:
At a quality setting of 5, the photo is captured and transmitted over HTTP successfully, but at quality 0 or 2, the issue occurs. I suspect that the problem isn’t solely due to insufficient memory, but might be related to the timing/synchronization of transmitting the high-quality JPEG over HTTP.
My Questions:
- What might be causing the "NO-EOI" errors (i.e., the image is not being fully formed) when trying to send the photo via HTTP—even though the module can capture the photo when running a basic sketch?
- Is the HTTP server integration (or its timing/resource usage) interfering with the camera’s ability to form a complete JPEG image, especially at the highest quality settings?
- Are there any specific adjustments (e.g., increasing delays, tweaking DMA settings, adjusting XCLK frequency, or modifying task priorities) recommended for transmitting such high-quality, large images over HTTP with this module?
Environment Details:
ESP32-CAM (AiThinker) with OV2640 sensor
Using ESP-IDF v5.4.1
PSRAM is available, but only 4 MB of virtual address space is mapped
Direct capture (without HTTP) works at UXGA with quality 0, but the HTTP handler fails with “NO-EOI” errors and a 0x105 error.
Thanks in advance!