6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sun Nov 24, 2024 3:18 am

All times are UTC




Post new topic Reply to topic  [ 29 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Tue Mar 28, 2023 4:06 am 
Offline

Joined: Sun Mar 19, 2023 2:04 pm
Posts: 137
Location: about an hour outside of Springfield
reading the board, wikipedia and GARTHWILSON's detailed works, especially here:
http://wilsonminesco.com/6502primer/IO_ICs.html
the existing datasheets and other sources I have more questions than answers.
we are primarily interested in current production chips

all of these chips in CMOS versions are at least:
Static to 14MHz and Bus compatible with 14 MHz W65C02S and W65C816S
Static to means it can stop and hold its state and be stable 'up to 14MHz',
and it is able to share a bus with 65xx cpus okay.
come in a 40 Pin Plastic Dip and can run on a 5V Power Supply
It can fit on a breadboard and use 5v rails.


______________________________________________________________________________________________
6521 PIA
https://www.westerndesigncenter.com/wdc/w65c21-chip.php
https://www.wdc65xx.com/wdc/documentation/w65c21s.pdf
https://en.wikipedia.org/wiki/WDC_65C21

Features:
2 x 8−bit bidirectional I/O ports with individual data direction control
Automatic "Handshake" control of data transfers
2 Interrupt outputs with program control

so there seems to be very little use of this or projects employing it. I read "two 8-bit parallel ports". This lends me to think of this as an 8 or 16 bit mono- or bi-directional parallel port, and in my head, that says 'printer port' though I know this is not the same thing as an IEEE 1284 port/cable/whatsit. (20 years since I needed to know that.) There is a shortage of usage of this circuit which seems to require a lot of extra support hardware, like timers?

so, the PIA also looks to be the oldest of the chips in this set, and mostly not so great, it seems like the VIA chip, it's successor is better in everyway, except the 6522 has a bug in it. In fact, although his chip has no timers or other features, it also is seems to be "bug free".

This chip will at least need timer circuitry and maybe latches to start doing what other chips can do. Is there any practical reason to employ the PIA '21?

personal note wrote:
I have located a small LCD module that is 1/5th my later display size, with 4 bit gray. It uses an ST7528P, which seems to be in either 8080 or 6800 parallel modes. very interesting.

______________________________________________________________________________________________
6522 VIA
https://www.westerndesigncenter.com/wdc/w65c22-chip.php
https://www.westerndesigncenter.com/wdc ... 65c51n.pdf
https://en.wikipedia.org/wiki/WDC_65C22

this seems a little newer and has the same features as the 6521, except it also has timers,
some handshake/syncing functions, is explicitly 8 and 16 bit, has Latches on its I/O, can work
with TTL circuits, and it can run on variable voltages.
2 x 8−bit, bi−directional peripheral I/O Ports
2 x 16−bit programmable Interval Timer/Counters
Synchronous Serial bi−directional peripheral I/O Port
Enhanced "Handshake" feature works with either 8− or 8/16−bit systems
Latched Input/Output Registers on both I/O Ports
Programmable Data Direction Registers
TTL compatible I/O peripheral lines
1.8V(W65C22S only) − 5V Power Supply

Quite impressive indeed, except that...
it has a bug in two of its serial modes, see here: http://forum.6502.org/viewtopic.php?p=2310#p2310
Now from what I am reading, this can be resolved with a tiny flip-flop and running to the clock pin on the cpu...
the datasheet says for the cmos version, you need resistors, so, you will need as much or more support hardware here, as with the '21 PIA. However, this seems to be a 'workhorse chip' on many designs and possibly worth the extra effort, it truly is a versatile chip.
However, we still have not explored the 6551 chip, the more advanced comms chip in the family.


Comparison of 6521 and 6522 chips:

Attachment:
image.png
image.png [ 224.54 KiB | Viewed 20943 times ]

______________________________________________________________________________________________
6551 ACIA
https://en.wikipedia.org/wiki/WDC_65C51
https://www.westerndesigncenter.com/wdc ... n-chip.php
https://www.westerndesigncenter.com/wdc ... 65c51n.pdf

these seem to be the most powerful of the chips available, until you take a closer look and realize it does not have parallel transmit line per se, it has modem control functions and is basically serial only.

Full duplex operation with buffered receiver and transmitter
Data set/modem control functions
Internal baud rate generator with 15 programmable baud rates (50 to 19,200)
Program−selectable internally or externally controlled receiver rate
Programmable word lengths, number of stop bits and parity bit generation and detection
Programmable interrupt control
Program reset
Program−selectable serial echo mode
2 Chip Selects

So this chip is not more or less powerful than the other two, it actually does different things. It is basically a very low level modem/modem controller and seems really very gear towards the RS-xxx series of protocols, and could be used for several others.
I am uncertain what this chip can really do alone, though coupled with a 6522, it seems very versatile at sending and receiving data.

It appears this chip as well has some hardware errors and may need workarounds or a recall.

https://github.com/andrew-jacobs/w65c81 ... 6sxb.inc-1

______________________________________________________________________________________________

Beyond this are many other options for CPU I.O that are not in the 65xx family of ICs.
We will explore these and the primary protocols in use todays and start identifying possible choices in our next post.

Any errata , corrections or other info in replies will be consolidated here or below.


Last edited by wayfarer on Tue Mar 28, 2023 4:10 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 28, 2023 4:06 am 
Offline

Joined: Sun Mar 19, 2023 2:04 pm
Posts: 137
Location: about an hour outside of Springfield
Reserved for UART and MCU choices...


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 28, 2023 5:25 am 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
wayfarer wrote:
Static to means it can stop and hold its state and be stable 'up to 14MHz'

"Static" means that regardless of its maximum speed, you can slow it down all the way to a stop at it won't lose its internal states.  The original NMOS 6502 had things that held their state just by the circuit capacitance which would get discharged by leakage if they were neglected for too long.  The NMOS 6502's minimum guaranteed operating speed was 100kHz, definitely not static.  I don't know how some of the NMOS peripheral ICs compared, but I suspect they had the same technology in them.

Quote:
Is there any practical reason to employ the PIA '21?

I think it's mainly there for continuity with legacy systems.  For any new designs, I would recommend the '22 over the '21 (or the '20).

Quote:
6522 VIA
this seems a little newer and has the same features as the 6521, except it also has timers,
some handshake/syncing functions, is explicitly 8 and 16 bit, has Latches on its I/O, can work
with TTL circuits, and it can run on variable voltages.
2 x 8−bit, bi−directional peripheral I/O Ports
2 x 16−bit programmable Interval Timer/Counters
Synchronous Serial bi−directional peripheral I/O Port
Enhanced "Handshake" feature works with either 8− or 8/16−bit systems
Latched Input/Output Registers on both I/O Ports
Programmable Data Direction Registers
TTL compatible I/O peripheral lines
1.8V(W65C22S only) − 5V Power Supply

Quite impressive indeed, except that...
it has a bug in two of its serial modes, see here: http://forum.6502.org/viewtopic.php?p=2310#p2310
Now from what I am reading, this can be resolved with a tiny flip-flop and running to the clock pin on the cpu...

Most users won't be affected by the bug.  There is that solution though if you need it.  The other five modes of that serial port work correctly, with no work-arounds.  The '21 doesn't have that serial port anyway, so this cannot be considered a disadvantage of the '22 compared to the '21.

Quote:
the datasheet says for the cmos version, you need resistors, so, you will need as much or more support hardware here, as with the '21 PIA.

I've never had an application where the resistors were needed.  I think what it comes down to is that the N version has the more-limited current output of the old NMOS and of LSTTL logic, whereas the S version can supply a lot more current if you need it.  It's really pointing out a disadvantage of the older version, not the W65C22S.

Quote:
Comparison of 6521 and 6522 chips:

The 65c22 has some major advantages over the '21.  A disadvantage the '21 PIA has compared to the '22 VIA is that access to the data-direction registers on the PIA is only indirect, requiring more instructions, making it pretty clumsy to emulate open-drain outputs when needed.  The way to to it is to set the output register's bit to a 0 and then change the data direction, so that even in "output" mode, sending a 1 is accomplished by making the pin an input so the external pull-up resistor can bring the line up.  (The output register bit is left as 0.)  This is valuable for example when bit-banging an I²C or PC-keyboard interface.  The 65c22 VIA is much more efficient at this.

Quote:
6551 ACIA
[...] So this chip is not more or less powerful than the other two, it actually does different things. It is basically a very low level modem/modem controller and seems really very gear towards the RS-xxx series of protocols, and could be used for several others.
I am uncertain what this chip can really do alone, though coupled with a 6522, it seems very versatile at sending and receiving data.

The '51 is an entirely different kind of I/O IC.  It is a UART, not intended to be a parallel port, or timers, or synchronous-serial port, or anything else.  You can use it by itself for TTL-level asynchronous serial, or connect the appropriate line drivers and receivers for RS-232, RS-422, or RS-485.  It can do other speeds besides what you listed, by using the 16x clock function.  I use it to program our bluetooth modules at work at 115,200bps using its option to divide the 1.8432MHz input by 16 to get the bit clock.  I've also used it for MIDI at 31.25kbps by running a 500kHz square wave into that input from a '22 VIA's PB7 toggling from a free-running T1.

Quote:
It appears this chip as well has some hardware errors and may need workarounds or a recall.

Traditionally, it has been the 6551 or 65c51 (ie, CMOS version) that have been put on the 6502's bus to get asynchronous serial communication.  I've used the 65c51 for decades and never had any trouble with it.  I could wish that a couple of the functions had been separated rather than being controlled by the same bit in the command register; but it hasn't been any real problem in my applications, and separating them would have required adding another register-select pin.  The WDC W65C51 (which I have not used, but it's the only one still in production) has a serious bug in that the transmit-register-empty flag in the status register makes it look like it's always ready to accept another byte when you're transmitting.  There are ways around it, including ways that are better than just doing a software delay loop.  However, these, and possibly the absence of FIFOs (First-In, First-Out, multi-byte buffers) for transmit and receive [1], have caused it to fall out of favor, and other UARTs to become more popular.  One of those has been the 28L92, which unfortunately has recently been discontinued—see viewtopic.php?f=4&t=7289 —but the topic gives alternatives that are partially compatible.

One UART I've exercised but not put to serious use yet is the 16-pin MAX3100 SPI-interfaced one that's available in a 14-pin DIP.  So instead of

    6502  -->  6551 ACIA  -->  line drivers & receivers  -->  RS-232 (TIA-232)

you'd have (assuming you big-bang the SPI with a 6522):

    6502  -->  6522 VIA  -->  (via SPI)  -->  MAX3100 UART  -->  line drivers & receivers  -->  RS-232 (TIA-232)

(or different line drivers and receivers can get you to RS-422 or -485; or you can forgo the line drivers and receivers altogether if you just want TTL-level serial).

It may initially seem pointless to go through a serial interface to get to an IC that gives you another serial interface.  SPI however is synchronous serial, not asynchronous serial, so it is much, much easier to bit-bang, not having any timing requirements, let alone stringent ones like RS-232 has.  Further, if you have SPI, you can simultaneously connect many other things to it as well, and there are hundreds, if not thousands, of ICs on the market that interface through SPI, for example A/D and D/A converters, flash memories, USB interfaces, programmable-gain amplifiers, signal generators, GPIO, etc..  There's sample working code to bit-bang SPI with a VIA, on my site.


[1] I don't particularly think of the lack of a FIFO in the '51 to be a problem, because the 6502 has such good interrupt performance, and the interrupt overhead you have to go through for each byte received or transmitted is minimal, unlike the situation with many other processors that truly need the UART to have FIFOs.

_________________
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  
PostPosted: Tue Mar 28, 2023 4:06 pm 
Offline

Joined: Sun Mar 19, 2023 2:04 pm
Posts: 137
Location: about an hour outside of Springfield
GARTHWILSON wrote:
wayfarer wrote:
Static to means it can stop and hold its state and be stable 'up to 14MHz'
"Static" means that regardless of its maximum speed, you can slow it down all the way to a stop at it won't lose its internal states.  ...

Okay, so just to double check, you can run the 6502, 65816, 6521, 6522 and 6551 at ANY clock speed, from zero to single-step, to sub-1 Hz, to any other X Hz, upto the rated 14MHz (and beyond!) and it will function normally, 'pause' and go into low power mode, and resume when restarted. correct?

Quote:
Is there any practical reason to employ the PIA '21?
I think it's mainly there for continuity with legacy systems.  For any new designs, I would recommend the '22 over the '21 (or the '20).

I was considering it because it is so simple. I really need "One Chip" besides the 6502/816 to act as a low level Comms unit to 'everything else'. Because the 6522 needs a little support hardware, I was thinking okay, well maybe the 6521 can use about the same and do what I need. In my case, and it will not be the same for everyone, most of my I/O and support hardware is in a Super-I/O-like chip, the main board controller. However, I still want to be able to flip a bit and use the CPU for interdevice communication without using that chip. So...

Quote:
6522 VIA...
Most users won't be affected by the bug.  There is that solution though if you need it.  The other five modes of that serial port work correctly, with no work-arounds.  The '21 doesn't have that serial port anyway, so this cannot be considered a disadvantage of the '22 compared to the '21.


Once I got the function blocks up side by side, you can really see how the 6522 is the improved version of the 6521. I am of the impression you would need several ICs to get the extra function of the '22 on top of the '21. Even with needing the flip-flop or resistors or whatever, its still a very small amount of board space for 'the other half' of a 6502/816.

Are there any alternatives to the 6522 that provide like functionality?

Quote:
the datasheet says for the cmos version, you need resistors, so, you will need as much or more support hardware here, as with the '21 PIA.
I've never had an application where the resistors were needed.  I think what it comes down to is that the N version has the more-limited current output of the old NMOS and of LSTTL logic, whereas the S version can supply a lot more current if you need it.  It's really pointing out a disadvantage of the older version, not the W65C22S.


Im basically only going to use the CMOS stuff myself. Its what I can have sent to a place and have put on a board.


