Page 2 of 3

Re: Ok, I've got a really odd issue

Posted: Tue Apr 29, 2025 6:37 pm
by jmthompson
BigDumbDinosaur wrote:
Neither clock signal looks good.  The clock without the damping resistors looks horrid, to be frank, which means the resistors were actually helping.  Something is definitely not kosher; I think you have an abnormal loading problem somewhere, judging by the way the rise and fall noticeably slow as the signal approaches the respective terminal level.
Here's a more recent image. I switched to a slightly better set of probes and made sure they were set to 10x.
SDS00001.png
On the scope I am seeing some that /RD and /WR lag ~10ns compared to PHI2. That is not out of line with the fact that it's passing through a 7ns CPLD. Still, signs are pointing to the ATF1504 that does the /RD and /WR. Which sucks, because apparently my expensive Atmel USB programmer seems to not be working any more; it can't find either CPLD through the on-board JTAG, nor can it find a brand new chip plugged into a breakout board that has JTAG. Fun times!

Re: Ok, I've got a really odd issue

Posted: Tue Apr 29, 2025 7:34 pm
by BigEd
I think the relative phases of things is going to be the clue - presumably you have at least two channels? Clock plus one other, and the other one working down a list: chip select, write enable, read not write, address line. Perhaps trigger on chip select? (Chip select of the RAM which is getting unintended writes, by hypothesis.)

Re: Ok, I've got a really odd issue

Posted: Tue Apr 29, 2025 8:04 pm
by jmthompson
BigEd wrote:
I think the relative phases of things is going to be the clue - presumably you have at least two channels? Clock plus one other, and the other one working down a list: chip select, write enable, read not write, address line. Perhaps trigger on chip select? (Chip select of the RAM which is getting unintended writes, by hypothesis.)
Yep see above. the difference in phase is ~10ns for both /RD and /WR vs PHI2. But the CPLD would be adding 7ns so that may be the cause of that.

Re: Ok, I've got a really odd issue

Posted: Tue Apr 29, 2025 11:43 pm
by BigDumbDinosaur
jmthompson wrote:
BigEd wrote:
I think the relative phases of things is going to be the clue - presumably you have at least two channels? Clock plus one other, and the other one working down a list: chip select, write enable, read not write, address line. Perhaps trigger on chip select? (Chip select of the RAM which is getting unintended writes, by hypothesis.)
Yep see above. the difference in phase is ~10ns for both /RD and /WR vs PHI2. But the CPLD would be adding 7ns so that may be the cause of that.

Having sampled a number of 65C816s in POC V1.3 while the logic analyzer was hooked up—one of which was an older 0.8µ Sanyo-cored part, I can tell you tADS was consistently right around 12ns on five volts and at room temperature.  Using 12ns for tADS, /RD or /WD in your unit should become valid no later than 20ns after the fall of Ø2.  20ns in your application is all the time in the world, so to speak, so I don’t think CPLD prop time is the issue.  If the 1504 is being a bottleneck, I’d be suspecting your Verilog.

I based that 20ns number on the fact that the ATF1504AS-7 has a worst-case 7.5ns pin-to-pin prop time on five volts.  As the generation of /RD and /WD should be nothing more than combinatorial logic, the device’s pin-to-pin prop time would be the controlling factor in when those signals would become valid.  In my POC unit, I use discrete 74AC logic to produce those signals; the time required for /RD and /WD to become valid is in the 18-20ns range after the fall of Ø2, and hence comparable to what you should be seeing.

Regarding the 816’s tADS spec, yes, I know the data sheet claims it could be as long as 30ns on five volts.  My opinion is that is malarkey, and likely reflects the days when the 816 was being produced in 1.2µ geometry and FMAX was 10 MHz (we’re talking 35 years ago).  If the quoted maximum for tADS really is 30ns, the 816 would be barely functional at 14 MHz, and definitely incapable of meeting setup times at the 20 MHz David Gray says production devices are tested.

Re: Ok, I've got a really odd issue

