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

All times are UTC




Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Looking for Feedback
PostPosted: Wed Jun 28, 2023 12:56 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
So I've got what is starting to look like an actual circuit going, and before I get too deep into the weeds with this, I'd like to solicit some feedback to make sure I'm not doing anything crazy with this hardware.

A lot of this based on some feedback I've received here and what I've found out on the internet. Some points of interest that I want to make sure I have right:

1) Haven't tried my RTC yet (DS1511Y+), looks like it has a reset circuit which I presume is similar to the one on the DS1813-10, but the datasheet doesn't really specify if I can actually drive the line low like I am. (It does say it's open drain, and requires a pull up, so I'm hoping I'm correct in interpreting that as I can.)

2) The JTAG port, want to make sure I have the correct method for pull up/down resistors there, seems like you can go either way (up or down) according to the interwebs, but I'm not sure about this.

Other notes:
The clock module is going to change to something more sophisticated for debugging and what not.

I'd like to add some expansion ports/pins for doing additional circuits (video, audio, etc)

Any other thoughts you might have are of course welcome!


Attachments:
Cat6502.png
Cat6502.png [ 417.5 KiB | Viewed 1979 times ]
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 12:57 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
Here's the PDF, don't think the PNG came out all that clear.


Attachments:
Cat6502.pdf [292.56 KiB]
Downloaded 64 times
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 3:14 am 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Okay, here's some feedback....

1- The RTC/Reset: This is an overly complicated reset circuit. Also note that the RTC will only drive RST low if the voltage goes under the specified value in the datasheet. Second, the D1 diode is not needed and is backwards, hence you'll never see an interrupt request from the RTC. Also realize that if you manage to get the RTC to trigger an interrupt and not service it, it will persist from a power off/on cycle and just lock the system up. I suggest you remove the diode and replace it with a jumper. For a Reset circuit, perhaps look at a TL7705, which will provide active low and high outputs which are both open collector.

2- The VIA and display: The same applies for D3, not needed as you're using the N version, which is open collector output, and the diode is backwards. For driving the display... I would likely ditch the 138 decode and '04 inverter and just use a single port line for the enable line on the display. Why make it more complicated?

3- CPU address/data lines: What is the purpose of using pull-down resistors on everything? I can't see why they would be needed.

4- CPLD decode: the 1502 is nice, but you're barely using any of it... maybe look at a 22V10, which will handle everything you're doing. Also, I think at least one of the JTAG lines need to be pulled high.

5- Clock circuit: You've chosen a specific oscillator frequency with a question mark for another. What are your goals on a hardware level that pre-req such a specific frequency in the first place?

6- Serial circuit: The reset can he handled per above with the TL7705 and eliminate the '04 inverter. Using the RS-232 level conversion is standard, but are you planning to use this port as a console? If yes, you might consider eliminating the MAX chip and just use a TTL 5V to USB serial interface from FTDI or others.

7- Power supply: Unless you need all of those voltages (+/- 12V, +3.3V) in addition to +5V, that's a lot of extra circuitry, versus a basic 5V regulated supply that can handle 3-5 amps of current, which is more than enough.

Other... perhaps use a DS-1813 and pushbutton on the NMI line as a a Panic button. Having a NMI routine that can restore your basic I/O configuration and getting things back is a plus for debugging.

Hope this helps....

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 3:37 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
not bad, a few things that i've noticed:

your JTAG pinout for the CPLD is a bit different to what i usually use, though i don't know if that would cause issues or not.
you have VCC on pin 7, while mine has that NC, and you have pin 10 NC while mine has GND there:
Attachment:
chrome_UlQdK0nFpa.png
chrome_UlQdK0nFpa.png [ 159.32 KiB | Viewed 1964 times ]


also, i've noticed that you have IO devices that take up between 8 and 32 addresses, but your decoding logic only uses the upper 5 address lines of the CPU.
i assume that means your IO mirrors itself a few times in memory. but why? you have more than enough spare pins on the CPLD, you could connect all 16 address lines and decode the IO devices exactly so they only take up as many addresses as needed so you have more RAM/ROM available.

while on RAM/ROM you seem to have 32kB of RAM in total, but the ROM is only 8kB in size, so like with the IO devices do you just have multiple copies of it in memory? that seems wasteful, why not use a larger RAM IC to have 56kB of RAM and 8kB or ROM, or use a larger ROM like 16-32kB?