Quote:
Comparison of 6521 and 6522 chips:
The 65c22 has some major advantages over the '21.  ...  The 65c22 VIA is much more efficient at this.


Understood, agreed. : :)
Quote:
6551 ACIA
[...] So this chip is not more or less powerful than the other two, it actually does different things... coupled with a 6522, it seems very versatile at sending and receiving data.

Quote:
The '51 is an entirely different kind of I/O IC.  It is a UART, not intended to be a parallel port, or timers, or synchronous-serial port, or anything else.  You can use it by itself for TTL-level asynchronous serial, or connect the appropriate line drivers and receivers for RS-232, RS-422, or RS-485.  It can do other speeds besides what you listed, by using the 16x clock function.  I use it to program our bluetooth modules at work at 115,200bps using its option to divide the 1.8432MHz input by 16 to get the bit clock.  I've also used it for MIDI at 31.25kbps by running a 500kHz square wave into that input from a '22 VIA's PB7 toggling from a free-running T1.


Okay, so is it just a UART? Im not sure I want one of these on my board, Im not sure I dont. I am going to be doing the vast majority of my communication using a dedicated board controller of some type, leaving my CPU to work. again, I do want 'direct CPU access' to as much as possible. I am greatly interested in having the "Industrial Protocols" supported, one of the RS-4xx series look really appealing, and RS-232 is pretty ubiquitous. I am not certain I want it in the core device. These can go on the 'industrial and scientific' module that has probes and can flash ROMs in other machines or whatever. Not to delve too much into my own needs,

I do want SPI and I2C. I am uncertain I need much more than this... it will be determined as work proceeds. So far, SPI, parallel, I2C and 'serial' or USB seem to be most common, I have some 6800/8080 stuff Im looking at.

Quote:
It appears this chip as well has some hardware errors and may need workarounds or a recall.
Traditionally, it has been the 6551 or 65c51 (ie, CMOS version) that have been put on the 6502's bus to get asynchronous serial communication.  ...  The WDC W65C51 (which I have not used, but it's the only one still in production) has a serious bug in that the transmit-register-empty flag ... these, and possibly the absence of FIFOs ... have caused it to fall out of favor, and other UARTs to become more popular.  ...
One UART I've exercised but not put to serious use yet is the 16-pin ... MAX3100 in a 14-pin DIP.  So instead of

    6502  -->  6551 ACIA  -->  line drivers & receivers  -->  RS-232 (TIA-232)

you'd have (assuming you big-bang the SPI with a 6522):

    6502  -->  6522 VIA  -->  (via SPI)  -->  MAX3100 UART  -->  line drivers & receivers  -->  RS-232 (TIA-232)

(or different line drivers and receivers can get you to RS-422 or -485; or you can forgo the line drivers and receivers altogether if you just want TTL-level serial).


So to be clear, the 6522 does give you SPI and I2C on it's own?
you only need a UART or 6551 for things like modems, rs-232 etc?

Quote:
It may initially seem pointless to go through a serial interface to get to an IC that gives you another serial interface.  SPI however is synchronous serial, not asynchronous serial, so it is much, much easier to bit-bang, not having any timing requirements, let alone stringent ones like RS-232 has.  Further, if you have SPI, you can simultaneously connect many other things to it as well, and there are hundreds, if not thousands, of ICs on the market that interface through SPI, for example A/D and D/A converters, flash memories, USB interfaces, programmable-gain amplifiers, signal generators, GPIO, etc..  There's sample working code to bit-bang SPI with a VIA, on my site.

It looks like the 6522 is a pretty "Must Have" chip for 65xx based design.
Quote:
[1] I don't particularly think of the lack of a FIFO in the '51 to be a problem, because the 6502 has such good interrupt performance, and the interrupt overhead you have to go through for each byte received or transmitted is minimal, unlike the situation with many other processors that truly need the UART to have FIFOs.[/color]

I am going to have a gpu running 60MHz, maybe another controller, so it might be nice to have the FIFO, I am leaning more and more towards using another UART, only using the UART on the board controller, or having UARTt communication on another module if it is not required on the main system.

Are there low level SPI/I2C/Microwire/etc controller chips available today, that are alternatives to the 6522?
My follow up post above is to go over alternative UARTS and other chips in this series.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 28, 2023 4:38 pm 
Offline
User avatar

Joined: Fri Aug 03, 2018 8:52 am
Posts: 746
Location: Germany
wayfarer wrote:
So to be clear, the 6522 does give you SPI and I2C on it's own?

