6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 4:25 pm

All times are UTC




Post new topic Reply to topic  [ 86 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
PostPosted: Tue Jul 19, 2022 5:53 pm 
Offline

Joined: Tue Jul 05, 2005 7:08 pm
Posts: 1043
Location: near Heidelberg, Germany
The xc9500xl (3.3v cpld but 5v toleratant inputs) app note for interfacing with 5v give an interesting pattern for getting a 5v ttl high on a 3.3v output, and I've successfully used it in the Micro-PET.

Make the phi2 pin bidirectional in the CPLD. If you want low output, set it to low.
If you want high output, set it to high until the input reads high too. Then set it to high z, and let the pullup resistor do the rest.

André

_________________
Author of the GeckOS multitasking operating system, the usb65 stack, designer of the Micro-PET and many more 6502 content: http://6502.org/users/andre/


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 22, 2022 8:49 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
So, I’ve been monkeying with POC V2.0, still with the NOP ROM, so I could further study the bus timing during a data fetch to see how good (or bad) my design seems to be. Executing NOPs is good for this purpose, since the instruction consists of the opcode fetch cycle and a “dead” cycle. The 65C816’s behavior during the dead cycle is kind of interesting, but that’s a topic for another post.

Anyhow, I generated a new annotated logic analyzer capture for your viewing pleasure:

Attachment:
read_timing_annotated_reduced.jpg
read_timing_annotated_reduced.jpg [ 425.92 KiB | Viewed 888 times ]

In the above, the notations above the capture are times in nanoseconds. These times need to be taken with a grain of salt, as the logic analyzer’s maximum resolution is 2ns (500 MHz sampling clock). So right off the bat, the clock period isn't necessarily what it appears to be.

Ø2 is 16 MHz when not being stretched during a wait-state, which produces a 62.5ns clock period, or a 31.25ns half cycle. The logic analyzer has to fudge with displaying these signals, which creates some minor oddities with, for example, GCLK (global clock, which is the time base for the entire mess) and Ø2. In actuality, these signals are always in phase, except during a wait-state. Because of the logic analyzer's rounding to the nearest 2ns, it appears the two clocks are 2ns out of phase during the opcode fetch cycle. This artifact is gone by the time Ø2 falls at the end of opcode fetch—apparently the logic analyzer did some more fudging at that point.

The data bus is being sampled by the logic analyzer on the inward (MPU) side of the bus transceiver. The presence of the transceiver has some interesting effects. The transceiver is closed during Ø2 low to prevent any possibility of bus contention. The bank bits persist for 6ns after the rise of Ø2. However, /RD (read data) goes low 4ns after the rise of Ø2. It is at this point in the cycle where the MPU could theoretically get into a shoving match with whatever device has been selected. However, the transceiver doesn't open for business until 8ns after the rise of Ø2. By then, the MPU has turned around the data bus and the window of opportunity for contention has been closed.

Note that the ROM doesn't start emitting data until some 20ns after the rise of Ø2—this is a 45ns ROM. The ROM's /CS (chip select) is being asserted 10ns before the rise of Ø2, so the ROM is performing substantially better than specified. Also notice /WSE (wait-state enable) is apparently simultaneously asserted with /CS. This is likely for real, since buried logic is used to trigger chip selects and /WSE, if ROM or I/O is selected. As the buried logic is combinatorial, it has a vanishingly-small amount prop time. That would explain why /CS and /WSE appear to be simultaneously asserted.

The $FF data bus pattern seen at the point where the transceiver is opened is being generated by pullup resistors that are on the outward (device) side of the transceiver. The resistors help TTL devices push the data lines closer to CMOS territory, as well as prevent the bus from floating whilst the transceiver is closed, since the transceiver will high-Z its signal pins at that time. The $FF pattern persists until the ROM produces some output. This is of no concern to the MPU, since it doesn't sample the data bus until just before the fall of Ø2.

Once the opcode fetch cycle has completed, the MPU will execute a dead cycle. I didn't show the details of that, but some shenanigans involving addressing do occur. Even though it’s a dead cycle and the MPU doesn't perform any external operations, it does emit A16-A23 during Ø2 low. VDA || VPA is false during that time, and since those signals are accounted for in the glue logic, the ROM’s /CS is deasserted during the dead cycle. Also, very shortly after the fall of Ø2, the transceiver will close, which occurs well before the MPU starts emitting A16-A23 again. I show that as occurring at 10ns, but again, the logic analyzer has to fudge and hence there is some uncertainty involving the fall of Ø2 and the response time of the transceiver. As I am using a 74ACT245 transceiver, the maximum specified for that time is 11ns on 5 volts. The transceiver in POC V2.0 appears to be a little faster than that, but it’s not a critical situation.

One other thing mentioned in an earlier post, but worth noting again, is the window of opportunity to cleanly trigger a wait-state is relatively small—it has to occur before the rise of GCLK. I'm cutting it somewhat close in this design, which is, as I also earlier noted, why the maximum reliable Ø2 rate is 16 MHz. Other than that, it appears my logic timing is acceptable and the bodge wire is safe...for now. :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Fri Jul 22, 2022 9:09 am 
Offline
User avatar

Joined: Sat Jul 24, 2021 1:37 pm
Posts: 282
Very cool to see these timings in real life!

_________________
BB816 Computer YouTube series


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 24, 2022 7:16 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
BigDumbDinosaur wrote:
So, I’ve been monkeying with POC V2.0, still with the NOP ROM, so I could further study the bus timing during a data fetch to see how good (or bad) my design seems to be...The 65C816’s behavior during the dead cycle is kind of interesting, but that’s a topic for another post.

Here's another annotated logic analyzer capture:

Attachment:
nop_timing_annotated_reduced.jpg
nop_timing_annotated_reduced.jpg [ 563.52 KiB | Viewed 831 times ]

The above is the execution of a NOP instruction, both the opcode fetch and “dead” cycles. Most of it should be self-explanatory.

The $EA seen on the data bus during the dead cycle is the sort of data persistence we have talked about over the years. In POC V2.0, the data bus transceiver is opened during Ø2 high, whether a valid or dead cycle. On the rise of Ø2, the MPU is connected to the outward side of the transceiver, but in a dead cycle, nothing is actually driving the bus. Pullup resistors are biasing the bus up to VCC, so theoretically the data bus should be $FF. So the only plausible explanation for $EA appearing during Ø2 high in a dead cycle is bus capacitance.

Another thing to note about the dead cycle is the false bank address emitted during Ø2 low. It’s 100 percent harmless in V2.0 because all addressing is qualified by VDA and VPA. Both of those signals are false during a dead cycle, which means the CPLD will not generate any chip selects. I also use VDA and VPA to qualify /RD and /WD, along with Ø2, mostly as a belt-and-suspenders exercise. It costs very little in CPLD resources to do that and guarantees that neither of those signals will go low when they shouldn’t and possibly cause trouble.

Something else to note is the condition of the data bus during the opcode fetch cycle. After the MPU has stopped emitting the bank bits (A16-23), there is a short “turnaround” interval as the MPU gets ready to read data. The $FF pattern caused by the bus pullup resistors persists until the ROM responds to /RD going low and starts driving the bus. It appears in the capture that not all of the ROM's data pins start driving at the same time. Or, it could be the pin-to-pin prop time in the bus transceiver varies from one channel to the other, thus skewing the signals a bit. However, as I mentioned in an earlier post, the logic analyzer has a 2ns resolution, which can makes things appear slightly different than they actually are.

I’m kicking myself because I should have put more test points into the board. The input on the logic analyzer is a 40-pin receptacle, into which one end of a standard IDE disk cable can be plugged. A similar receptacle on the PCB would make it possible to connect all test points to the logic analyzer with an off-the-shelf cable.

Or, I could distribute standard 0.025” square post strip headers on the PCB. The leads used to connect the logic analyzer to the device under test are designed to plug onto such posts, which is much more convenient than using “grabbers” attached to chip pins. Oh well! I’ll do that with the next iteration of POC.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 24, 2022 2:26 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
I like to bring all spare pins of CPLD to a header with accompanying VCC and GND. Internal CPLD signals can be routed to CPLD for observation. Quite often I’ll find a way to pack more functionalities into CPLD so the optional header becomes an I/O port
Bill


Top
 Profile  
Reply with quote  
PostPosted: Thu Jul 28, 2022 9:28 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
I'm still fooling around with the NOP ROM, looking at timings and monkeying with the CPLD code. I’ve got some potential trouble spots that may result in glitches, so some refinement is going to be necessary.

Meanwhile, I did a logic analyzer capture of system behavior after coming out of reset:

Attachment:
reset_annotated_reduced.jpg
reset_annotated_reduced.jpg [ 772.9 KiB | Viewed 741 times ]

I rigged up the logic analyzer (LA) so it would start sampling at system power-on. For convenience, I picked off the inverted reset signal, which lags the real reset signal by about 5ns, and used that as the “trigger” at which the LA would start timing things. For testing purposes, GCLK and Ø2 are 10 MHz. The numbers in the annotations above the capture are times in nanoseconds.

As can be seen, eight full GCLK cycles elapse before the 65C816 is ready to go to work. Interestingly, the 816’s data sheet doesn't say how many full cycles must occur after coming out of reset before the reset vector will be fetched. The 65C02’s data sheet says seven cycles are required. I verified that this is also the case with the 816 by single-stepping the clock and counting the number of full Ø2 cycles that had to occur before the reset vector’s LSB was fetched from ROM. Also note that the 816 (and the C02) requires that reset be held low for at least two full Ø2 cycles. In monkeying around with this, I determined that failing to meet that requirement will result in the 816 not responding to the clock.

Some interesting bus shenanigans occur as the MPU gets ready following reset. In the early stages of reset, the data bus appears to have a bank address ($00) on it during Ø2 low, but seems to float during Ø2 high (the $00 — $FF pattern seen before the spurious ROM access). Also, VDA and VPA gyrate a couple of times (I didn't include them in the above capture), as evidenced by the ROM and RAM selects that occur as the MPU gets ready. The apparent $00 bank address makes sense, since the MPU starts in emulation mode, which automatically forces DB and PB to $00. The $FF would be coming from the data bus pullup resistors, which are on the outward side of the data bus transceiver.

A brief glitch appears on the reset line at six GCLKs. I'm going to try hooking up to /RESET to see if that glitch is present. If it is, then the DS1813 controlling the reset circuit has a problem. If not, then the 74AC14 that inverts /RESET to generate RESET has an issue.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 31, 2022 10:41 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
It occurred to me someone might actually want to see what POC V2.0 looks like. Here are some pics.

Attachment:
File comment: POC V2.0 Top View
poc_v2._01.jpg
poc_v2._01.jpg [ 1.95 MiB | Viewed 695 times ]
Attachment:
File comment: POC V2.0 Oblique Top View
poc_v2._02.jpg
poc_v2._02.jpg [ 1.25 MiB | Viewed 695 times ]
Attachment:
File comment: POC V2.0 Expansion Socket
poc_v2._03.jpg
poc_v2._03.jpg [ 1.67 MiB | Viewed 695 times ]
Attachment:
File comment: POC V2.0 Clock Generator Hardware
poc_v2._04.jpg
poc_v2._04.jpg [ 1.6 MiB | Viewed 695 times ]
Attachment:
File comment: POC V2.0 Data Bus Test Header
poc_v2._05.jpg
poc_v2._05.jpg [ 1.5 MiB | Viewed 695 times ]
Attachment:
File comment: POC V2.0 Serial I/O “Harmonica” Jack
poc_v2._06.jpg
poc_v2._06.jpg [ 944.47 KiB | Viewed 695 times ]
Attachment:
File comment: POC V2.0 Power Input Recptacle
poc_v2._07.jpg
poc_v2._07.jpg [ 1 MiB | Viewed 695 times ]

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 31, 2022 11:01 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Wow, that's really nice! I like the expansion connector, reminds me of the PC-AT 16-bit bus extension :wink:

Nice use of SMT devices too.

_________________
Regards, KM
https://github.com/floobydust


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 31, 2022 11:50 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
floobydust wrote:
Wow, that's really nice!

Thanks!

Quote:
I like the expansion connector, reminds me of the PC-AT 16-bit bus extension :wink:

Funny thing about that. :wink: Same number of pins, same color, same clunky appearance. :D

Quote:
Nice use of SMT devices too.

With the CPLD doing almost all of the glue logic grunt work I’m slowly decreasing the discrete part count. I've already concocted a change to the clock generator circuit that would remove the 74AC109 J-K flop and replace it with a short bodge wire.

I'd really like to use the 100 pin QFP version of the 1504AS to gain more I/O pins without significantly increasing the device’s footprint. However, I can’t see well enough to place a part like that, let alone solder it.

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 01, 2022 7:02 am 
Offline
User avatar

Joined: Tue Apr 03, 2018 2:10 pm
Posts: 125
BigDumbDinosaur wrote:
I'd really like to use the 100 pin QFP version of the 1504AS to gain more I/O pins without significantly increasing the device’s footprint. However, I can’t see well enough to place a part like that, let alone solder it.


What about the 84-pin version of the 1508? Comes as PLCC.

_________________
I like it when things smoke.
BlogZolatron 64 project


Top
 Profile  
Reply with quote  
PostPosted: Mon Aug 01, 2022 7:48 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
speculatrix wrote:
BigDumbDinosaur wrote:
I'd really like to use the 100 pin QFP version of the 1504AS to gain more I/O pins without significantly increasing the device’s footprint. However, I can’t see well enough to place a part like that, let alone solder it.

What about the 84-pin version of the 1508? Comes as PLCC.

If the 1508 is in a socket, it’s going to eat up a fair amount of PCB real estate and likely complicate the layout. I'd have to solder it to the board for it to be practical.

BTW, I had done a layout in the past using a socketed PLCC-84 version of the 1508. The CPLD was like the 500 pound gorilla in a room full of baby monkeys. See attached.

Attachment:
poc_1508.jpg
poc_1508.jpg [ 1.29 MiB | Viewed 651 times ]

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 86 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: