Strange memory write problems

Building your first 6502-based project? We'll help you get started here.
adrianhudson
Posts: 169
Joined: 30 Apr 2022
Location: Devon. UK
Contact:

Re: Strange memory write problems

Post by adrianhudson »

pdragon wrote:
I am using WDC65c02 also and went back to check my parts shopping basket (sourced my own in Canada rather than standard kit), and lo and behold my SRAM chip is ... AS6C62256-55PCN.
...

It seems like the ultimate solution here was to replace the SRAM with one from a different manufacturer?
I am parenoid about that AS6C62256-55PCN! Change it for a different manufacturer. I know it's not logical but my board has been running a year now(full time) no crashes. It won't cost much and just might save you hours and hours.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Strange memory write problems

Post by BigDumbDinosaur »

BigEd wrote:
Lots of possibilities, but my first question would be about bypass caps...

Yep!

From what I can see, a bypass capacitor would die of sheer loneliness on that board.  :D  Bypass capacitors in digital work are not an option, even on four-or-more-layer PCBs.  Each active device should have a 0.1 µF MLCC X7R capacitor mounted as physically close to the VCC pin as possible and with the shortest leads possible.  Also, a large, low-ESR electrolytic capacitor on the board near where VCC is applied is a good idea.  Give that a try and see if stability improves.

Lastly, while a CMOS device’s output can drive a TTL device’s input without any issues, the reverse is not true.  In general, you should not use 74LS devices in an otherwise all-CMOS design.  If you must drive a CMOS input from an LS output, use a CMOS device with TTL-compatible inputs, e.g., a 74HCT instead of 74HC.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
pdragon
Posts: 126
Joined: 26 Sep 2023

Re: Strange memory write problems

Post by pdragon »

Thank you, lots of ideas to experiment with. Will report back.
User avatar
BillO
Posts: 1038
Joined: 12 Dec 2008
Location: Canada

Re: Strange memory write problems

Post by BillO »

BigDumbDinosaur wrote:
BigEd wrote:
Lots of possibilities, but my first question would be about bypass caps...

Yep!

From what I can see, a bypass capacitor would die of sheer loneliness on that board.  :D


Well, there is two of them :roll: :mrgreen:
Bill
gfoot
Posts: 871
Joined: 09 Jul 2021

Re: Strange memory write problems

Post by gfoot »

BigDumbDinosaur wrote:
Lastly, while a CMOS device’s output can drive a TTL device’s input without any issues, the reverse is not true.  In general, you should not use 74LS devices in an otherwise all-CMOS design.  If you must drive a CMOS input from an LS output, use a CMOS device with TTL-compatible inputs, e.g., a 74HCT instead of 74HC.
Yes just to plus on this, it sounds like a 74LS157 in the clock module is directly driving - among other things - a 74HC00, and probably also the 65C02 itself, and while it might work a bit, it is out of spec and worth avoiding. You can use a 74HCT00 instead, but the 65C02 also needs consideration, so you really need either a 74HC157 or a 74HCT157 in the clock module.
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Strange memory write problems

Post by BigDumbDinosaur »

BillO wrote:
BigDumbDinosaur wrote:
From what I can see, a bypass capacitor would die of sheer loneliness on that board.  :D
Well, there is two of them :roll: :mrgreen:
Well, those two had better get together and start a family of bypass caps.  :D
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Strange memory write problems

Post by BigDumbDinosaur »

gfoot wrote:
BigDumbDinosaur wrote:
Lastly, while a CMOS device’s output can drive a TTL device’s input without any issues, the reverse is not true.  In general, you should not use 74LS devices in an otherwise all-CMOS design.  If you must drive a CMOS input from an LS output, use a CMOS device with TTL-compatible inputs, e.g., a 74HCT instead of 74HC.
Yes just to plus on this...You can use a 74HCT00 instead, but the 65C02 also needs consideration, so you really need either a 74HC157 or a 74HCT157 in the clock module.
The 65C02 should be driven from a 74AC device in order to satisfy its clock specs.  In particular, Ø2 rise and fall times should not exceed 5ns.  A 74HC device *might* meet that spec, but that’s typically not guaranteed.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
User avatar
Michael
Posts: 633
Joined: 13 Feb 2013
Location: Michigan, USA

