• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

AI Thinker, VGA mode, init’s in heap rather than psram

Q&A Forum › Category: ESP32 › AI Thinker, VGA mode, init’s in heap rather than psram
0 Vote Up Vote Down
Ian Beaver asked 3 years ago

As we all know the ESP32 CAM can operate with several different frame size settings. In order of increasing size these are QVGA, CIF, VGA, SVGA, XGA, SXGA and UXGA. By default the RNT demo sketches install as UXGA which is the largest. That all seems fine and dandy and works as expected.
Problem is that I do not want such large file sizes and need to use the more compact VGA and SVGA frame sizes. And this has created an issue that I do not know how to resolve. Hence this question to this forum.
After considerable investigation I have discovered that if I specify the VGA or SVGA as frame sizes then the camera init process grabs a large chunk of my available heap memory. For VGA it uses 61K bytes and for SVGA it uses 77K bytes. However for XGA, UXGA or SXGA it does not use any heap memory at all.
This loss of heap memory has become a problem for me because my AI-Thinker not only takes photos but it acts as a file server for those photos and to process the stored files it needs a good chunk of heap memory available for a temporary storage buffer, at least as big as the file in question.
How this issue first manifested was that on occasions my board would throw a GMF fault and reboot unexpectedly. This turned out to be when there was insufficient heap available for the size of the file. On deeper investigation I discovered  this issue only applied to VGA, SVGA frame sizes, which of course are the ones I need to use.
I am monitoring the size of the heap available using functions available from the ESP.h library. In particular I use ESP.getMaxAllocHeap() to read the size of the largest chunk of heap available.
You may ask why do I need the smaller frame sizes in the first place. The answer to that is my camera/file server application will be installed in a rather remote location that has no access to internet, wifi or even gprs so the file data has to be transmitted via a rather slow custom radio link. So bytes are really precious to me.
To simplify my question, what I would really like to know is if there is a way to force the camera to install into the PSRAM when using the VGA and SVGA frame sizes rather than using up my available heap memory. That would make my day. TIA.

Question Tags: framesize, heap, psram, vga
3 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi Ian.
I didn’t know about that issue related to the frame sizes.
Unfortunately, I have no idea how that issue can be solved.
Have you tried posting your issue in the ESP32 or arduino forum? Or other similar forums? I think you’ll have more chances to get help there.

  • https://www.esp32.com/viewforum.php?f=19
  • https://forum.arduino.cc/

Regards,
Sara

0 Vote Up Vote Down
Ian Beaver answered 3 years ago

Thanks Sara. It is always difficult to know if the problem lies with myself or with the equipment so thought I would try posting to your forum first. I find it odd that I am not seeing this problem mentioned in the espressif forums or the likes of stackexchange etc, and do not want to make myself look stupid by posting dumb stuff there. But looks like I am now going to have to. Cheers.

0 Vote Up Vote Down
Sara Santos Staff answered 3 years ago

Hi.
You don’t look stupid for asking smart questions. I don’t think it is dumb stuff.
And if anyone tells you the contrary, they are the ones making themselves stupids. 😉
Don’t be afraid to ask questions.. But I know the feeling. People in forums tend to be pretty aggressive in their answers. I always try to be nice to everyone and help as much as I can.
 
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.