C64 DRAM testing with an ATmega8U2

Josh (aka Axlecrusher) was working on restoring an old Commodore 64. The stalwart computer was missing a few obvious pieces, prompting Josh to make a new AV cable and obtain a new power supply, all while replacing the PLA, VIC and capacitors. However, the C64 still didn’t boot properly, so Josh decided to test the Commodore 64’s DRAM chips.

Photo Credit: WIkipedia

“My particular C64 uses 8 individual RAM chips most are D4164C-15 and a couple are D4164C-2. I replaced all the RAM but I wanted to know if both the original and replacement chips were functioning properly. I decided to test each chip, I needed some hardware to test with,” Axlecrusher explained in a blog post.

“I decided to use [Atmel’s] ATmega8U2 AVR microprocessor (MCU), because I have one that can plug into a breadboard and it has enough pins to drive the D4164C chips. I wired the test setup to try to reduce the instruction count where I could so it is a little messy. Wiring and instruction count could be greatly improved if I didn’t need the programming header, but it gets the job done.”

According to Axlecrusher, the first task was simply trying to write and read just one bit, with the datasheet for the DRAM provided timing windows charts for each required step. After a few hours of stepping through the charts, coding, re-coding, reviewing the charts, and sometimes just trial and error, Axlecrusher was finally able to write and read 1 bit from memory.

“After a couple more days of work I was reading and writing to the entire memory module. I constructed a couple of routines to test both the wiring and the memory. To test the wires I wrote 0 to the first bit of the memory followed by a 1 to a power of 2 memory location (high on just 1 wire). I then read memory location zero and if the value is no longer 0, it indicates a failure on a specific address wire,” he continued.

“I used a walking one algorithm with a bit inversion to test all the memory cells. The goal is to toggle as many bits as possible. In either case if there’s an error, the red LED would turn off forever. While the test is running, the LED will blink at the end of each complete cycle. I was able to test all the memory modules I had replaced. They were all functioning properly.”

Interested in learning more about C64 DRAM testing with Atmel’s ATmega8U2? You can check out Axlecrusher’s original blog post here and the source code on GitHub.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s