Re: Strange memory write problems

Post by Michael »

If you have an Arduino Uno or Nano handy you could use it temporarily as a CPU clock in order to test that part of the circuit. Use one of the timers to generate a 1, 2, 4, or 8-MHz (50% duty cycle) clock as a background task on the Arduino (excerpt below).

Regards...

Code: Select all

 /***************************************************************************
  *  output 4-MHz clock on OC2A (D11/PB3) for sound chip demo'              *
  ***************************************************************************/
  void beginClock()
  { pinMode(11,OUTPUT);             // OC2A (D11/PB3)
 /*                                                                         *
  *  TCCR2A settings for 'normal' or 'CTC' (non-PWM) mode                   *
  *  ------------------------------------------------------------           *
  *  COM2A1:COM2A0 '01' - Toggle OC2A on Compare Match                      *
  *  WGM22:WGM20  '010' - CTC mode (clear timer on compare match)           *
  *                       (WGM22 bit is in TCCR2B register)                 *
  *                                                                         */
    TCCR2A = ((1 << WGM21) | (1 << COM2A0));
    TCCR2B = (1 << CS20);           // prescale = 1:1 (WGM22 = 0)
    TIMSK2 = 0;                     // no interrupts
    OCR2A = 1;                      // match value
  }                                 // 0/1/3/7 => 8/4/2/1 MHz
 /***************************************************************************/
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: Strange memory write problems

Post by plasmo »

I decided to take another look at AS6C62256. I have a barebone 6502 SBC in pc board which should be more reproducible in case of errors. I do have to make small modification to accommodate 32Kx8 RAM. AS6C62256 is rated 55nS, so it should work with 7.37MHz W65C02, but it doesn't! It will fail memory diagnostic intermittently after 100 or so passes (about 30-seconds run), but it will pass diagnostic at 3.68MHz even after 10-minute run . It turns out it is fast enough to run 14.7MHz and will also pass diagnostic after 10-minute run. I have KM62256-10 that passed the same diagnostic at 3.68MHz and 7.37MHz. It is not fast enough to run 14.7MHz.

I've tried several different 128Kx8 RAM and they all passed. Table summarizes the various tests. The outlier is AS6C62256 failed at 7.37MHz but mysteriously passed at 3.68MHz and 14.7MHz. This is quite a mystery!
Bill
memory_diag_summary.jpg
User avatar
drogon
Posts: 1671
Joined: 14 Feb 2018
Location: Scotland
Contact:

Re: Strange memory write problems

Post by drogon »

plasmo wrote:
I decided to take another look at AS6C62256. I have a barebone 6502 SBC in pc board which should be more reproducible in case of errors. I do have to make small modification to accommodate 32Kx8 RAM. AS6C62256 is rated 55nS, so it should work with 7.37MHz W65C02, but it doesn't! It will fail memory diagnostic intermittently after 100 or so passes (about 30-seconds run), but it will pass diagnostic at 3.68MHz even after 10-minute run . It turns out it is fast enough to run 14.7MHz and will also pass diagnostic after 10-minute run. I have KM62256-10 that passed the same diagnostic at 3.68MHz and 7.37MHz. It is not fast enough to run 14.7MHz.

I've tried several different 128Kx8 RAM and they all passed. Table summarizes the various tests. The outlier is AS6C62256 failed at 7.37MHz but mysteriously passed at 3.68MHz and 14.7MHz. This is quite a mystery!
Bill
memory_diag_summary.jpg