why use a series of 3 D-Flip Flops for your Reset signal instead of a DS1813? you already have one on your board, but only use it for the power circuit, so a second one wouldn't hurt for the System Reset as it would save you atleast 1 logic IC a bunch of wiring on a PCB.

another thing, why divide the clock by 4? wouldn't it be enough to divide it by 2 and just use a slower oscillator? or to just run the system a bit faster (if you plan that i would recommend hooking up RDY to the CPLD so you can add a wait state circuit later when you might need it at +10MHz, though that could get tight with the IO pins on the CPLD)

speaking of CPLD, i see the 8 ~DEV lines coming from it, but only ~DEV0-2 are being used for IO devices, the others seem to go nowhere. and there is no expansion connector or similar onboard where they'd go to so what do they do besides taking up IO pins?

and while on the idea of expansion, i wouldn't just waste PA6 and PA7 by leaving them unconnected. personally i would run on LCD in 4-bit mode so that 4 pins on Port-B would be free and bring those out along side PA6 and PA7 (and some VCC and GND pins) to some connector.
that gives you enough IO pins to implement a software I2C or SPI interface with a few chip select lines, which can be useful when messing around with any kind of I2C or SPI device, like SD Cards, various sensors, displays, Microcontrollers, etc.


oh an lastly, U4B and U5B are both spares but you kept them in the Power section instead of along side the other spares in the bottom left corner. it's a minor inconsistency but i thought it was worth commenting on.


.

anyways those are just my thoughts and things i've noticed on the Schematic.


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 4:28 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
floobydust wrote:
Okay, here's some feedback....

1- The RTC/Reset: This is an overly complicated reset circuit. Also note that the RTC will only drive RST low if the voltage goes under the specified value in the datasheet. Second, the D1 diode is not needed and is backwards, hence you'll never see an interrupt request from the RTC. Also realize that if you manage to get the RTC to trigger an interrupt and not service it, it will persist from a power off/on cycle and just lock the system up. I suggest you remove the diode and replace it with a jumper. For a Reset circuit, perhaps look at a TL7705, which will provide active low and high outputs which are both open collector.


(Always get those diodes backwards.... >_< )

Looks like I need to double check that. I didn't look at the section about setting alarms and what not yet. I was mostly reading details about how the watchdog timer worked. That being said, my understanding was that when the 6502 comes out of reset the interrupt disable status register is set. Is my understanding incorrect?

I had also considered making some sort of a PIC with a (C)PLD which I'd have boot up with interrupts all disabled. (Still exploring this idea)

The reset circuit has the flip flops the provide at least two clock cycle delays. I plan to later replace the clock circuit with a design that will let me select clock speeds, so I can't guarantee the 200ms that from the RTC will generate a long enough reset for the 6502. (more on this later)

Quote:
2- The VIA and display: The same applies for D3, not needed as you're using the N version, which is open collector output, and the diode is backwards. For driving the display... I would likely ditch the 138 decode and '04 inverter and just use a single port line for the enable line on the display. Why make it more complicated?


I plan to add more devices in the future, which is what the 138 is for. I may or may not keep everything that's attached currently to the VIA. I might replace it all with a keyboard and something else (I don't know what yet.)

This is mostly a holdover from having the 138 on my bread board for testing ideas.

Quote:
3- CPU address/data lines: What is the purpose of using pull-down resistors on everything? I can't see why they would be needed.


At some point I'd like to figure out how to do some DMA which will require using the bus enable pin. I also have several memory "holes" that are unused and would like them to have a well defined value. The end goal right now is to have a board that I can do some more experimenting with, so I figured having those tied down might be a good idea.

I can certainly remove them if they aren't needed, I was kinda on the fence with having them there in the first place.

Quote:
4- CPLD decode: the 1502 is nice, but you're barely using any of it... maybe look at a 22V10, which will handle everything you're doing. Also, I think at least one of the JTAG lines need to be pulled high.


I looked at the 22V10, the problem is they only have 10 output pins, and I needed 11! >_<

You're right of course, I'm barely using the 1502 at all, which made me die a bit inside, but I haven't found a smaller PLD that has at least 11 pins.

Quote:
5- Clock circuit: You've chosen a specific oscillator frequency with a question mark for another. What are your goals on a hardware level that pre-req such a specific frequency in the first place?


25.175Mhz is what I have on hand right now, my ultimate aim is to try and get close to the 14MHz speed the 6502 datasheet says the CPU can run at, hence the note. I'm not there yet though, the ROM won't meet the timing requirements at 14Mhz (and I'm possibly already over clocking it slightly with the 6Mhz that it's running at now)