the 6522 doesn't have hardware SPI or I2C as the datsheet never mentions that.
but anything can become an SPI/I2C controller if it has programmable IO pins, which the 6522 has. so you just have to implement the interfaces in software.
the advantage is that you safe yourself the need for dedicated hardware taking up space on a PCB and making the design more complicated.
the obvious disadvantage is the speed, but i honestly can't really think of any SPI/I2C devices that would benefit from a high bandwidth anyways (except for a Co-Processor or something Graphics related).

wayfarer wrote:
It looks like the 6522 is a pretty "Must Have" chip for 65xx based design.

i found that to be pretty true. i still reget not including one in my very first 65C02 SBC.

and honestly for what you have planned i'd almost recommend having 2 VIAs (if you don't want to use the PIC as a SPI/I2C/UART controller).
one VIA would be for SPI/I2C and other onboard signals you might have, and the other would be solely for User IO, so people get 16 GPIO Pins to connect and experiment with anything they want.

sorry i didn't answer everything from your post... but that was the part i thought i could comment on the best


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 28, 2023 5:24 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
As for the 65C22, I don't find it to be a "must have" chip for any 65xx system.

The last system I designed using a 65C22 was about 10 years ago. The 16-bit timers can be useful, but it all depends on how you intend to use them. As they are strictly tied to the CPU clock, the faster the CPU speed, the less useful they can become, depending on the usage. As for the dual 8-bit I/O ports, that again, depends on what you intend to use them for. Typical uses include a matrix keyboard, parallel printer port, LCD display, SPI/SD-Card interface, etc.

I dropped the W65C51 years ago after I discovered the xmit status bit being stuck. Bottom line, I can't ever see this being fixed. I went to the NXP DUARTS (BDD's insistence paid off) which are significantly better, faster and more flexible. Having a 16-bit timer that syncs to the baud clock input makes this an easy jiffy clock regardless of the CPU clock speed. There's some I/O as well, but not as many or as flexible as the 6522.

My current 65C02 system doesn't have any 6522 VIAs... yet it has dual serial ports (one for console and one for additional communications), some input and output pins which are free to use, a 10ms jiffy clock for RTC, delay and benchmark timings. All of that is handled by one chip (28L92). There's also a Maxim realtime clock and a 16-bit IDE interface for storage. If needed, I can always add additional I/O, which could include VIAs or other devices.

I think it's a good idea to put some additional thought into what you intend to use your 8-bit creation for, before deciding what has to be part of it.

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


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 28, 2023 7:36 pm 
Offline

Joined: Sun Mar 19, 2023 2:04 pm
Posts: 137
Location: about an hour outside of Springfield
Proxy wrote:
wayfarer wrote:
So to be clear, the 6522 does give you SPI and I2C on it's own?
the 6522 doesn't have hardware SPI or I2C as the datsheet never mentions that.
... the obvious disadvantage is the speed, but i honestly can't really think of any SPI/I2C devices that would benefit from a high bandwidth anyways (except for a Co-Processor or something Graphics related).


so for my test bench, no worries, I am actually looking at a 60Mhz lcd driver/gpu, which is SPI driven. normally, its going to run code the PIC tells it to load and update things like draw layer for sprite positions. the cpu should only be sending brief occasional commands to the GPU, unless its in 'recovery mode' and may be clocked down or in low res graphics mode. so, it is possible this may be a use case, in mine it is, time on the bench and testing will say more.

wayfarer wrote:
It looks like the 6522 is a pretty "Must Have" chip for 65xx based design.

i found that to be pretty true. i still reget not including one in my very first 65C02 SBC.
...
sorry i didn't answer everything from your post... but that was the part i thought i could comment on the best


I am aiming to use the PIC or other controller for most I/O, most of the time. I think one should be okay for day to day operations, along with a 'duart' unit or similar for asynchronous support. Only in recovery mode will the system be directly running off of the cpu, and having a duart and 6522 on the board at all, is somewhat redundant, if the PIC24 and gpu and spu all function right.
However, for debugging, flashing ROMs and such, not using the PIC, to just turn it off, suspend it etc, and look around its registers, update the screen directly and look around the gpu or reload its drivers etc, configure peripherals over cables and ports, then having some other way of communicating is desirable. Much less for things do not need a dedicated MCU for their design, and this is as much for others as it is for me.

floobydust wrote:
As for the 65C22, I don't find it to be a "must have" chip for any 65xx system.

The last system I designed using a 65C22 was about 10 years ago. ...

I am very much interested in alternatives to the WDC 65xx chips. What alternatives for the 6521/22 do you propose?

Quote:
I dropped the W65C51 years ago after I discovered the xmit status bit being stuck. Bottom line, I can't ever see this being fixed. I went to the NXP DUARTS (BDD's insistence paid off) ...

What is driving/controlling those DUARTs?
"How?"

