DRAMARDUINO - Dram tester with Arduino

This is the right place to discuss on how to implement hardware vsync, adding a VIA or AY chipset, puting multiple roms, or how to design a new flash expansion card.
Stan
Private
Posts: 4
Joined: Fri Oct 21, 2022 8:02 am

Re: DRAMARDUINO - Dram tester with Arduino

Post by Stan »

Hi,
I've purchased a vintage DRAM tester from eBay recently, and while I was waiting, I decided to buy an Arduino and try making some basic tester.
Here is how I came across this forum thread.
I had some free time, made some 'google research', and made some software updates over the iss's ino code that I would like to share with you.
Major updates:
- fillx() accepts custom 8-bit test patterns
- first fills the entire DRAM with the test pattern, then reads back and verifies (readx() func) in a second pass
- stops after MAX_ERRORS count of errors, not after first error
- added Auto-find 4164/41256. The jumper is no longer required, but if closed, will force a 4164 test. This is not the best auto-find solution though, as it writes/reads only one bit.
- readAddress and writeAddress routines rewritten for direct port manipulation - significant speed increase

Other updates that I have on my mind would require hardware changes (such as 4116 12V -5V DRAM support)

It was real fun to see how the Arduino tester catches single-bit errors while the 50-euro ebay tester didn't:
Screenshot bad ram.png
Attachments
dramarduino_new.zip
(2.43 KiB) Downloaded 335 times
User avatar
iss
Wing Commander
Posts: 1625
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: DRAMARDUINO - Dram tester with Arduino

Post by iss »

@Stan: Cool! I like the pattern test, 64/256 detection and MAX_ERRORS improvements.
Not sure about new 'blink' mode (IMO the speed-up comes mainly because no in-test blinking).
I'll test asap and make the changes 'official' :wink:
Stan
Private
Posts: 4
Joined: Fri Oct 21, 2022 8:02 am

Re: DRAMARDUINO - Dram tester with Arduino

Post by Stan »

I also do not like the blinking :D I'm leaving it you or anybody who has something in mind about it.

>>>(IMO the speed-up comes mainly because no in-test blinking).
Not only. Looks like every arduino's digitalWrite(); digitalRead(); does a bunch of operations that can last several microseconds and we have a lot of them for every DRAM read or write.
https://roboticsbackend.com/arduino-fast-digitalwrite/

Whereas a direct read from a port even needs a delay because DRAM is not so fast:

/* column */
setBus(c);
PORTB &= ~(1 << PORTB_CAS);

/* bit read value */
__asm__("nop\n\t"); //62.5ns
__asm__("nop\n\t"); //62.5ns
__asm__("nop\n\t"); //62.5ns
__asm__("nop\n\t"); //62.5ns
ret = PINB & (1 << PINB_DO);
User avatar
iss
Wing Commander
Posts: 1625
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: DRAMARDUINO - Dram tester with Arduino

Post by iss »

Stan wrote: Wed Oct 26, 2022 8:30 am... arduino's digitalWrite(); digitalRead();
Yes, this is well known and direct port I/O is the way, which I made already in assembler... :wink:
Stan
Private
Posts: 4
Joined: Fri Oct 21, 2022 8:02 am

Re: DRAMARDUINO - Dram tester with Arduino

Post by Stan »

Good. Just saying that skipping the LED blinks is not the real reason for the speed up.
Stan
Private
Posts: 4
Joined: Fri Oct 21, 2022 8:02 am

Re: DRAMARDUINO - Dram tester with Arduino

Post by Stan »

Hi all,
The sketch I've uploaded has a bug or a feature depending on what one expects.
As you already know, DRAMs need their content to be refreshed within some time period.
In 4164/41256 this is done by just toggling every row once in the specified period which is ~4 microseconds.

Look at this code:

