Did you ever think the 512 byte RAM on the At90S8515 was a bit too small ?
Ever dreamed about having kiloBytes or perhaps even Megabytes of memory ?
Dream no more….. Here’s how to get it.
A discussion recently on the mp3projects discussion board, about using DRAM memory with small 8-bit processors without DRAM controllers, got me to take up an old idea.
I thought it should be possible to hook up a DRAM to a small processor (in this case an Atmel 8515), and handle the RAS/CAS sequencing and refresh in software.
As DRAM is MUCH cheaper than SRAM, it would be possible to get a large (>500kB) memory at a reasonable price.
There would obviously be a speed penalty, but in some cases, this would be of no importance.
So, I set out to try.
I had a bunch of Hitatchi M5M44800 DRAM’s which I got dirt cheap, so I decided to give it a go with one of them. This is a 512k*8 DRAM.
It uses a 1024 cycle refresh (each 16 mS), and allows CAS-before-RAS refresh.
The refresh is handled by a periodic interrupt on Timer1. The count is set to -125 and with a prescaler value of fClk/1024 (8 MHz CPU), this gives an interrupt every 16 mS. On each interrupt, a loop is executed 1024 times, each iteration doing a CAS-before-RAS access. The loop takes total about 1.6 mS, to execute.
This means it’s eating up about 10% of the CPU time. Could be worse ;-).
And it does get a bit worse, when it comes to the RD/WR times.
Due to all the bit flipping that has to be done on each access, a read of a memory location takes about 3.6 uS, and a write takes 3 uS.
So that means it’s possible to read and write to memory with about 300 kB/sec.
Considering that there’s access to 512kB of memory using a linear access scheme, this isn’t THAT bad.
And it’s non-optimized code in C.
A standard 8051 clocked at 12 MHz, uses 24 clocks (2uS) just to do a MOVX instruction !
The power consumption isn’t big. The chip takes about 2-3 mA when just refreshing and with a low access rate.
Well, to conclude this….. It’s possible to use DRAM with the AVR. It will be relatively slow and put some extra load on the CPU, but if you need a cheap, large RAM memory and can accept the overhead, this is the way to go.