Posted: Wed Apr 30, 2025 1:44 am
by jmthompson
BigDumbDinosaur wrote:
Having sampled a number of 65C816s in POC V1.3 while the logic analyzer was hooked up—one of which was an older 0.8µ Sanyo-cored part, I can tell you tADS was consistently right around 12ns on five volts and at room temperature.  Using 12ns for tADS, /RD or /WD in your unit should become valid no later than 20ns after the fall of Ø2.  20ns in your application is all the time in the world, so to speak, so I don’t think CPLD prop time is the issue.  If the 1504 is being a bottleneck, I’d be suspecting your Verilog.
Ok good to know my board's timing is well within tolerance. I will poke around more tomorrow, maybe do some more looking at /WR in particular, including verifying my estimate of the lag compared to PHI2.

Re: Ok, I've got a really odd issue

Posted: Wed Apr 30, 2025 4:15 am
by BigDumbDinosaur
jmthompson wrote:
I will poke around more tomorrow, maybe do some more looking at /WR in particular, including verifying my estimate of the lag compared to PHI2.

With your scope’s sweep being triggered by the rise of Ø2, one channel watching RWB and the other watching /RD or /WD, you should have no trouble determining if read/write timing is sane.

A fundamental to keep in mind when examining 65xx circuit timing is it is the fall of the clock that is the start of a machine cycle and hence the “ground zero” timing reference.  In the 65C816, the tADS parameter is most important and may be thought of as the time that elapses after the fall of the clock before the states of VDA and VPA become valid.  If one strictly follows WDC’s recommendations, all chip selects should ultimately be qualified with those two signals, since they alone are the true arbiters of when MPU state stabilizes.

Timing is always based on the assumption that the clock is symmetric.  If it isn’t, your worst-case timing headaches will come during the shorter clock phase.  As your clock is being run through a flop, asymmetry shouldn’t be a concern.

Re: Ok, I've got a really odd issue

Posted: Wed Apr 30, 2025 6:59 am
by BigEd
> If one strictly follows WDC’s recommendations, all chip selects should ultimately be qualified with those two signals, since they alone are the true arbiters of when MPU state stabilizes.

I wouldn't say so. That would make them strobes, but I believe they are simply clocked outputs like most other pins. The clock-to-output delay is often what matters, and there's no special reason to suppose all signals with the same spec for latest validity will in fact be valid at the same time - for one thing, they may have different loads.

> Timing is always based on the assumption that the clock is symmetric.

I don't think this is true either. One must read the timing diagram carefully and see which edges cause which events. A symmetric clock is normal, but not a constraint.

One thing to bear in mind is the causal nature of the system. Things happen because of previous causes, not because of subsequent events. This may seem obvious, but we do see claims here from time to time which presume otherwise.

Re: Ok, I've got a really odd issue

Posted: Wed Apr 30, 2025 8:33 am
by fachat
Qualifying with VDA and VPA does not enforce any timing as they are simple outputs, but is necessary to avoid stray accesses.
Qualifying with Phi2 then imposes the correct timing.

Re symmetric clock: my Micro-PET uses a 13.5MHz and only has the first half this fast. I stretch the second part (phi2 high) as needed to achieve sync with the video accesses or even intentionally slowing down the system to achieve classic apeed (1MHz) for emulation purposes

André

Re: Ok, I've got a really odd issue

Posted: Wed Apr 30, 2025 2:17 pm
by Dr Jefyll
BigDumbDinosaur wrote:
VDA and VPA [...] are the true arbiters of when MPU state stabilizes.
It's true that some processor families use a strobe signal whose timing tells devices in the system that addresses and other state can "now" be considered VALID. But 65xx isn't one of those families.