Code: Select all

 for (r = 0; r < max_r; r++) {
    for (c = 0; c < max_c; c++) {
      writeAddress(r, c, v);
      if (readAddress(r, c) != v)
        if (error(r, c))
          return;
    }
Because rows are advancing in the outer loop, a row is accessed only after max_r x max_c times.
This is a way too slow - tens and hundreds times slower than the spec depending on memory size - 64 or 256.
Nevertheless, most of DRAMs I've tested pass the tests. Only a few fail with a screenshot similar to one I've posted.

In short:
IF: <you want a very slow refresh test> THEN: <leave code as is>
ELSE IF: <you want normal refresh test> THEN: <switch places of r and c variables as shown below>

Code: Select all

 for (c = 0; c < max_c; c++) {
    for (r = 0; r < max_r; r++) {
      writeAddress(r, c, v);
      if (readAddress(r, c) != v)
        if (error(r, c))
          return;
    }
Similar loops can be found in the following functions:
void fill(byte v)
void fillx(byte pattern)
void readx(byte pattern)
User avatar
iss
Wing Commander
Posts: 1625
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: DRAMARDUINO - Dram tester with Arduino

Post by iss »

Nice research, thanks ;).
daveyk021
Private
Posts: 1
Joined: Sat May 13, 2023 5:20 pm

Re: DRAMARDUINO - Dram tester with Arduino

Post by daveyk021 »

It does seem to sort bad from good, but 100% ??

I question this because I can ground any of the address lines and the chip still passes test? Is not a common failure mode to load a address line down? Of course maybe the chip is hot when it does that, I dunno.

On A7, I have grounded this address line and also tied it high and it still passes the test.

I know the program doesn't monitor the address line, but if A7 is pulled low, when it tried to store the 0/1s is the high end of the ram, why does the test not fail? Okay the program thinks it is storing in high end but it is still being stored just somewhat lower when an address line is pulled low. The program would have no way to know that is happening.

Maye that is not a realistic failure mode for the chip? I do know that if A7 is left floating, the test fails pretty quick.
User avatar
iss
Wing Commander
Posts: 1625
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: DRAMARDUINO - Dram tester with Arduino

Post by iss »

daveyk021 wrote: Sun May 14, 2023 11:24 pm... Maybe that is not a realistic failure mode for the chip?
All tests check if the written data is the same as the read. Hacking the address lines (simulating shorten input A0..A7) simply change the actual tested cell in the memory array, so the test can pass. I think it's possible to make an improvement here without any hardware changes ... hm, will see. Thanks for the interest and your research ;).
erik
Private
Posts: 2
Joined: Tue Jul 04, 2023 10:24 pm

Re: DRAMARDUINO - Dram tester with Arduino

Post by erik »

Hi,
I had a few of these boards made: https://github.com/Tishima/myDRAMTester and was using the code provided (which is Stan's code posted here) - I wanted to add an LCD so I put this on a Mega 2560 and it doesn't work there, fails on known-good DRAM in a repeatable way. So I started looking at the code and noticed this:

Code: Select all

#define PORTC_DI        1  // PC1
#define PINB_DO         0  // PB0
#define PORTB_CAS       1  // PB1
#define PORTC_RAS       3  // PC3
#define PORTC_WE        2  // PC2

#define PORTC_XA0       4  // PC4
#define PORTD_XA1       2  // PD2
#define PORTC_XA2       5  // PC5
#define PORTD_XA3       6  // PD6
#define PORTD_XA4       5  // PD5
#define PORTD_XA5       4  // PD4
#define PORTD_XA6       7  // PD7
#define PORTD_XA7       3  // PD3
#define PORTC_XA8       0  // PC0
These pins don't match the comments, pin 1 on the Uno isn't PB1/PC1, but more importantly some are overlapping. It's possible I'm misunderstanding something, but I don't think this can work? A0 and A5 are the same pin for example. Can anyone shed some light on this?
User avatar
iss
Wing Commander
Posts: 1625
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: DRAMARDUINO - Dram tester with Arduino

Post by iss »

erik wrote: Wed Jul 05, 2023 4:26 pmCan anyone shed some light on this?
Hi @erik, welcome here!

Arduino UNO and MEGA are obvious different. I can suggest to try first with my DRAMARDUINO code - it's proven to work and all pins are exactly as in comments. Then you can read carefully the UNO and MEGA PDF's and remap used pins as needed.
erik
Private
Posts: 2
Joined: Tue Jul 04, 2023 10:24 pm

Re: DRAMARDUINO - Dram tester with Arduino

Post by erik »

iss wrote: Wed Jul 05, 2023 4:43 pm
erik wrote: Wed Jul 05, 2023 4:26 pmCan anyone shed some light on this?
Hi @erik, welcome here!

Arduino UNO and MEGA are obvious different. I can suggest to try first with my DRAMARDUINO code - it's proven to work and all pins are exactly as in comments. Then you can read carefully the UNO and MEGA PDF's and remap used pins as needed.
I am familiar with both platforms and have made the (non PORT manipulating) code work on both, I should have mentioned that. My interest is in looking at the pin defs for Stan's code. Initially I set out to remap it for the Mega but noticed the overlapping pins. I don't see how it could fully address the DRAM with address lines tied together. I don't think it works, even on the Uno as intended. It will pass good ram, and maybe some bad ram.

But maybe I'm missing something, that's what I'm wondering about.
Profke
Private
Posts: 2
Joined: Thu Aug 24, 2023 5:40 am

Re: DRAMARDUINO - Dram tester with Arduino

Post by Profke »

I am very satisfied with the design, it works very well with the 41256, but I have a lot of HM50256 and MB81256 lying around, new and used rams. I want to be able to test these with that DRAMARDUINO, but I can't manage to modify the code. I have tried it myself using the datasheets, but I am at a dead end. Can someone help me, please? Thanks.
User avatar
iss
Wing Commander
Posts: 1625
Joined: Sat Apr 03, 2010 5:43 pm
Location: Bulgaria
Contact:

Re: DRAMARDUINO - Dram tester with Arduino

Post by iss »

Profke wrote: Thu Aug 24, 2023 7:23 amI want to be able to test these with that DRAMARDUINO....
Looking at datasheets 41256, HM50256 and MB81256 are the same!
ram256.png
What changes you think need to be done?
Profke
Private
Posts: 2
Joined: Thu Aug 24, 2023 5:40 am

Re: DRAMARDUINO - Dram tester with Arduino

Post by Profke »

I thought that was the same too, but DRAMARDUINO doesn't work with those rams.
Post Reply