Page 1 of 1

How to create a maximum 32bit Array?

Posted: Thu Apr 28, 2022 7:14 am
by Tobi82m
Hello,

i need to create a 32bit Array with the maxium Size.

If i create a normal Array the maxium is uint32_t data[35000]. The DRAM was 162KiB and after creation it was 26KiB.
If i create the Array with malloc, the maxium is: data = (uint32_t *) malloc(27000 * sizeof(uint32_t));

Im new in Allocation of Memoy. Can anyone explain me how to maxium the Array Size. I need 50.000 or bigger.

Thank you!

Re: How to create a maximum 32bit Array?

Posted: Thu Apr 28, 2022 7:41 am
by chegewara
1. 50 000 x 4 = 200kB memory required for this array
2. you said you have only 162kB - not possible
3. memory should be in 1 consecutive memory block, you probably did not check it, just free memory, which is not the same amount
4. how about using PSRAM?

Re: How to create a maximum 32bit Array?

Posted: Thu Apr 28, 2022 11:22 am
by Tobi82m
My Memory:

6KiB : DRAM
162KiB: DRAM
14 KiB: D/IRAM
111KiB: D/IRAM
47KiB: IRAM

If i create a Array[35000] it looks:

6KiB : DRAM
26KiB: DRAM
14 KiB: D/IRAM
111KiB: D/IRAM
47KiB: IRAM

Ok, how can i use the PSRAM?

Re: How to create a maximum 32bit Array?

Posted: Thu Apr 28, 2022 12:36 pm
by Tobi82m
I have a Wroom32. There is no PSRAM.
Is there a Module with PSRAM and 24 usable GPIO Outputs?

Re: How to create a maximum 32bit Array?

Posted: Thu Apr 28, 2022 3:38 pm
by chegewara
- 35000 elements
- each element is 4 bytes
- 4x35000 = 140000

- (162 - 26) * 1024 = 139264 bytes (assuming either 162kB or 26kB is approx, 140000 bytes used)
Tobi82m wrote: Is there a Module with PSRAM and 24 usable GPIO Outputs?
esp32 S3?

Re: How to create a maximum 32bit Array?

Posted: Fri Apr 29, 2022 11:08 am
by Tobi82m
ESP32 S3 looks good. PSRAM is usable for a really Big Array?

There are many Outputs. But how many of them are really usable as Output? PSRAM need GPIOs?