Page 1 of 1

WROVER SPI RAM Findings

Posted: Tue Dec 25, 2018 5:45 am
by czuvich
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.

Re: WROVER SPI RAM Findings

Posted: Wed Dec 26, 2018 6:34 pm
by fivdiAtESP32
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.

Re: WROVER SPI RAM Findings

Posted: Wed Dec 26, 2018 8:14 pm
by czuvich
Thanks fivdiAtESP32. Valid points with ISR's.