6502 not asserting R/W for long enough
6502 not asserting R/W for long enough
Hi everyone!
So, it's been a while since I looked at my 6502 project. I got distracted by cycling, but recently I dug everything out, simplified my requirements and tried to produce something simple but complete.
I have a 6502, an SRAM, an EEPROM and R65C52 dual ACIA, hooked up to an FTDI breakout board.
I can successfully write to my serial port, but the majority of what is written is garbage. In fact, it's 0xFF.
Looking with the logic probe, I can see that for the majority of write cycles, the R/W line (wired directly from the 6502 to both the SRAM /WE pin and ACIA R/W pin) is only asserted for the first part of the cycle (PHI2 low). My chip select lines only go low when PHI2 rises, and when it does, 70 or 80% of the time, R/W goes high with it, as do all of the data lines, which held the correct value to be written during the first half of the cycle. This happens when writing to either RAM or the ACIA, though it seems to be worse with the ACIA.
I realise a more detailed schematic will probably be required for full diagnosis, but I need to go back over it and check it against the reality of what I have soldered down before it's worth sharing, so I thought I'd describe the symptoms in case there are any avenues of investigation which can be suggested from that alone.
Any hints appreciated!
Mike
So, it's been a while since I looked at my 6502 project. I got distracted by cycling, but recently I dug everything out, simplified my requirements and tried to produce something simple but complete.
I have a 6502, an SRAM, an EEPROM and R65C52 dual ACIA, hooked up to an FTDI breakout board.
I can successfully write to my serial port, but the majority of what is written is garbage. In fact, it's 0xFF.
Looking with the logic probe, I can see that for the majority of write cycles, the R/W line (wired directly from the 6502 to both the SRAM /WE pin and ACIA R/W pin) is only asserted for the first part of the cycle (PHI2 low). My chip select lines only go low when PHI2 rises, and when it does, 70 or 80% of the time, R/W goes high with it, as do all of the data lines, which held the correct value to be written during the first half of the cycle. This happens when writing to either RAM or the ACIA, though it seems to be worse with the ACIA.
I realise a more detailed schematic will probably be required for full diagnosis, but I need to go back over it and check it against the reality of what I have soldered down before it's worth sharing, so I thought I'd describe the symptoms in case there are any avenues of investigation which can be suggested from that alone.
Any hints appreciated!
Mike
Re: 6502 not asserting R/W for long enough
R/W is a signal I usually write as RnW, and should go low to cause a write. To avoid writing to the wrong location, when the address lines and chip selects might still be holding the previous cycle's value, or be changing, it's normal to arrange the glue logic so that RnW can only go low when Phi2 is high.
Does it seem that your design is instead allowing RnW to go low only when Phi2 is low? That would be unexpected, and probably wrong.
Does it seem that your design is instead allowing RnW to go low only when Phi2 is low? That would be unexpected, and probably wrong.
Re: 6502 not asserting R/W for long enough
mdpye wrote:
Looking with the logic probe, I can see that for the majority of write cycles, the R/W line [...] is only asserted for the first part of the cycle (PHI2 low).
Quote:
I realise a more detailed schematic will probably be required for full diagnosis, but I need to go back over it and check it against the reality of what I have soldered down before it's worth sharing
-- Jeff
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
- GARTHWILSON
- Forum Moderator
- Posts: 8775
- Joined: 30 Aug 2002
- Location: Southern California
- Contact:
Re: 6502 not asserting R/W for long enough
Dr Jefyll wrote:
A 6502 has a *minimum* operating frequency that's in the kilohertz range -- IOW, much to fast to be perceived by a human being watching the LED on a Logic Probe. Yet, you're using a Logic Probe for fractional-cycle observations?? Something doesn't add up. Just how slowly are you running the 6502?
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?
Re: 6502 not asserting R/W for long enough
mdpye wrote:
R/W line (wired directly from the 6502 to both the SRAM /WE pin and ACIA R/W pin) is only asserted for the first part of the cycle (PHI2 low). My chip select lines only go low when PHI2 rises, and when it does, 70 or 80% of the time, R/W goes high with it, as do all of the data lines
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: 6502 not asserting R/W for long enough
My apologies, I meant logic *analyser*. System clock is 2MHz, analyzer is sampling at 16, and has 16 channels showing me most of the control lines and all of the data bus at once.
To big ed: that's exactly what I am doing with my select lines, but R/W is wired directly to the relevant pins on the ram and io chips.
I'll follow up with a schematic tomorrow, but it is very close to one which was vetted here in a similar thread.
To big ed: that's exactly what I am doing with my select lines, but R/W is wired directly to the relevant pins on the ram and io chips.
I'll follow up with a schematic tomorrow, but it is very close to one which was vetted here in a similar thread.
Re: 6502 not asserting R/W for long enough
Dr Jefyll wrote:
It's extremely weird for R/W to change state midway through the cycle. It's as if the CPU had been reset. Maybe /RES goes low and/or the VCC supply experiences a brownout at this point -- as it may do when bus contention arises, or when the output of a logic gate (a decoder, perhaps?) tries to drive low into a line that is shorted high (or tries to drive high into a line that is shorted low). Can you monitor VCC with an oscilloscope?
Re: 6502 not asserting R/W for long enough
I got it under the scope. The signals look quite a lot cleaner than I was expecting. The clock looks great to me, and the ripples visible give me confidence in the fidelity of the scope, which, like I say, is pretty beaten.
The failure of R/W is clearly visible as it is pulled back towards 5V part way through a cycle.
Vcc looks pretty stable. Examining it at 10x X-axis zoom, and 50x Y-axis (relative to the other photos), I was able to look back and forth across the whole 10x magnified time range and the photo is of the portion showing the most variation. But at 50x zoom, it's showing a fluctuation of 100 to 150mV. Does that seems plausible to trigger brown-out?
I haven't had chance to do the schematic tonight. I'm semi-asking, semi-blogging my investigation here to get pointers, but also to help organise my thoughts. Thanks for listening.
Mike
The failure of R/W is clearly visible as it is pulled back towards 5V part way through a cycle.
Vcc looks pretty stable. Examining it at 10x X-axis zoom, and 50x Y-axis (relative to the other photos), I was able to look back and forth across the whole 10x magnified time range and the photo is of the portion showing the most variation. But at 50x zoom, it's showing a fluctuation of 100 to 150mV. Does that seems plausible to trigger brown-out?
I haven't had chance to do the schematic tonight. I'm semi-asking, semi-blogging my investigation here to get pointers, but also to help organise my thoughts. Thanks for listening.
Mike
Re: 6502 not asserting R/W for long enough
The strange glitches on RWB looks as if there is a capacitive coupling from somewhere. Do you have a capmeter that can measure down to 100 pF? If, I would turn off power and measure RWB against any other signal. There ought to be no capacitive load anywhere but you may find an exception. Perhaps an ill placed blocking C.
Re: 6502 not asserting R/W for long enough
mdpye wrote:
The signals look quite a lot cleaner than I was expecting.
Quote:
The failure of R/W is clearly visible as it is pulled back towards 5V part way through a cycle.
I suggest you use the scope to examine the waveforms on the Gnd and +5 pins of all your IC's -- be sure to probe the pin itself. This is to rule out the possibility of a poor connection from the IC pin to the Gn / +5 rails of the breadboard.
Along with a schematic, it might be helpful to see a recent photo of your project.
Cheers!
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: 6502 not asserting R/W for long enough
Dr Jefyll wrote:
mdpye wrote:
The signals look quite a lot cleaner than I was expecting.
Quote:
The failure of R/W is clearly visible as it is pulled back towards 5V part way through a cycle.
I suggest you use the scope to examine the waveforms on the Gnd and +5 pins of all your IC's -- be sure to probe the pin itself. This is to rule out the possibility of a poor connection from the IC pin to the Gn / +5 rails of the breadboard.
Along with a schematic, it might be helpful to see a recent photo of your project.
Cheers!
Although, I will say even a 5MHz scope is better than none ... but a dual trace 5MHz scope is more than 100% better.
We really need a schematic. It will add immeasurably to our understanding of what you are trying to do. Also, maybe a (well focused) picture of your prototype.
(Edit: I just noticed I pretty much repeated everything Jeff said. Rather than claiming a 'senior moment' I will just say his points were worth repeating...)
Bill
Re: 6502 not asserting R/W for long enough
Cool, I'll get on to those measurements.
The scope is 20Mhz, dual channel. Saying a dual channel is more than 2x better. Do you mean in general utility, or could I put the second channel to good use in this context? It also has an external trigger
Thanks,
Mike
The scope is 20Mhz, dual channel. Saying a dual channel is more than 2x better. Do you mean in general utility, or could I put the second channel to good use in this context? It also has an external trigger
Thanks,
Mike
Re: 6502 not asserting R/W for long enough
mdpye wrote:
Cool, I'll get on to those measurements.
The scope is 20Mhz, dual channel. Saying a dual channel is more than 2x better. Do you mean in general utility, or could I put the second channel to good use in this context? It also has an external trigger
Thanks,
Mike
The scope is 20Mhz, dual channel. Saying a dual channel is more than 2x better. Do you mean in general utility, or could I put the second channel to good use in this context? It also has an external trigger
Thanks,
Mike
Also, if you needed to see the relationship between 2 signals, such as R/W and a chip select, you could scope them against each other. You could also feed Phi 2 into the external trigger and see how those 2 signals line up with Phi2.
2 channels are very handy - use 'em if you have 'em.
20 MHz is a bit slow to see all gremlins, but if your clocking at 2MHz, then you might not be producing many of them. A schematic and a picture of the prototype will be helpful. Are you using any 74AC or 74ACT logic? They produce fast leading edge signals which can create glitches a 20MHz scope will not find.
Bill
Re: 6502 not asserting R/W for long enough
Yes, it can be hugely helpful to see the relationship between 2 signals. I was going to mention this, but Bill beat me to it.
And, as noted, by using the external trigger input you can even evaluate the relation between *three* signals.
20 MHz is indeed rather slow if you're observing fast logic families such as 74AC and 74ACT logic... or modern WDC cpu's. Like AC devices, they produce very abrupt output swings, and also they can respond to extremely brief input glitches.
20 MHz is indeed rather slow if you're observing fast logic families such as 74AC and 74ACT logic... or modern WDC cpu's. Like AC devices, they produce very abrupt output swings, and also they can respond to extremely brief input glitches.
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html
https://laughtonelectronics.com/Arcana/ ... mmary.html
Re: 6502 not asserting R/W for long enough
That RnW waveform is very odd indeed. It almost looks like there are two drivers fighting each other: RnW twice is driven positive, but not to the rail.
So, you need to review your design, and your implementation. Something isn't right.
So, you need to review your design, and your implementation. Something isn't right.