thumb mramHands up any of you that have heard of MRAM?  That's "Magneto-Resistive Random Access Memory", by the way.

MRAM is set to blow the socks off the microcontroller world, or my name's not Felicity Kendall.  Until recently I didn't even know they were actually commercially making this stuff yet, but it turns out they are.

But, what is Magneto-watsit thingummyjig?  Simply put, it's RAM that uses a magical combination of magnetism and resistance to store data.  Now, I'm not going to even pretend to know how it works, so here's my friend Wikipedia to explain it:


Unlike conventional RAM chip technologies, in MRAM data is not stored as electric charge or current flows, but by magnetic storage elements. The elements are formed from two ferromagnetic plates, each of which can hold a magnetic field, separated by a thin insulating layer. One of the two plates is a permanent magnet set to a particular polarity, the other's field can be changed to match that of an external field to store memory. This configuration is known as a spin valve and is the simplest structure for a MRAM bit. A memory device is built from a grid of such "cells".

The simplest method of reading is accomplished by measuring the electrical resistance of the cell. A particular cell is (typically) selected by powering an associated transistor that switches current from a supply line through the cell to ground. Due to the magnetic tunnel effect, the electrical resistance of the cell changes due to the orientation of the fields in the two plates. By measuring the resulting current, the resistance inside any particular cell can be determined, and from this the polarity of the writable plate. Typically if the two plates have the same polarity this is considered to mean "1", while if the two plates are of opposite polarity the resistance will be higher and this means "0".

So there it is.  Now... Why am I telling you all this?  Well, yesterday I took delivery of some MRAM samples from a company called Everspin.  SPI MRAM chips, in an 8-pin DFN configuration (yes, a bit of a pain for the hobbyist, but it gave me an excuse to experiment with the UV cure solder resist paint I got from China the other day) with a massive 4 mibibits x 8 bits (512KiB) is pretty impressive.  I have no idea how much these things cost.  They don't list prices on the Everspin site, and Farnell don't have any prices for the Everspin products.  They sell a single MRAM by Freescale, at 308 bits for about £20, so I dread to think what these 4 mibibit ones retail at.

Still, I have some, and I am overjoyed at them.thumb mramSPI MRAM chips, 8-pin DFN pacakges

They can supposedly run at up to 40Mbps, but I haven't managed to get anything better than 20Mbps out of them, but that's probably down to my shoddy wiring.  I have put 4 of them together on to a board and linked them up to my RetroBSD system for testing.  And, I must say, it was surprisingly simple to get them going.  The SPI protocol is really simple, and because they are RAM, and not EEPROM, there is no silly block erase or anything like that to worry about.

And, they're non-volatile.  Yes, a RAM chip that's non-volatile.  And I don't mean a RAM chip with a battery.  These are naturally non-volatile, with data retention > 20 years.  And the speed is that of traditional static RAM chips.

And they don't wear out.  There is no maximum lifetime for these bad boys, not like Flash chips, which have a limited number of write cycles.  These just keep going and going and going...

But it's the future I'm most excited about.  Imagine what this technology would mean for the traditional microcontroller market...

Imagine if they took a normal PIC, and replaced all the memory in it with MRAM.  I mean all of the memory - the flash *and* the static RAM.

There would no longer be any distinction between the program space (flash) and the data space.  You would have just one amount of memory, and it would be up to you how you use it.  Big program, small data?  Small program, huge data?  It's your choice. 

And think of the power savings.  At the moment you have the ability to put a microcontroller into a low-power mode.  In that mode it pretty much stops the processor, and provides just enough power to keep the RAM alove.  Or, you can go into deep sleep and stuff the RAM.  It's then up to you to reinitialise all your variables after waking up.  Now, with MRAM, that's not an issue.  Being non-volatile you can remove ALL power from the microcontroller, so it consumes ZERO watts of power.  Then, re-apply power, and it can continue exactly where it left off!

So, MRAM is certainly something to keep an eye on.