Quote:
My current 65C02 system doesn't have any 6522 VIAs... yet it has dual serial ports... All of that is handled by one chip (28L92).
aren't these gone now?
Quote:
There's also a Maxim realtime clock and a 16-bit IDE interface for storage. If needed, I can always add additional I/O, which could include VIAs or other devices. I think it's a good idea to put some additional thought into what you intend to use your 8-bit creation for, before deciding what has to be part of it.


absolutely, that is why I made this thread, to go over options, identify nuances and share alternatives and workarounds. I found almost noting on the PIA when I searched, and I am still reading the thread on DUART alternates. This thread is not just for my projects, its more information about these chips and alternatives for everyone.


Top
 Profile  
Reply with quote  
PostPosted: Tue Mar 28, 2023 8:38 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
wayfarer wrote:
Okay, so just to double check, you can run the 6502, 65816, 6521, 6522 and 6551 at ANY clock speed, from zero to single-step, to sub-1 Hz, to any other X Hz, upto the rated 14MHz (and beyond!) and it will function normally, 'pause' and go into low power mode, and resume when restarted. correct?

Right (as long as you put the C in there for "CMOS."  (The NMOS ones could not be stopped without losing their place.)  I understand there have been some processors, maybe the 68000, which would not run correctly a much below their intended speed; but 65Cxx parts can.

And about the '22 (without quoting):  The resistors you've mentioned a few times now are undesirable for most applications, regardless of whether you're using CMOS or not.  You don't need, or want, the resistors.  Just leave them out and connect it directly.  The only thing the '22 would need "support hardware" for is if you want to use its synchronous-serial port with an external clock, to overcome the bug in two of the seven modes of operation of that port.  That's not to say the '22 is a do-everything chip though.  It can do a lot, but it does not have hardware SPI or I²C or a PS/2 keyboard interface for example; those would have to be bit-banged.


Quote:
Are there any alternatives to the 6522 that provide like functionality?

There are lots of I/O ICs in other families as well, but they might not connect to the 6502/816 bus quite as conveniently as real 65xx I/O ICs.  You can also do various simple I/O operations with 74-family logic ICs.

Quote:
I do want SPI and I2C. I am uncertain I need much more than this... it will be determined as work proceeds. So far, SPI, parallel, I2C and 'serial' or USB seem to be most common, I have some 6800/8080 stuff Im looking at.

SPI can be much, much faster than I²C.  And if you have SPI, you can use a USB IC from Maxim that you interface to by SPI.  Note that the 6800 stuff will be quite slow.  My understanding (or misunderstanding, as the case may be) is that Motorola kind of abandoned that line in favor of the 68000, so the 6800 parts were left behind while the 6500 parts kept getting faster for quite a few more years.

Quote:
So to be clear, the 6522 does give you SPI and I2C on its own?

No; you'd have to bit-bang SPI or I²C, meaning twiddle individual I/O bits in software; but bit-banging them is very easy compared to bit-banging a UART, because there aren't any tight timing requirements, meaning you could even interrupt a transaction, and resume seamlessly when you get back to it.  I have sample bit-bang code on my site, for example http://wilsonminesco.com/6502primer/SPI.ASM and http://wilsonminesco.com/6502primer/GENRLI2C.ASM .

Quote:
Are there low-level SPI/I2C/Microwire/etc controller chips available today, that are alternatives to the 6522?

There's Daryl's 65SPI chip which is an honest-to-goodness 65-bus-compatible SPI that takes care of everything in hardware, done with a CPLD.  He doesn't sell pre-programmed ones anymore, but he provides the HDL code on his site, at the link.

_________________
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  
PostPosted: Tue Mar 28, 2023 8:42 pm 
Online
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8546
Location: Southern California
I forgot to mention WDC's FPGA-based microcontroller boards which aren't much bigger than a postage stamp, or at least the one Bill Mensch showed me wasn't, when we talked.  These do have hardware SPI and I²C and a lot of other stuff onboard.  See https://wdc65xx.com/fpga-microcontrollers/ .  I really don't know much about them beyond what's on that page.

_________________
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  
PostPosted: Tue Mar 28, 2023 10:42 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Quote:
floobydust wrote:
As for the 65C22, I don't find it to be a "must have" chip for any 65xx system.

The last system I designed using a 65C22 was about 10 years ago. ...

I am very much interested in alternatives to the WDC 65xx chips. What alternatives for the 6521/22 do you propose?

Quote:
I dropped the W65C51 years ago after I discovered the xmit status bit being stuck. Bottom line, I can't ever see this being fixed. I went to the NXP DUARTS (BDD's insistence paid off) ...

What is driving/controlling those DUARTs?
"How?"

Quote:
My current 65C02 system doesn't have any 6522 VIAs... yet it has dual serial ports... All of that is handled by one chip (28L92).
aren't these gone now?
Quote:
There's also a Maxim realtime clock and a 16-bit IDE interface for storage. If needed, I can always add additional I/O, which could include VIAs or other devices. I think it's a good idea to put some additional thought into what you intend to use your 8-bit creation for, before deciding what has to be part of it.