Unfortunately, this makes the naming of the 816's VPA and VDA signals potentially misleading, given that Valid Program Address and Valid Data Address both prominently include the word "valid." But -- other processor families notwithstanding -- I can't agree that VPA and VDA reveal when MPU state stabilizes (and Ed wouldn't say so, either). I'm with André when he points out that correct timing derives from Phi2, not from VDA and VPA (which are simple outputs).

For the benefit of all forumites, let's consider other signals which don't carry timing information. R/W is a signal that describes what sort of bus cycle is in progress (either a read or a write). A0, too, describes the cycle in that it indicates whether an odd byte or an even byte should be accessed, and each of the other address lines likewise divides the address space into halves. VPB is yet another description of the cycle; either it is part of a Vector Pull or it isn't.

Each of these signals can be expected to go high or go low as appropriate, with transitions occurring subsequent to a delay after the fall of Phi2. The delay will be no more and no less than the timing specs indicate -- we understand there's room for variation within the specified window. But that variation in the transition timing isn't intended to tell us anything. It's just the somewhat haphazard result of manufacturing subtleties and operating conditions.

The same is true regarding VPA and VDA. The timing of the transitions isn't meaningful; VPA and VDA merely describe the cycle. If VPA is high it indicates that a byte will be read and treated as code. VDA, if high, indicates either that the code byte being fetched is an opcode (not an operand), or that a byte of pertinent data will be read or written.

-- Jeff

Re: Ok, I've got a really odd issue

Posted: Wed Apr 30, 2025 3:40 pm
by BruceRMcF
BigDumbDinosaur wrote:
... Having sampled a number of 65C816s in POC V1.3 while the logic analyzer was hooked up—one of which was an older 0.8µ Sanyo-cored part, I can tell you tADS was consistently right around 12ns on five volts and at room temperature.  Using 12ns for tADS, /RD or /WD in your unit should become valid no later than 20ns after the fall of Ø2.  20ns in your application is all the time in the world, so to speak, so I don’t think CPLD prop time is the issue.  ...
Did you look at and note tBAS? One way to get earlier capture of the Bank address from the data lines is to use a delay line on the clock, and having a reasonably early timing for that could be handy. EG, a 5 tap 50ns delay line would let you use the 4th tap for 40ns for the trigger to capture the Bank number given then 33ns datasheet spec, but if it is consistently 15ns or less, the 2nd tap could be used for an 20ns delay.

Re: Ok, I've got a really odd issue

Posted: Thu May 01, 2025 2:51 am
by Dr Jefyll
BigDumbDinosaur wrote:
Timing is always based on the assumption that the clock is symmetric. If it isn’t, your worst-case timing headaches will come during the shorter clock phase.
Yup, I agree that worst-case timing headaches typically come during the shorter clock phase. But the preceding statement is harder to agree with, perhaps because the wording is a bit ambiguous. (To me, at least. Language can be a struggle sometimes. :roll: )

jmthompson, at some point it may be desirable to run some new experiments, striving to make them as simple as possible (while still demonstrating the misbehavior, of course). What we want is an example of the corruption that's minimally complex, because penetrating complexity is fundamental to troubleshooting. We also want maximal documention (ie; you'd share full details of the experiments with us).

AIUI, all your code resides in a "ROM" (actually a memsim emulator) in Bank $10. I'd like to see what happens if, immediately following reset, you were to fill RAM with $55, then pound on Direct Page or the stack for a while. Then later would you look at other banks to see what if any corruption has occurred. I hope I'm explaining this in a way that makes sense...

-- Jeff

Re: Ok, I've got a really odd issue

Posted: Thu May 01, 2025 5:03 pm
by plasmo
I’m reading this topic quietly and really expecting an ‘aha!’ to pop up anytime. Since the problem is repeatable at half the system clock, 4Mhz, I don’t think timing is an issue (unless it is a hold time issue, which seems unlikely due to simplicity of the decode). So have you tried building up 2nd board? Swapping or adding new components for 2nd board can sometimes find the elusive mechanical issue.

On a somewhat related topic, I have a 6502 design that can accommodate 65816, but I have not tested the 65816 mode, so I thought I’ll use this opportunity to bring up the 65816. The design is quite similar to JRC1; it has CPLD for decode, a 512KB flash and a 512KB RAM and operating nominally at 7.37mhz. I should be able to run similar tests on my platform.
Bill

Re: Ok, I've got a really odd issue

