ESP32-cam

Recurrent H/W and software problems
Post Reply
gianmagna
Posts: 15
Joined: Sun Feb 14, 2021 11:47 am
Has thanked: 22 times
Been thanked: 4 times

ESP32-cam

Post by gianmagna »

buongiorno a tutti
una domanda sulla ESP32-CAM :
deve avere 8MB di ram ?
ne ho acquistate 2 che nella descrizione le davano a 8MB,
non sono riuscito a caricare il firmware+data , al toolkit davano 4MB
Avrei bisogno di sapere il nome di un venditore serio che me ne fornisca una a 8MB
grazie anticipato
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: ESP32-cam

Post by cicciocb »

Buongiorno,
putroppo l'esp32 gestisce al massimo 4MB di RAM, anche se il chip esterno ha 8MB.

Comunque il toolkit indica solo la dimensione della memoria flash, non quella della PSRAM, quindi i moduli che hai comprato hanno 4MB di flash e 8MB di PSRAM (di cui solo 4MB sono accessibili)
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 120 times
Been thanked: 132 times

Re: ESP32-cam

Post by AndyGadget »

Gianmagna, are you getting the message "Failed to create fatfs filesystem 14". I've got an ESP32-CAM which I think is 4MB (PSRAM?) and it's giving this.

Cicciocb,
I'm severely confused about memory usage on the ESP32. Would it be possible to give a brief overview of how each type of memory is allocated and what is stored where? (Image, program, variables, files, and how the SD card ties in )?
User avatar
cicciocb
Site Admin
Posts: 1900
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 407 times
Been thanked: 1269 times
Contact:

Re: ESP32-cam

Post by cicciocb »

Hi Andy,
is just a simple description of the type of memories present in the ESP32 and their functionality.

First of all the ESP32 has internally:
- 520 KB of RAM
- 448 KB ROM

ROM is used by the operating system and cannot be changed.

RAM is mainly used for the operating system and user application.
Depending on the versions of Annex32, the RAM available to the end user is approximately less than 200KB as most of the memory is used by the OS itself and internally by Annex.
Some modules are equipped with an external RAM (called PSRAM or Pseudo Static RAM) to extend the RAM.
The maximum external RAM size that the ESP32 can handle is 4MB so even if the module has an 8MB chip, only 4MB will be available.
Annex32 automatically activates PSRAM if available.
However, there is a limitation because the PSRAM is connected externally via an SPI bus and therefore does not have the same performance as the internal RAM. In addition it lacks additional features (such as DMA).
For these reasons, many parts of the OS require internal RAM which can therefore cause an out of memory even if there is 4MB of PSRAM!

Flash memory:
The ESP32 is equipped with an external flash memory, generally sized at 4MB.
This memory is readable and writable and is generally used to host the "program" (the annex32 binary).
Part of this "memory" can also be used to host a file system (the fatFS) emulating a file disk system.

The ESP32 has the particularity to split the flash memory into partitions https://docs.espressif.com/projects/esp ... ables.html

These partitions can be modified and adapted depending on the size of binary firmware and the virtual disk.

In the current implementation of AnnexToolkit, the memory is split in 3 main blocks:
1- The firmware
2 - The OTA firmware (a dedicated firmware that handles the updates through the WiFi).
3- The FFAT (the disk partition).

The split of the space into these 3 partitions is function of the size of the flash (4MB, 8MB or 16MB) and function of the binary (Annex32 or AnnexCam).

Because the firmware of the AnnexCam is bigger than the one for the Annex32 (because of the face recognition library that takes a lot of space), the partition dedicated to the disk is smaller.

This explains why it is not possible to flash the ESPCAM with the file system (error "Failed to create fatfs filesystem 14" ) because the space allocated for the disk is too small.
AndyGadget
Posts: 222
Joined: Mon Feb 15, 2021 1:44 pm
Has thanked: 120 times
Been thanked: 132 times

Re: ESP32-cam

Post by AndyGadget »

Absolutely brilliant! Many thanks.
I'll read it in detail later.
Post Reply