absolutely, that is why I made this thread, to go over options, identify nuances and share alternatives and workarounds. I found almost noting on the PIA when I searched, and I am still reading the thread on DUART alternates. This thread is not just for my projects, its more information about these chips and alternatives for everyone.


First, I'm not suggesting there are ANY chips that replace WDC chips such as the 65C22 and 65C21. If you need the functions they provide, just use them. I'm simply stating that the 6522 (all versions) is not a "must have" chip for a 65xx based system. You need to figure out what type of I/O you want or need to have for your specific project. Do you have a basic set of requirements for your first system?

The DUART, it's just a 2-channel serial controller. The BIOS for my C02 Pocket supports both channels with interrupt-driven receive and transmit. The C02 Monitor code uses the first channel as a text based console. A FTDI USB to serial adapter connects to one channel of the 28L92 which connects to a standard PC USB port and you use a standard terminal program to interface to the system.

NXP has announced end-of-life (EOL) for their SC28L92 DUART, but Texas Instruments has their TL29L92 part, identical function but the only package available is a 44-pin QFP.

You can take a look at my Github page and get all of the details for the C02 Pocket SBC and the RTC/CF Card adapter... schematics, PCB layouts, full software, etc. Sometimes it helps to see what some other folks have already done. But again, you need to have an idea as to what you want to do with your system... that will define what I/O devices you need and you can then move forward with an initial design as a starting point.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 29, 2023 4:15 am 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8514
Location: Midwestern USA
floobydust wrote:
As for the 65C22, I don't find it to be a "must have" chip for any 65xx system.

I have not used a 65C22 in anything I’ve built and have not had any reason to do so. The only likely application for me would be to implement a Centronics port. That said, most of the printers at my disposal have TIA-232 ports, so they could be directly connected to one of my POC units if I suddenly got an urge to print something.