Curiously, in my Ruby '816 system I'm using the AS6C4008-55, so 55nS. I was hoping it would be stable at 8Mhz while I soldered up some SMT chips on carriers, but to my surprise it was solid right up to 16Mhz. (and down to 1Mhz too). I've tried 4 different ones of the same type and all have worked perfectly.

There may well be something odd about them, but they're good for me.

-Gordon
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: Strange memory write problems

Post by plasmo »

plasmo wrote:
This is quite a mystery!
OK, I can explain it.

The board was designed for 32-pin 128Kx8 or 64Kx8 RAM, so pin 30 is chip_select_high which is jumper-able to either PHI2 clock for 6502 or ~RESET for Z80 configuration. For 28-pin 32Kx8 AS6C62256 and KM62256, that's a power pin. When modifying the socket to accommodate 62256, I brought power to it through the jumper block which is over 1" of 7mil trace and not bypassed with 0.1uF cap. That is the problem. Once I jumpered with shorter wire and bypass the RAM, it (AS6C62256) passed 20 minutes of memory diagnostic.

The fact remains that AS6C62256 needs more stable power that is properly bypassed. The other 32Kx8 RAM, KM62256, was able to run correctly with previously poorly bypassed power.
Bill
User avatar
BigDumbDinosaur
Posts: 9425
Joined: 28 May 2009
Location: Midwestern USA (JB Pritzker’s dystopia)
Contact:

Re: Strange memory write problems

Post by BigDumbDinosaur »

plasmo wrote:
The fact remains that AS6C62256 needs more stable power that is properly bypassed. The other 32Kx8 RAM, KM62256, was able to run correctly with previously poorly bypassed power.

It sounds as though when the AS6C62256 is selected and it hits the power supply with a large transient.  This is an effect usually seen with EPROMs—I’ve noted it in my POC units.  Perhaps a parallel combination of a 0.1 µF MLCC and a 100 µF, low-ESR electrolytic is needed at the SRAM’s VCC pin.
x86?  We ain't got no x86.  We don't NEED no stinking x86!
pdragon
Posts: 126
Joined: 26 Sep 2023

Re: Strange memory write problems

Post by pdragon »

after a bunch of exploration, more power grid, more caps, not to mention a toll of magic smoke :cry: i've discovered a secret about this unreliable memory!

see if you can spot the difference between the two pictures...

:oops:


:oops:


:oops:


:oops:


:oops:


what do you know, the RAM works more reliably if VCC is actually connected to +5V rather than thin air! I can only imagine how it was working at all before, perhaps stealing power from the addr/data pins?! (fwiw, also works happily with a 1MHz crystal)
Attachments
bootok.jpg
plasmo
Posts: 1273
Joined: 21 Dec 2018
Location: Albuquerque NM USA

Re: Strange memory write problems

Post by plasmo »

Good, I'm glad you have it resolved. AS6C62256 is not to blame, but I do believe it has more stringent power regulation needs.

It is amazing how a CMOS part can work without its power hooked up. I have a Z180 design with completely missing power pin due to a library error. I build several boards, tested and delivered; never even realized Z180's power pin is not hooked up. I talked to the user years later, he never had problems; CP/M ran just fine, he took it to several shows; worked great!!
Bill
barnacle
Posts: 1831
Joined: 19 Jan 2004
Location: Potsdam, DE
Contact:

Re: Strange memory write problems

Post by barnacle »

This is to be expected with CMOS parts because of the default diode from all inputs to the substrate. It's one you don't think of, but if the input can supply enough power (think a 4mA output connected to an 'unpowered' input on a chip that needs a handful of microamps) then the part will cheerfully operate. The Vcc will be ~0.6v low, but CMOS often doesn't care about that, though a 3v3 system might be fussier than a 5v system, and of course once on chip is powered, they all are...

It's often the case that a serial input (idling high) will power an entire processor even though it thinks it's turned off; at the very least it will interfere with power-on-reset on the chip. Particularly when you're designing the system to use only a few microamps most of the time, a serial connection for e.g. debugging can ruin your whole day.

Neil
Post Reply