This will require me to figure out some clock stretching which I'm only just now digging into.

Quote:
6- Serial circuit: The reset can he handled per above with the TL7705 and eliminate the '04 inverter. Using the RS-232 level conversion is standard, but are you planning to use this port as a console? If yes, you might consider eliminating the MAX chip and just use a TTL 5V to USB serial interface from FTDI or others.


(Getting back to the reset circuit)
I'll take a look, I HAD a DS1813-10 there, but when I saw the fact that the RTC I picked out could do that job I figured it would make more sense to remove the extra part in favor, in what I hoped to be, a more simple design. The extra added benefit here is that the RTC will drive the reset line low when the watchdog timer is configured to do so.

I later (after posting the circuit) realized that I could have just used Q' from the flip flops to drive the reset line for the serial port as well.

Initially and right now it is the console yes. Later I plan to try my hand at maybe doing a VGA text display. (Hence why I have the 25.175Mhz oscillator)

The reasoning for the MAX was that if/when I get that done and free up the serial port, I can use it for some other device communication. (Mouse, Modem, other? IDK)

Good chance I could also throw a MAX3421E or VNC2-32L1C for that though.

Quote:
7- Power supply: Unless you need all of those voltages (+/- 12V, +3.3V) in addition to +5V, that's a lot of extra circuitry, versus a basic 5V regulated supply that can handle 3-5 amps of current, which is more than enough.


So the plan here is to pull power from a low* wattage ATX power supply, which provides those extra voltages. If at some point I decide I want to work with something that needs 3.3V (FPGA) or 12V (Floppy drive perhaps?) I'll have it from that, plus a reasonably (I hope) clean supply for 5V. The circuitry I have there is intended to mimic the soft power switch modern PCs have.

* Not that any modern ATX power supply is exactly "low" wattage these days.

I could grab a smaller 5V brick of some sort and use a power regulator to give me 3.3V when I need it. But the ATX supply already did this for me and has standby current for doing other niceties like keeping the the Lith-Ion bat in the RTC charged up.

Quote:
Other... perhaps use a DS-1813 and pushbutton on the NMI line as a a Panic button. Having a NMI routine that can restore your basic I/O configuration and getting things back is a plus for debugging.


I'll look into that, I hadn't really decided what to do with the NMI pin yet (if anything).

Quote:
Hope this helps....


Thank you! It is most insightful.


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 5:27 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
Proxy wrote:
not bad, a few things that i've noticed:

your JTAG pinout for the CPLD is a bit different to what i usually use, though i don't know if that would cause issues or not.
you have VCC on pin 7, while mine has that NC, and you have pin 10 NC while mine has GND there:
Attachment:
chrome_UlQdK0nFpa.png



Thank you for noting that, I'll double check it.

Quote:
also, i've noticed that you have IO devices that take up between 8 and 32 addresses, but your decoding logic only uses the upper 5 address lines of the CPU.
i assume that means your IO mirrors itself a few times in memory. but why? you have more than enough spare pins on the CPLD, you could connect all 16 address lines and decode the IO devices exactly so they only take up as many addresses as needed so you have more RAM/ROM available.


Upper 6 bits actually. :)

Quote:
while on RAM/ROM you seem to have 32kB of RAM in total, but the ROM is only 8kB in size, so like with the IO devices do you just have multiple copies of it in memory? that seems wasteful, why not use a larger RAM IC to have 56kB of RAM and 8kB or ROM, or use a larger ROM like 16-32kB?


On my bread board currently are some demultiplexers (a 139 and 138 to be specific).

The memory map worked out to be something like this:
0x0000-0x7FFF = RAM
0x8000-0x9FFF = 8KB Device map
- 0x8000 - 0x83FF = Device 0
- 0x8400 - 0x87FF = Device 1
- 0x8800 - 0x8BFF = Device 2
...
0xA000-0xBFFF = 8KB hole #1
0xC000-0xDFFF = 8KB hole #2
0xE000-0xFFFF = 8KB ROM

This seemed to work nicely with the demultiplexers as well as the RAM and ROM modules I had on hand. I'm kinda happy with this layout. It give plenty of space for each I/O mapped device, and two 8KB holes that I can fill in for video or sound DMA later.

You're correct, I could get really nuanced with the 1502's decoding and make it so that every device doesn't repeat, and honestly I hadn't thought to try, I could squeeze every last drop out of the memory space, but I don't know if the payoff would be worth it in the end.

