I made some progress fixing the WRn write pulse, but I seem to be facing a timing issue now.
Here is the logic analyzer showing the old timing before the fix. You can see the RDY signal is perfect, but the WRn pulse toggles with CLK which is not what the peripheral expects (key for which traces correspond to which signals is at the bottom of the window):
Attachment:
File comment: Wait state with incorrect WRn pulse
wait_old.png [ 102.39 KiB | Viewed 1517 times ]
The above timing worked fine with the 68B50 UART, but that's probably just dumb luck and I don't want to take chances with the PMP on the PIC.
So I modified the circuit generating the WRn pulses and now I have this timing:
Attachment:
File comment: Wait state with correct WRn pulse
wait_new.png [ 124.08 KiB | Viewed 1517 times ]
But unfortunately the system no longer works correctly. In particular, the PIC18 still programs the "ROM" correctly, but when control is transferred to the 65C02, EhBASIC doesn't work correctly. My best guess is that the tiny additional logic delay to the WRn signal is now late enough that the data lines have started to change while the write pulse on the CY7C199 memories is still low -- at least for a few nanoseconds -- which apparently is long enough to change their contents to other than what they should be.
When RDY is not asserted, the WRn logic works exactly as it did in the first diagram. The only difference now is that there is one more 74HC00 gate delay in the path of the clock signal. I could try to fix this by replacing the 74HC00 with a 74AHC00 gate, but I'd prefer to avoid going down that path until later when I want to push the speed of the 65C02 to the limit. Instead, I'm thinking that why not run the PHI2 signal through a couple of inverters and then use this delayed clock to supply PHI2 to the entire system, except for the WRn logic which can use the non-delayed PHI2 signal. I've used similar techniques on FPGA designs when they had to interface with external asynchronous devices with success, so it seems a reasonable path to go down.
If there is a better way I haven't considered, I'd be happy to hear of it. Hopefully something short of running a PLL that will allow me to implement arbitrary phase delays into my clocking signals though!
Edit: In the two images above, the logic analyzer output D2 is erroneously labeled as RDn (read strobe). It is in fact connected to the RWB pin on the 65C02.