How to create a maximum 32bit Array?

Tobi82m
Posts: 23
Joined: Wed Feb 16, 2022 9:10 am

How to create a maximum 32bit Array?

Postby Tobi82m » Thu Apr 28, 2022 7:14 am

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!

chegewara
Posts: 2258
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to create a maximum 32bit Array?

Postby chegewara » Thu Apr 28, 2022 7:41 am

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?

Tobi82m
Posts: 23
Joined: Wed Feb 16, 2022 9:10 am

Re: How to create a maximum 32bit Array?

Postby Tobi82m » Thu Apr 28, 2022 11:22 am

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?

Tobi82m
Posts: 23
Joined: Wed Feb 16, 2022 9:10 am

Re: How to create a maximum 32bit Array?

Postby Tobi82m » Thu Apr 28, 2022 12:36 pm

I have a Wroom32. There is no PSRAM.
Is there a Module with PSRAM and 24 usable GPIO Outputs?

chegewara
Posts: 2258
Joined: Wed Jun 14, 2017 9:00 pm

Re: How to create a maximum 32bit Array?

Postby chegewara » Thu Apr 28, 2022 3:38 pm

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

Tobi82m
Posts: 23
Joined: Wed Feb 16, 2022 9:10 am

Re: How to create a maximum 32bit Array?

Postby Tobi82m » Fri Apr 29, 2022 11:08 am

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?

Who is online

Users browsing this forum: No registered users and 146 guests