Best Storage Option for MIMXRT1062

lerible

Member
Hello,

We need to capture several MB of A/D data, and then access that data via algorithms in the MIMXRT1062. I was wondering what the best memory option would be for this application. From what I can tell, either SD or MMC would provide the densities we need, but having to move the data back onto the chip seems inefficient.

Any suggestions for what we are trying to do is greatly appreciated.

lerible
 
To say which is "best", we need more info about your application, like the amount of data and sample rate.

But generally speaking, NOR flash chips have the lowest latency but relatively slow erase and write performance, so they work well for slow and moderate speed data.

SD cards have high latency, but can have high overall throughput. If you data rate is fast, you'll probably also need a large memory buffer and an interrupt-based collection scheme to keep harvesting incoming data during those rare but lengthy times the SD card is busy. Maybe Teensy's internal memory will be enough, or maybe you'll also need a PSRAM chip.... it really depends on the details like data size and sample rate, which we don't know.

Different memory on Teensy has different caching. To give advice on which is best to use, at least some idea of how well (or poorly) your intended algorithm makes use the 32K cache would also be needed. If you don't have any idea and can't tell us about the algortitm, you might need to learn by experimenting. We might be able to help you with tips on how to do such benchmarks... but there too, difficult to give useful advice without at least some better picture of what you're trying to do.
 
Thanks for the reply. Our sample rate will be high, up to 10 Msps. We aim to read the external A/D (parallel data bits) and use DMA to transfer the data into memory. We will then utilize either Ethernet or USB to exfiltrate the data. Does this seem reasonable? What am I missing?
 
10Msps * 12 bits would be 15 MB/s, and 16 bits would be 20 MB/s. That is near the limit of SD, but you might get there. As Paul said, you would need a large buffer in RAM to hold data for the 40 ms or so that SD can be busy. My rule of thumb is to size the buffer for 50 ms, which would be 1 MB @ 20 MB/s, but you might need more, say 2 MB. I've been successful in writing to SD at 12 MB/s with buffer in PSRAM, but if I try to go higher the PSRAM becomes a bottleneck. If that's correct, you can look into a custom board with fast RAM per the work done by @Dogbone06 and others.
 
You might gain a bit by increasing the PSRAM clock speed. It defaults to only 88 MHz, mostly as a very conservative speed in case a slower flash chip is soldered to the other pads. If you have just a single PSRAM chip, 132 MHz should be fine.

But yeah, I would agree this is likely pushing the limits. SD card is a 4 bit bus that clocks at 50 MHz. With careful design and a good quality SD card you probably have a good chance of getting it to work.
 
Can you recommend a compression algorithm they could use on the fly, do the data rate to SD is actually reduced?
I've used miniLZO in the past (not on teensy), but it uses GPL.
LZ4 is another more recent one (BSD license if i'm correct). LZ4 is used with ZFS.

Edit: For production LZ4 would be my favorite, but miniLZO is maybe easier to start?
 
Last edited:
A quick Google search yields information about LZ4 and Snappy. Perhaps those might work.
 
Back
Top