Thursday, June 25, 2020

EYE on NPI – Renesas MRAM #EyeOnNPI #Renesas #DigiKey #Adafruit @digikey @Adafruit @RenesasGlobal

This week’s EYE on NPI takes a look at a new kind of memory called MRAM – and some fresh new QSPI memory chips from Renesas that let you try out MRAM for your embedded projects! Memory and memory management is one of the trickiest challenges for an engineer, when it comes time to optimize power, speed and performance because you bump up against many of the restrictions different types of memory have – and the reason there’s so many types of memory is cause there’s no one perfect type of memory storage.

Just about every microcontroller has two kinds of storage – flash storage and RAM storage. RAM storage is just like the kind you have in your computer – except a few KB usually, instead of GB. RAM storage is pretty expensive, which is why a microcontroller that is only a few bucks has only a few KB. BUT RAM is really fast – you can read and write to any section of RAM within one or two instructions. That makes it great for rapid data capture, analysis and scratch-pad workspace. There’s one down-side to this speed – when the microcontroller is reset, or power is lost, the RAM is also lost.

For that reason, your microcontroller has the other kind of memory – flash – to store the program itself. Otherwise, your program would just disappear when you unplugged it (not good!). Flash memory is pretty inexpensive, so you usually get much more flash than RAM. (Before flash memory, we had microcontrollers that had crystal windows and you could erase the chip with a desktop UV eraser – a process that would take a few minutes, so you either had a lot of chips you’d cycle through the eraser, or you’d just have to think really, really hard before writing lines of your code, because it would take 3 minutes until you could fix any bug you introduced!) Once in a while you also get microcontrollers that have a separate flash memory area, often referred to as EEPROM. Usually this is used for storing configurations, calibrations, identifiers, etc.

So normally, you’ve got non-volatile flash storage for code, volatile RAM storage for running the code, and maybe a smidge of EEPROM. Say you want to build a sensor data logger – you can’t store the data in RAM, because you’ll lose it when power is lost. You can’t safely stick it in flash because that’s where your code lives, and EEPROM is way too small. No problem, you can buy external non-volatile flash memory for microcontrollers! Again, for small amounts of storage, say less than 64K you can get low cost I2C EEPROM.

For your sensor datalogger you want more storage – more like a megabyte – so you can data log for a few hours. So you add some external flash memory to your board! You can do this in two ways, one is to connect a SD card or micro SD card, using SDIO or SPI, to your microcontroller. SD cards have flash memory and a little controller inside them, but they’re still essentially non-volatile flash in a removable package and they come in sizes from 2 MB to larger than 128 MB!

The other option is to add a (Q)SPI flash chip – these are usually only up to maybe 16 MB of storage, and they are not removable. In fact we use these often on our CircuitPython boards to add a small 2 or 8 megabyte disk drive to store code and assets. These flash chips are fairly inexpensive and can handle 100,000 erase/write cycles.

There’s one big downside tho – while these SPI flash chips have great non-volatility, they have an annoying problem that when you want to change data in a block you have to erase that whole block first, then write the new changed data – and a block is 4KB to 16KB! And erasing takes at least a few milliseconds, if not longer. Same with SD cards by the way, the erase time is fairly long, so when you want to write new data to a card, it can hang out for 250ms until its complete. There’s some ways to work around this, by buffering a block’s worth before writing – but you risk losing data. And if you have a filesystem like FAT on the flash or card, you also have to update the FAT table every time a file changes size. Basically, SD or SPI flash are great for reading and super slow and yucky for writing – especially when you need to write often, quickly or in large bursts.

THUS, this week’s EYE on NPI is interesting to us because it introduces a new kind of memory we’ve never used before – MRAM for magnetic random access memory. Where as flash memory stores memory by saving a bit by storing charge on a MOSFET gate, MRAM stores it on a ferromagnetic particle that can changed from N to S polarity to store 1 or 0.

The core of Avalanche’s STT-MRAM cell is a proprietary perpendicular magnetic tunnel junction (p-MTJ) element which includes including a magnetic fixed layer, a dielectric barrier layer and a changeable ferromagnetic storage layer. The magnetic orientation of the fixed layer is fixed during the manufacturing process. During a programming operation, the magnetic orientation of the storage layer is electrically switched from a parallel state (low resistance state “0”) to an antiparallel state (high resistance state “1”), or vice versa, depending on the current direction through the p-MTJ element. Two distinct resistance states can thus be realized for data storage and sensing. The structure of the p-MTJ element can be tailored for different performance specs and application needs.

What’s nice is that every bit/byte can be written or read at any time, no block erases, no delays! You can drive these chips with SPI or QSPI at 100+MHz and down to 1.8V. These chips will be more expensive than NV SRAM or FLASH, but when you need fast writes and reads without waits, these are a great option. Another nice bonus with MRAM is that it is naturally less susceptible to radiation bit-flips – something that folks working on cubesats are super experienced with as a bane of their existence – you send a microcontroller into LEO and the flash memory gets corrupted by high energy particles. While this part is not specifically rad-hard or space-ready, for DIY experimentation, its way way less expensive than official aerospace devices – as seen in the PyCubed dev board.

These chips are pin-compatible with most other SPI flash you may have designed in, so it’s easy to try out MRAM! Check out the chips on Digi-Key available in 8-SOIC package for easy prototyping!

https://www.digikey.com/products/en?keywords=800-M30082040054X0IWAY-ND%20

See a manufacturer video of these products here.

 

No comments:

Post a Comment