Mapping external FRAM or SRAM as heapspace RAM

Hello all, again I find myself for want of memory… I’m working on a datalogging/sending project and after implementing the mqtt-tls encryption, I’d like some more memory to actually store larger buffers/messages and implement compression algorithms. I bought some spi FRAM chips for this purpose. I can write fxn’s to read/write from them but I don’t know how to actually map them as ram. ie, I’d like to be able to declare a pointer to a certain ram spot and read/write char’s to it as if it were in the heap.

I’m wondering firstly if this is even possible. I looked at the nordic’s online datasheet and it had no mention of such a capability, although I don’t think that’s the full datasheet. I also read that this was possible/common in the esp32 mcu. ARM m4 documentation reveals a whole gb of address values reserved for external memory but not much in the ways of using it. I am assuming that I’d be re-compiling the particle OS at this point correct?

second thing i’m wondering is if there’s an easier way… the big news recently has been the discontinuation of the mesh protocol. I know some people have mourned it’s loss and all but I’m wondering if this will free up more heap space for me? Does anyone have any ballpark estimates on how much more free ram we’ll see after that update? I really don’t want to recompile the os if I don’t have to.

any answers to either of these questions is much appreciated,
thanks- colin

Not an expert on the subject but I believe particle already uses an on-board 4MB SPI flash. So the interface to expand the addressable memory is not going to be an option.

Why do you want this memory mapped as directly addressable anyway? How big are your data points? I have created a few data loggers with external memory. The easiest way is just to use a linked list with a fixed data size.

sorry for the late reply, busy few weeks… Jack you’re right, there’s only 1 available addressable RAM ‘slot’ which is taken up by the extra flash. I wanted it to be adressable because I was using a library which read in a long buffer and sent it off as an mqtt message… I wanted to give it one large contiguous memory space per message for efficiency, but I don’t think that’s gonna happen. I spoke with some particle people that were around, who said we’d be getting a lot more memory in the next update anyways. thx for the reply though… :slight_smile:

It’s not possible. The nRF52840 only support expanding the flash memory via QSPI external NOR flash. It doesn’t support other technologies (like FRAM, or SPI RAM), and also doesn’t support writing in memory mapped mode. The memory mapped mode is only intended for reading or for code execution (XIP, execute-in-place).

Also, the QSPI bus is not exposed on the Gen 3 devices including the Boron, so you couldn’t easily attach another chip to it, anyway.