Quote:
I dropped the W65C51 years ago after I discovered the xmit status bit being stuck...I went to the NXP DUARTS (BDD's insistence paid off) ...

<Grin>

Quote:
NXP has announced end-of-life (EOL) for their SC28L92 DUART, but Texas Instruments has their TL29L92 part, identical function but the only package available is a 44-pin QFP.

There are also the Exar equivalents. Exar offers the 88C92 in a PLCC-44 package, which is functionally like the NXP 26C92 when the latter is operated in x86 mode (recommended), same pinout, register layout, etc. Exar’s 88C192 is functionally identical to the 28L92 when the latter is operated in x86 mode. The 88C192 is available in QFP.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 29, 2023 1:37 pm 
Offline

Joined: Sun Mar 19, 2023 2:04 pm
Posts: 137
Location: about an hour outside of Springfield
So to be clear, when i have said "all you need is a 6522" to do SPI, and people are saying "you need to bit bang (program) the IC" and my response is "you have to do that to all of them, right?"

what I mean is, you do not need an extra timer, or a bunch of inverters for each data line, or any other support hardware.
and given statements about the FTDI USB to serial adapter, NXP DUART, and Ti equivalents, these too need programmed the same way a 6522 needs programmed, you have to give the CPU instructions to control and communicate with that chip.

Im going to go out on a limb and say it would be very inefficient, you could probably get a CPU to a lot of this stuff with logic chips and shift registers and latches, possibly even some simple things without them if the cpu was clocked right. I am not suggesting to do so, only that it could.
The purpose of these specialty chips is to simply and offload repetitive tasks so the cpu can centrally process as a unit.

regarding these DUART units, they are operating the same way the bench LCD Im getting does, in parallel communication mode, on the x86/8080 protocol, or the 6800 parallel protocol, rather than SPI, I2C etc. So in this, one would address the devices and send them data as you would anything else, and it seems that much on 65xx ASM, is basically all "MMIO" from what I have read so far.

I am going to review and compare several of these UARTS that can use a parallel communication mode, and I think you might be able to pull off some kind of SPI or 1-2 wire something or another very, very inefficiently directly from the 65xx, certainly with a few 'glue chips'.

any suggestions or requests for ICs of protocols to discuss or explore here?
any corrections or guidance on my understanding of parallel mode addressing/communication for these duarts that are popular?


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 29, 2023 4:31 pm 
Offline
User avatar

Joined: Tue Mar 05, 2013 4:31 am
Posts: 1385
Let's try this a different way.... from your response, it's apparent you don't understand much of the terminology that's being used, and/or what many of these I/O devices actually do or how they work.

Take SPI... it's a serial protocol to access a device. Serial, meaning it sends data via a single line, hence you need to send multiple bits, or voltage transitions, of the data line with specific timings that adhere to the defined protocol. A 6522 has timers and parallel ports, but it's knows nothing about SPI. The term bit-banging implies that you, as the programmer, need to implement the SPI protocol by taking a single port line for data and via software, program the line transitions to respond at the proper timings. Granted, there's more than the single line, but that is defined in the hardware interface and the software protocol for SPI. You have to implement this with hardware to connect 6522 port lines to an SPI device and write software to make it all work by implementing the protocol in software.

A UART on the other hand, natively supports the serial protocol based on asynchronous standards that have been around for decades. The transmit and receive lines, and the handshake lines are handled by the UART without any specific programming other than the configuration of the data size, parity, stop bits, etc., which are all part of the RS-232 (or TIA-232) standard. Once the serial port is configured, you can send data to the UART and the UART will handle the sending of it per the standard protocol. The same will happen with receive... the UART will receive the serial data and simply make it available as a single data transfer to the processor.

In both cases of interfacing the 6522 VIA or SC28L92 (Dual UART) to the 6502/65816, that is an 8-bit parallel interface with multiple registers accessed via address lines along with a chip select, read and write lines, or CLK and R/W for 65xx peripheral devices. Note that you can also define specific hardware functions such as parallel or serial ports using 74xx logic devices, things like latches, gates, inverters, shift registers, etc. I would suggest you spend some time reading the datasheets and trying to understand how each of the I/O devices you intend to use actually operate... both at the interface to the host processor and interface lines to the external world, e.g., 6522 port lines or UART data/control lines.

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


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 29, 2023 5:37 pm 
Offline

Joined: Sun Mar 19, 2023 2:04 pm
Posts: 137
Location: about an hour outside of Springfield
floobydust wrote:
Let's try this a different way.... from your response, it's apparent you don't understand much of the terminology that's being used, and/or what many of these I/O devices actually do or how they work.

Im not sure why you are getting that impression.
Quote:
Take SPI... it's a serial protocol to access a device. Serial, meaning it sends data via a single line, hence you need to send multiple bits, or voltage transitions, of the data line with specific timings that adhere to the defined protocol. A 6522 has timers and parallel ports, but it's knows nothing about SPI. The term bit-banging implies that you, as the programmer, need to implement the SPI protocol by taking a single port line for data and via software, program the line transitions to respond at the proper timings. Granted, there's more than the single line, but that is defined in the hardware interface and the software protocol for SPI. You have to implement this with hardware to connect 6522 port lines to an SPI device and write software to make it all work by implementing the protocol in software.

Right there with you, GARTHWILSON has some SPI.ASM code that goes over a basic 'driver' for the 6522 that does this. So far so good. :wink:
Quote:
A UART on the other hand, natively supports the serial protocol based on asynchronous standards that have been around for decades. The transmit and receive lines, and the handshake lines are handled by the UART without any specific programming other than the configuration of the data size, parity, stop bits, etc., which are all part of the RS-232 (or TIA-232) standard. Once the serial port is configured, you can send data to the UART and the UART will handle the sending of it per the standard protocol. The same will happen with receive... the UART will receive the serial data and simply make it available as a single data transfer to the processor.

again, I think all I am saying different here is you still need to tell the UART or CPU what to do, or how to handle that data. Some of what I am looking at, especially from GARTHWILSON, is that the 6522 is also used as intermediary between some ICs and the 65xx.
Quote:
In both cases of interfacing the 6522 VIA or SC28L92 (Dual UART) to the 6502/65816, that is an 8-bit parallel interface with multiple registers accessed via address lines along with a chip select, read and write lines, or CLK and R/W for 65xx peripheral devices. Note that you can also define specific hardware functions such as parallel or serial ports using 74xx logic devices, things like latches, gates, inverters, shift registers, etc. I would suggest you spend some time reading the datasheets and trying to understand how each of the I/O devices you intend to use actually operate... both at the interface to the host processor and interface lines to the external world, e.g., 6522 port lines or UART data/control lines.

Right, I think we are saying the same thing then, good deal :)


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 29, 2023 5:42 pm 
Offline

Joined: Mon Feb 15, 2021 2:11 am
Posts: 100
wayfarer wrote:
floobydust wrote:
Let's try this a different way.... from your response, it's apparent you don't understand much of the terminology that's being used, and/or what many of these I/O devices actually do or how they work.

Im not sure why you are getting that impression.
Some of what I am looking at, especially from GARTHWILSON, is that the 6522 is also used as intermediary between some ICs and the 65xx.


I think that's because when the IC's aren't conveniently able to be put directly on the bus (because of speed, pinout, etc.), or connected via a protocol that a bus-capable chip (UART, SPI, etc.) can communicate with, the 6522 can be used as an intermediary.


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

All times are UTC


Who is online

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