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.
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.
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.
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.