WROVER SPI RAM Findings

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

WROVER SPI RAM Findings

Postby czuvich » Tue Dec 25, 2018 5:45 am

I thought I would post my findings using the WROVER. I purchased the WROVER since I needed to use both WiFi and BLE. The extra RAM would help with larger JSON calls and in memory models using dynamic memory.

Even after purchasing the WROVER I was still getting memory exceptions. Here’s what I discovered:

The Arduino binaries are compiled with explicit external heap allocation. Standard malloc does not allocate to external RAM. If you’re like me, I tend to do break down my problems into classes. Luckily, all I had to do was define a custom allocator base class and also use it for my dynamic data structures.

If you need some code to do that, google OSVM (open source vehicle monitoring). There’s a great example of a custom allocator for the ESP32 WROVER with SPI RAM.

That takes care of your own code, but what about the BLE library? Well, there’s not much you can do about that until the libraries either 1) use explicit heap allocation for SPI RAM or 2) Recompile the libraries for malloc.

All of that being said, there’s not much work required to use the extra heap. I’m not sure why ESP32 Arduino is not compiled using the malloc option though. For most hobbyists it’s probably the best (and default) option. I hope this helps out anyone using the WROVER dev kit in Arduino.

fivdiAtESP32
Posts: 47
Joined: Thu Dec 20, 2018 9:47 am

Re: WROVER SPI RAM Findings

Postby fivdiAtESP32 » Wed Dec 26, 2018 6:34 pm

czuvich wrote: I’m not sure why ESP32 Arduino is not compiled using the malloc option though. For most hobbyists it’s probably the best (and default) option.
See here.

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: WROVER SPI RAM Findings

Postby czuvich » Wed Dec 26, 2018 8:14 pm

Thanks fivdiAtESP32. Valid points with ISR's.

Who is online

Users browsing this forum: No registered users and 119 guests