I'm also still not entirely clear what I am and am not allowed to do with some of the CPLD's pins. In my address decoding (which is dirt simple right now) it seems to be fine assigning pins however I want, but when I started trying to do more complex designs in Verilog, the fitter started complaining about what I was doing (a LOT), so I'm still trying to wrap my head around all of it.

Quote:
why use a series of 3 D-Flip Flops for your Reset signal instead of a DS1813? you already have one on your board, but only use it for the power circuit, so a second one wouldn't hurt for the System Reset as it would save you atleast 1 logic IC a bunch of wiring on a PCB.


The plan is to eventually replace the clock with one I can switch speeds with. Eventually having one I can single step for debugging. If the system resets in the single step mode, I can't guarantee that the 200ms is long enough for two clock cycles (per the datasheet) to be sent to the 6502.

Quote:
another thing, why divide the clock by 4? wouldn't it be enough to divide it by 2 and just use a slower oscillator? or to just run the system a bit faster (if you plan that i would recommend hooking up RDY to the CPLD so you can add a wait state circuit later when you might need it at +10MHz, though that could get tight with the IO pins on the CPLD)


Good question! That's because all I had on hand at the time was a 25.175 MHz clock. Dividing by two was still too fast for my ROM, and I don't have a clock stretching designed/built yet. Dividing by four gave me a clock speed I could test with on my bread board. I would like to move to a 28Mhz clock to drive the CPU at the 14Mhz it says it can do, and use some clock stretching for the ROM and other slow devices.

Quote:
speaking of CPLD, i see the 8 ~DEV lines coming from it, but only ~DEV0-2 are being used for IO devices, the others seem to go nowhere. and there is no expansion connector or similar onboard where they'd go to so what do they do besides taking up IO pins?


The goal is to build a PCB that I can plug breadboards and other things in, probably with some sort of slot like a Eurocard connector, or with a ribbon cable. The extra device lines will go there, I just haven't figured out what I want to do for the ports yet.

Quote:
and while on the idea of expansion, i wouldn't just waste PA6 and PA7 by leaving them unconnected. personally i would run on LCD in 4-bit mode so that 4 pins on Port-B would be free and bring those out along side PA6 and PA7 (and some VCC and GND pins) to some connector.
that gives you enough IO pins to implement a software I2C or SPI interface with a few chip select lines, which can be useful when messing around with any kind of I2C or SPI device, like SD Cards, various sensors, displays, Microcontrollers, etc.


The LCD will likely not be sticking around in the long run, especially now that I have a working serial port. It's a hold over from the Ben Eater videos I was watching, it was the quickest way to get some sort of meaningful display other than some blinkin' lights.

Still trying to figure out what I'll do with other I/O. I'm not sure I'm keen on bit banging the SPI from software. I might try using a CPLD to act as some sort of SPI host controller so the 6502 can just communicate with the devices on a byte level.

Quote:
oh an lastly, U4B and U5B are both spares but you kept them in the Power section instead of along side the other spares in the bottom left corner. it's a minor inconsistency but i thought it was worth commenting on.


Yes, those are running on the +V5SB rail, and I wanted to keep them electrically isolated from the parts that were on the regular +5V rail. I'll move them to make things a bit clearer.


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 5:54 am 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
Eh I wouldn't recommend clock stretching on a 65C02 as it requires extra circuitry and you already have a CPLD that you could use to drive the RDY pin with (through resistor of course as RDY is bidirectional)
1 or 2 wait states for ROM and IO should be enough up to 16MHz.
Speaking of which, while the CPU is rated for 14MHz it's almost guaranteed that it will run at 16MHz as well, and I'd say a 32MHz oscillator is easier to buy than a 28MHz one.
Or you stay with the 25.175MHz one and run it at 12.6MHz.

Also what's wrong with bigbanging SPI? You just need a single function which could sit in ROM and then you'd have the same byte level communication as you would have with a hardware controller, just slightly slower and without additional hardware.

My USB+RTC module uses SPI, and my SBC has SPI done entirely in software and works perfectly fine, and it's even slower because the send/receive function is written in C.

