1

I'm a software developer and trodding in murky waters here so please do forgive my lack of knowledge. I've been developing a sensor with the nRF9160DK and some accelerometers. I need to continuously write data to a memory as the RAM is not enough to hold an entire event.

I've tried a NOR-flash, it was not fast enough, I need to write at least 32kB/s. I tried an sd-card. It was fast enough but allocating new pages took a bit too long and the power drawn was way too high. I'm now thinking of a NAND or FRAM external memory and writing via QSPI. The memory size needs to be at least 8MB which might make FRAM difficult.

Here is where I'd like help. What would you recommend? What draws the least but still fulfills the speed demands? If there is a specific product you have in mind, I'd greatly appreciate it. Or maybe an alternativ, I found this that might be interesting: https://www.electrokit.com/en/product/sparkfun-openlog-2/ as it draws 2mA in idle mode though I doubt that is with the sd-cards draw included. I'm open to any recommendation to solve this! It's the last bump in a very long road I have been traveling.

I should mention I've also tried shutting down the sd-card and starting it first at en event is triggered but the mounting time is too slow(148 ms) and critical data is lost. I could save 148 ms of data in RAM but I don't think the mounting operation can be paused or multithreaded in the required way.

Thank you beforehand and please, ask if I didn't include information I did not know to be vital.

7
  • Do you need the 32kB/s permanently (or close to it), or just sporadically (e.g. when some event happens)? What are your power constraints? Have you looked into SRAM or SPI RAM? No idea if/how either are supported on an nrf9160, though (or their power draw).
    – jcaron
    Feb 3, 2022 at 13:52
  • Sprodically during maybe 20 seconds. The power constraints are harsh, pref max 1mA power drawn. SRAM is too small but SPI RAM might be an alternative. I'm trying out multithreading atm so that I load a buffer in RAM with data while the mounting procedure executes.
    – nwretborn
    Feb 3, 2022 at 18:50
  • Have you tried compressing the data ? Perhaps with LZ4 or zlib ? With say, 64kB data frame at a time. If you're lucky, your 8MB may come down enough to fit on the flash you have in the nRF9160DK. Or atleast, until the SD card mounts. Feb 3, 2022 at 21:10
  • That is true but there is the wear problem of a flash drive. Is it possible to multithread this on a single core CPU such that the mounting process is in one thread that is executed whilst the FIFO buffer of the sensor is not near full. If it is near full, switch thread to the other function that saves data to RAM. The threads then switch back and forth until the mounting thread is done. I'm not sure if you can check that condition whilst running a thread in that manner. Not sure about the design here.
    – nwretborn
    Feb 3, 2022 at 23:57
  • 1
    Hmm. Here's what someone else who faced similar situations did. gaidi.ca/weblog/… Feb 7, 2022 at 17:15

1 Answer 1

2

SPI RAM chips such as the 23LC1024 would be ideal for this application, since they have zero hold-time; you just set an address, and stream the data in on an SPI interface at up to 20 Mbit/s or a 4-bit SQI interface at 80 MBit/s, and there is an auto-incrementing address register so no need to worry about block or sectors; just stream the data in or out.

The big snag is the memory size; the 23LC1024 is 1 Mbit; there are similar devices with 4 Mbit (MR25H40DF or IS62WVS5128FALL) but you'd still need 16 devices to meet your memory requirement, and that may be too many - a pity, since in all other respects they'd be a good fit for your application.

3
  • Yeah, it is a shame. if a 4MB one existed, it would be golden.
    – nwretborn
    Feb 8, 2022 at 12:12
  • There are SPI RAM chips with much larger capacities, including 64 Mbit (8 MB). Not sure about availability but they’re quite cheap.
    – jcaron
    Feb 8, 2022 at 13:10
  • You are right; I was just looking at parts stocked by the usual distributors, but if you go off-piste there is the APMemory APS6404L-3SQR with 64 Mbit. Unlike the other parts, It is pseduo-static, so it'd be necessary to read the fine print in the data sheet to see if there are any strange characteristics, but it does seem to be pin-compatible with the smaller devices, so maybe it'd be worth a try...
    – jayben
    Feb 8, 2022 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.