Posted: Thu May 01, 2025 11:47 pm
by Dr Jefyll
plasmo wrote:
mechanical issue
jmthompson, just a shot in the dark, but have you inspected your project for things like IC pins that fail to engage their socket, and solder joints (including IC pins and IC socket pins) that accidentally never got soldered?

-- Jeff

Re: Ok, I've got a really odd issue

Posted: Wed Aug 27, 2025 6:35 pm
by jmthompson
Hey folks, sorry for vanishing for a while and leaving this issue with no activity. Got frustrated and took a couple months off. Also got I finally got employed so I can spend money on hobbies again. The software engineer job market right now is absolutely brutal.

The good news is I *think* I have this fixed as of today. I ended up swapped the 74AC573 latch for a 74HC573. The reason was because my logic probe was showing that when a data line (D0 in my case) was high on a previous cycle, then as Phi2 fell the latch briefly allowed that through as a spike on A16. It was very brief, and was already settled long before /CE or /WR got asserted, but it seems to have fixed the issue. My guess is the RAM was running an extra write cycle to another bank using the spurious upper address lines. This would also explain why any time I did see this issue the values written seemed to correspond to the bank (bank 1 corruption always had bit 0 set, for example).

Anyway, I'm back up to 8 MHz again and so far no corruption. I'm keeping my fingers crossed. :)

Re: Ok, I've got a really odd issue

Posted: Thu Aug 28, 2025 5:35 am
by BigDumbDinosaur
jmthompson wrote:
Hey folks, sorry for vanishing for a while and leaving this issue with no activity. Got frustrated and took a couple months off. Also got I finally got employed so I can spend money on hobbies again. The software engineer job market right now is absolutely brutal.

I could make a snarky comment about why the job market has been so trying, but I don’t want to deflect attention from your project.  :D  It’s good to hear that you are employed again and hopefully enjoying your new gig.

Meanwhile, back at the ranch...

Quote:
The good news is I *think* I have this fixed as of today. I ended up swapped the 74AC573 latch for a 74HC573. The reason was because my logic probe was showing that when a data line (D0 in my case) was high on a previous cycle, then as Phi2 fell the latch briefly allowed that through as a spike on A16. It was very brief, and was already settled long before /CE or /WR got asserted, but it seems to have fixed the issue.

I have my doubts that switching to the somewhat-slower HC573 fixed the root cause.

I have observed what you describe in my POC V1.3 unit, which uses a 74AC573 latch (and no bus driver), yet is rock-solid at 16 MHz—uptime as I write this is 95 days.  Address bus glitching during the TADS part of the bus cycle is expected, as it is during that time that the 65C816 is “shuffling the deck,” so to speak, in preparation for the next move.  Different internal signals take different internal paths, some of which are longer in terms of elapsed time.  That being the case, it is to be expected that not all outputs will simultaneously stabilize.  I have routinely observed that the buses become a bit disorganized after the TAH period that follows the fall of the clock has elapsed, but before TADS has elapsed.

The fundamental difference between POC V1.3 and your machine is V1.3 qualifies all chip selects with VDA and VPA, not just I/O hardware.  By the time those signals go true, the address and data buses have settled, and the emitted signals are stable.  This I have observed with both the scope and the logic analyzer.

An address bus glitch during TADS will not affect chip selects if they are fully qualified by VDA and VPA.  There seems to be some sort of illogical resistance around here to that, despite WDC themselves advising to do so in the data sheet.

  • 7.5 VDA and VPA Valid Memory Address Output Signals

    When VDA or VPA are high and during all write cycles, the Address Bus is always valid.  VDA and VPA should be used to qualify all memory cycles.  Note that when VDA and VPA are both low, invalid addresses may be generated.  The Page and Bank addresses could also be invalid.  This will be due to low byte addition only...


Emphasis added.

Quote:
My guess is the RAM was running an extra write cycle to another bank using the spurious upper address lines.  This would also explain why any time I did see this issue the values written seemed to correspond to the bank (bank 1 corruption always had bit 0 set, for example).

I personally doubt this, and am more inclined to think you are being pranked by not fully qualifying your RAM chip select.