Plus you don't have to dedicate any of the VIAs IO to it, just bring all unused pins out to a header (with CA/CB, some GND and VCC) and you can decide what to use them for, PS/2 keyboard/mouse, SPI, some parallel device, etc.


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 6:18 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Yuri, be sure to go through the 6502 primer, indexed at http://wilsonminesco.com/6502primer/ .  The evidence suggests you have not done that yet.  It's in 22 logically organized chapters, meaning that although it's ok to start by looking at a couple of them out of order, you'll do best if you go through the chapters in order, as they build on each other.  I think you'll find much simpler ways to reach your goals, and save yourself a lot of time and frustration.  As for bit-banging SPI, I have working sample code at http://wilsonminesco.com/6502primer/SPI.ASM (and it's linked in the 6502 primer).

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Wed Jun 28, 2023 6:36 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
Yuri wrote:
So I’ve got what is starting to look like an actual circuit going, and before I get too deep into the weeds with this, I’d like to solicit some feedback to make sure I’m not doing anything crazy with this hardware...

I’ll add a little to the overall commotion.  :D

  1. Your RDY series diode (D2) is not a good choice, due to its forward drop and relatively slow recovery time.  Even if the cathode of D2 is grounded, RDY may not go low enough for the MPU to respond.  I recommend you use an SD103A or similar (see attached), which is a small-signal Schottky diode with half the forward drop of the 1N4001 (and much faster recovery time).

    Attachment:
    File comment: SD103-Series Schottky Diode
    sd103_series_vishay.pdf [79.84 KiB]
    Downloaded 37 times

  2. While on the subject of the RDY circuit, I recommend you use the lowest pull-up resistance value consistent with the driving capabilities of whatever device will be controlling RDY.  The lower the resistance, the quicker RDY will return to the quiescent state after the wait-state period has expired, lessening potential timing headaches.

  3. Your Ø2 clock generator doesn’t need all those flops.  Also, 74HC logic is not a good choice for clock generation, due to the somewhat sedate edges.  WDC requires that the maximum rise/fall time of Ø2 not exceed 5ns, regardless of actual clock frequency.

    I recommend you use a 74AC74, whose Q outputs have the required fast edges.  As fast edges can cause ringing problems, the AC74’s output should be connected to the Ø2 circuit through a series resistor in the range of 100 to 150 ohms.  That resistor should be as physically close to the AC74’s output as possible.  Series resistance will help dampen ringing, especially undershoot on the high-going phase, which if sufficiently severe, has the potential to look like a double clock to the MPU.

  4. The pull-down resistors on the address bus is unnecessary and in fact, may be detrimental.  The 65C02 *always* drives A0-A15 high or low, unless BE is driven low.  You’ve got BE permanently pulled high, so A0-A15 will never float in your system.

  5. Similarly, the pull-down resistors on D0-D7 are unnecessary.  The data bus will not float if BE is high during a write cycle.  The data bus will be hi-Z during a read cycle, but some other device would/should be driving D0-D7 in that case.  If you are, for some reason, paranoid that D0-D7 will float and cause trouble, use pull-ups, not pull-downs.

  6. As flooby noted, your reset circuit is much too complicated.  A variety of devices, e.g., the Maxim DS1813, exist to handle this requirement.  Don’t use a battleship to sink a rowboat.  :D

  7. Also as flooby noted, the reset connection of the DS1511Y is open collector and does not respond to a pushbutton.  The 1511’s reset output is meant to be used under software control, usually by the device’s watchdog timer, to reset the MPU in the event of a crash.  I recommend you pull that reset pin up to VCC through a suitable resistor and ignore it.

  8. Diode D1 is superfluous.  In fact, unless you plan to use the DS1511Y to generate IRQs, don’t bother with connecting its IRQ output.

  9. Further to another of flooby’s recommendations, simplify your power supply.  I use a PC power supply to run my POC units, but then, I also have some hard disks and a CD drive hooked up to the system.  So I need the 12 VDC output and the amps that go with it.  Your unit won’t be all that power-hungry and will only need 5 volts to run everything.

  10. The 16550 UART is not a good choice, in my opinion, as it has a hardware defect that prevents the receiver FIFO from working as it should.  If you are going to use the 165xx series, at least use the 16550A or newer.  As you will soon discover, the 165xx UARTs can be a pain in the derrière to program.  :D

    A better choice would be the NXP 26C92, 28L92 (obsolete but still available in some places) or the equivalent Exar 88C92.  These devices are dual UARTs will a friendlier design and features that are lacking in the 165xx series.

  11. Lastly, and as noted by flooby, D3 is superfluous.  The 65C22N has an open collector IRQ output.  Just connect it to the IRQB input on the MPU.  If you instead use the 65C22S (recommended), then you will need D3 (correctly oriented), which should be a Schottky, such as the SD103A I earlier mentioned.

