DDR Memory Mod

NOTE: The Polish version of this article is also available.

Neccesity is the mother of all invention. :P

Introduction

Some time ago I was building a new computer to replace my old PIII/500MHz. I had very little money to spare, so I decided to recycle a half-broken 512MB DDR module my friend gave me. However, the module had some 'bad sectors'. I ran memtest86 and found out that most of them lie in 280-310MB range, meaning one of the memory chips probably had a damaged output buffer. I could use the mem=256M kernel parameter or I could alternatively modify the memory to be seen as 256MB.

Preparations and research

With DDR modules, all size, addressing and timing information is stored in a small serial memory called SPD EEPROM:

spd eeprom closeup

So basically, what needs to be done is reprogramming this memory chip. You can see list of all those parameters here (downloaded from this website).

Reprogramming

I used the i2c-nforce2 and eeprom kernel modules to read the SPD EEPROM content. It was then decoded using decode-dimms.pl Perl script from lm_sensors package. I edited the binary dump with hexeditor and flashed it back using the i2c-parport adapter (unfortunately, i2c bus master embedded on my mainboard doesn't permit writing to SPD EEPROMs). Here are the differences between the original and modified dump:

--- dimm.html 2005-11-02 23:48:30.000000000 +0100
+++ modified.html 2005-11-04 01:21:28.000000000 +0100
@@ -17,7 +17,7 @@
-<tr><td valign=top>Number of Module Rows</td><td>2</td></tr>
+<tr><td valign=top>Number of Module Rows</td><td>1</td></tr>
@@ -68,7 +68,7 @@
-<tr><td valign=top>EEPROM Checksum of bytes 0-62</td><td>OK (0x90)</td></tr>
+<tr><td valign=top>EEPROM Checksum of bytes 0-62</td><td>OK (0x8F)</td></tr>

You can also see the entire decodes (original and modified).

Testing

I was a bit afraid to insert the modified memory into my new shiny mainboard, but it worked flawlessly. BIOS saw 256MB of RAM, I ran memtest86 for a couple of minutes, Linux LiveCD and Windows were working without any problems. And I just saved $30. :]

I have also tried this module on another mainboard - it saw 512MB. However, I'm not planning to use this module with it, so it's not a big deal.

Disclaimer

Writing incorrect values to the SPD EEPROM will brick the memory module. Be sure to have a backup (it's just 256 bytes) in case you screw something up.