As Garth recommended, you should study his 6502 primer from start to finish.

Proxy wrote:
Eh I wouldn’t recommend clock stretching on a 65C02 as it requires extra circuitry and you already have a CPLD that you could use to drive the RDY pin with (through resistor of course as RDY is bidirectional)

The resistor wouldn’t be necessary, since he has a blocking diode in the RDY circuit, which is actually better.

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


Last edited by BigDumbDinosaur on Tue Apr 16, 2024 7:52 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Fri Jun 30, 2023 1:10 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
Wow,

Lots to unpack. Thanks for the feedback guys! :)

BigDumbDinosaur wrote:
As Garth recommended, you should study his 6502 primer from start to finish.


I know I've at least seen parts of it, though knowing my scatterbrained nature I likely missed/skipped parts that were pertinent.


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Sat Jul 15, 2023 5:06 am 
Offline
User avatar

Joined: Tue Feb 28, 2023 11:39 pm
Posts: 257
Location: Texas
Okay, think if I continue to stare at this any longer I might go cross eyed. XD

Anyhow, revised (a lot)

Still think I need more around the DMA/RDY pin. (Or am I just over thinking it again?)

Things done:
  • Split things up into different pages
  • Diodes replaced/fixed
  • Removed the 1502 in favor of a pair of ATF16V8Cs (figured out how to do this without chaining them together)*
  • Removed the LCD and '138 on the 65C22 and replaced with a generic IDC.
  • Replaced the 65C02 PLCC package.
  • 65C22N replaced with 65C22S.
  • Removed a bunch of the pull down resistors.
  • Removed ATX power connector & circuitry.
  • Added a debounced button on the NMI line.
  • Brought back my debugging clock.

* Yes I know, there's still a 1502 in there, I'm considering using it as a PIC controller. I'm still on the fence about this idea though. I may just replace it with some AND gates; just think it could be handy to have some edge level interrupts.

Still not 100% on that JTAG connector, I find so many different conflicting pin outs for it. >_<


Addressing some specifics from BDD's post:

BigDumbDinosaur wrote:
I’ll add a little to the overall commotion. :D

[list=1][*]Your RDY series diode (D2) is not a good choice, due to its forward drop and relatively slow recovery time. Even if the cathode of D2 is grounded, RDY may not go low enough for the MPU to respond. I recommend you use an SD103A or similar (see attached), which is a small-signal Schottky diode with half the forward drop of the 1N4001 (and much faster recovery time).


I figured there was a lot more to this, which falls into the category of analog circuitry, of which I know very VERY little. I figured I was going to sit down and find formulas for this or something, but I wasn't sure what to look for.

I did a bit of reading on this and I can see that yes Schottkys are faster due to a thinner P junction? (Do I have that right? *much confusion*)

I'd like to learn more about this so I can make better decisions on this in the future.

Quote:
[*]While on the subject of the RDY circuit, I recommend you use the lowest pull-up resistance value consistent with the driving capabilities of whatever device will be controlling RDY. The lower the resistance, the quicker RDY will return to the quiescent state after the wait-state period has expired, lessening potential timing headaches.


I'm using 3.3K as that is what I have on hand at the moment, finding other values of course is not a problem; but like the above, I don't know how one goes about finding good values for this.

(Digital logic I get, analog, not so much)

Quote:
[*]Your Ø2 clock generator doesn’t need all those flops. Also, 74HC logic is not a good choice for clock generation, due to the somewhat sedate edges. WDC requires that the maximum rise/fall time of Ø2 not exceed 5ns, regardless of actual clock frequency.

I recommend you use a 74AC74, whose Q outputs have the required fast edges. As fast edges can cause ringing problems, the AC74’s output should be connected to the Ø2 circuit through a series resistor in the range of 100 to 150 ohms. That resistor should be as physically close to the AC74’s output as possible. Series resistance will help dampen ringing, especially undershoot on the high-going phase, which if sufficiently severe, has the potential to look like a double clock to the MPU.


I've replaced this ultimately with an 74AC74 and a single ATF16V8C. I did double check the rise/fall times of the 16V8C, it should be within the 5ns period. Thanks for pointing this out to me, I'll be sure to keep that in mind going forward.

Quote:
[*]The pull-down resistors on the address bus is unnecessary and in fact, may be detrimental. The 65C02 *always* drives A0-A15 high or low, unless BE is driven low. You’ve got BE permanently pulled high, so A0-A15 will never float in your system.

[*]Similarly, the pull-down resistors on D0-D7 are unnecessary. The data bus will not float if BE is high during a write cycle. The data bus will be hi-Z during a read cycle, but some other device would/should be driving D0-D7 in that case. If you are, for some reason, paranoid that D0-D7 will float and cause trouble, use pull-ups, not pull-downs.


Removed, though replaced with some 74AC245s* (I'll get into these in a bit)

I have started to implement the BE/RDY pins so I can later try and develop a DMA for this system.

Quote:
[*]As flooby noted, your reset circuit is much too complicated. A variety of devices, e.g., the Maxim DS1813, exist to handle this requirement. Don’t use a battleship to sink a rowboat. :D


I was using a DS1813, and I replaced it with the DS1511. The reasoning was fairly simple, I added the DS1511 to get a real time clock, when I realized it had a reset circuit built in, I didn't feel it made sense to keep the DS1813 AND the DS1511 around. The extra flops are/where to count out clock cycles; general indication is this is over kill so I've removed these.

I'd still like to tie the DS1511 into the reset circuit somehow, the watchdog timer in the datasheet looks like it could be very handy if my code should ever hang; I'll consider more about this.

I'm also considering if it would be worth while adding some sort of counter (e.g. a second 65C22) off the square wave as a high resolution timer.

Quote:
[*]Also as flooby noted, the reset connection of the DS1511Y is open collector and does not respond to a pushbutton. The 1511’s reset output is meant to be used under software control, usually by the device’s watchdog timer, to reset the MPU in the event of a crash. I recommend you pull that reset pin up to VCC through a suitable resistor and ignore it.


Yep, bad thinking on my part, removed.

Quote:
[*]Diode D1 is superfluous. In fact, unless you plan to use the DS1511Y to generate IRQs, don’t bother with connecting its IRQ output.


Not sure if I will or not, I might; going to go ahead and connect it to the interrupt line for now, and If I need to remove it later I can just break the trace (or use a jumper, which I think is what flooby recommended)

Quote:
[*]Further to another of flooby’s recommendations, simplify your power supply. I use a PC power supply to run my POC units, but then, I also have some hard disks and a CD drive hooked up to the system. So I need the 12 VDC output and the amps that go with it. Your unit won’t be all that power-hungry and will only need 5 volts to run everything.


I've removed the ATX power connector; I will point out though that I was considering the idea of connecting an old IDE DVD drive to act as a CD-ROM. That will likely wait until I start moving into the 65816 though.

Quote:
[*]The 16550 UART is not a good choice, in my opinion, as it has a hardware defect that prevents the receiver FIFO from working as it should. If you are going to use the 165xx series, at least use the 16550A or newer. As you will soon discover, the 165xx UARTs can be a pain in the derrière to program. :D

A better choice would be the NXP 26C92, 28L92 (obsolete but still available in some places) or the equivalent Exar 88C92. These devices are dual UARTs will a friendlier design and features that are lacking in the 165xx series.


D'OH! I didn't catch that, the original drawing is not correct, I'm using a 16C550C. I forgot to change the numbers in my drawing, fixed.

I also ditched the MAX per flooby's suggestion.

Quote:
As Garth recommended, you should study his 6502 primer from start to finish.


I've re-read this. I hope I didn't miss any of the finer points, time will tell.

I have added some 245s for the bus, which I'm sure someone will probably call me out on. I know the primer suggested NOT adding these because why would you want to add more gate delays; but I'm not sure what else I plan on connecting in the future and I imagine I can only drive the pins off the 6502 so far.

Quote:
Proxy wrote:
Eh I wouldn't recommend clock stretching on a 65C02 as it requires extra circuitry and you already have a CPLD that you could use to drive the RDY pin with (through resistor of course as RDY is bidirectional)

The resistor wouldn’t be necessary, since he has a blocking diode in the RDY circuit, which is actually better.[/color]


Clock stretching or using RDY pin for a delay, either way; sounds like the ready pin is the easier route, so I'll work on that adding that next.


Attached is the updated PDF. As before this is a living document so I expect I'll be changing it again before long.

Thanks for the feedback guys! It's been very helpful.


Attachments:
6502_Mk1.pdf [1.48 MiB]
Downloaded 39 times
Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Sat Jul 15, 2023 5:17 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Yuri wrote:
I have added some 245s for the bus, which I'm sure someone will probably call me out on.  I know the primer suggested NOT adding these because why would you want to add more gate delays; but I'm not sure what else I plan on connecting in the future and I imagine I can only drive the pins off the 6502 so far.

WDC's outputs on the '02S and '22S are really strong—much much stronger than the data sheet lets on, according to my tests.  They don't need any help like the NMOS 6502s of yore did.  Depending on what kind of '245 you were thinking of adding, you might find that it's weaker than the W65C02S's outputs are.

_________________
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?


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Sat Jul 15, 2023 9:45 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8504
Location: Midwestern USA
Yuri wrote:
Okay, think if I continue to stare at this any longer I might go cross eyed. XD

To quote something I wrote in my previous reply, “Diode D1 is superfluous.”

Quote:
Still think I need more around the DMA/RDY pin. (Or am I just over thinking it again?)

I think your design is too complicated for a first try.

Quote:
Removed the 1502 in favor of a pair of ATF16V8Cs (figured out how to do this without chaining them together)*

Why? A single 1504 CPLD makes more sense. As you have it, you’ve got the potential for a timing race with the two GALs. There is no guarantee the two will have the same pin-to-pin prop time.

Quote:
Still not 100% on that JTAG connector, I find so many different conflicting pin outs for it. >_<

There is no industry-standard pinout for a JTAG connector. However, most CPLD vendors have used a 10-pin header on their programming rigs with a consistent pinnout. Here’s what Atmel uses with their programming rigs:

  1. TCK — Clock
  2. GND — Ground
  3. TDO — Data Out
  4. VCC — Power In
  5. TMS — Test Mode Select
  6. NC — No Connect
  7. NC — No Connect
  8. NC — No Connect
  9. TDI — Data Input Signal
  10. GND — Ground

The connector is a standard, 10-pin shrouded header, keyed to prevent wrong-way insertion.

Attachment:
File comment: JTAG Port Header
pocv2_jtag_port.gif
pocv2_jtag_port.gif [ 251.25 KiB | Viewed 1708 times ]

TCK, TDI and TMS should be pulled up to VCC with 4.7K resistors. Both grounds must be connected and the VCC connection should be bypassed with a 0.1µF MLCC in parallel with a 100µF low-ESR electrolytic, with both capacitors as physically close to the header as possible.

Quote:
Quote:
Your Ø2 clock generator doesn’t need all those flops...

I've replaced this ultimately with an 74AC74 and a single ATF16V8C. I did double check the rise/fall times of the 16V8C, it should be within the 5ns period. Thanks for pointing this out to me, I'll be sure to keep that in mind going forward.

Using the output of a GAL to clock the MPU is not a good idea. GALs produce TTL-level outputs, with a theoretical maximum VOH of 3.4 volts in a five volt system. WDC MPUs require CMOS levels on their clock inputs, with VIH being a minimum of 3.5 volts in a five volt system. Your machine might work with a GAL driving Ø2, but will likely be unstable.

Quote:
Quote:
Similarly, the pull-down resistors on D0-D7 are unnecessary...

Removed, though replaced with some 74AC245s* (I'll get into these in a bit)

Se Garth’s comment about the need for bus drivers. Once again, you are making it unnecessarily complicated, in my opinion.

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


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Sat Jul 15, 2023 10:36 pm 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
BigDumbDinosaur wrote:
Quote:
Removed the 1502 in favor of a pair of ATF16V8Cs (figured out how to do this without chaining them together)*

Why? A single 1504 CPLD makes more sense. As you have it, you’ve got the potential for a timing race with the two GALs. There is no guarantee the two will have the same pin-to-pin prop time.
Wired as they are, I don't see why it would matter if the two ATF16V8Cs happen to differ in pin-to-pin prop time. Yuri's circuit would be equally valid using discrete logic in place of the PLD(s)... and even in that scenario I don't see any cause for concern about a timing race.

Not that I'm arguing against the 1502. There are pros and cons to both approaches. For example, board area and component cost/availability are legitimate factors that could sway the decision one way or the other.

-- Jeff

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
 Post subject: Re: Looking for Feedback
PostPosted: Sat Jul 15, 2023 11:11 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
just to throw my 2 cents in, i have never had any external pull-ups on my JTAG lines. i've always just relied in the internal pull-ups that the ATF150x CPLDs have and it seems to be working perfectly fine.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 45 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:  
cron