2
\$\begingroup\$

For my Z80 breadboard computer, I'd like to make a direct TTL to USB interface and I would like to avoid using the Z80 peripheral chips but tinker my own more direct ways of doing things. I figure I would just use Z80 IN and OUT instructions and for input generate interrupts. Another time I would hook essentially the same setup to a 6502, where instead of IN and OUT instructions I would use memory mapping. That is why I prefer not to depend on the Z80 I/O chips.

The USB protocol is definitely too hard to build from discrete chips, but RS232 is really obsolete (i.e. my laptop doesn't have an RS232 port any more for decades), so I figure to implement a direct USB interface. I found the MCP2221 chip which comes in DIP package and has UART as well as an I2C pins.

MCP2221 pinout

Ideally it would have a parallel data input and output so I can hook it up to the data bus. Not wanting to use the 40 pin Z80 SIO with the 28 pin Z80 CTS, wanting something way more basic, I'd like to connect this USB chip directly to some sort of parallel shift register that could be used for either input or output and the 74LS198 comes to mind:

74LS198 pinout

This can shift in either direction, getting serial input on one side, serial output on the other side, and parallel input and output. I have used an Arduino's SDA and SCL with a 74'595 before, that was easy, but only for USB to serial. I wonder would the MCP2221 allow me to supply my data and clock to SDA and SCL to send data to it? If not, then the bidirectional shift register would not be useful. Then the only way I can see is to use an UART chip, like the MAX3100:

MAX3100 pinout

Here I can see a DIN and DOUT with a SCLK so I could then use the shift register to get parallel to serial. But that would be an extra chip and then perhaps I better use the Z80 SIO without the CTC but just hardwired clock. But I feel having to go from USB to async serial to then sync serial to parallel a rather round-about way.

Is there no way to use this MCP2221 for bi-directional synchronous serial, so all I'd need is the shift register? Although there must be some other aspects still, such as, how do I control whether it is reading or writing? With the MAX3100 I see an /IRQ pin, which I suppose could generate an /IRQ to tell the CPU of incoming data.

Is there some other option to hook USB directly to an 8-bit parallel TTL device?

\$\endgroup\$
1
  • \$\begingroup\$ You can buy really cheap USB to (TTL)RS232 convertor boards on ali/ebay you put into your PC. Then you connect on TTL level to your Z80 board. [2c] \$\endgroup\$ Aug 30, 2022 at 8:34

2 Answers 2

3
\$\begingroup\$

Is there some other option to hook USB directly to an 8-bit parallel TTL device?

I have had great success with FTDI's line of "USB to Parallel FIFO" chips - they read and write like a RAM and the internal buffers are super useful.

ftdi usb to parallel

snip from datasheet found here: https://ftdichip.com/products/ft240xq/

\$\endgroup\$
2
  • 1
    \$\begingroup\$ That's pretty much the way to go. Those chips can interface to Z80 bus with minimal glue logic. \$\endgroup\$ Aug 29, 2022 at 20:08
  • \$\begingroup\$ Yes, avoids all shift register magic, Z's /RD to F's RD#, Z's /WR through inverter to F's WR, D0-7 and it's totally straight forward this way. The TXE# is /WRDY signal could be ignored, the RXF# could be adapted to the Z's /IRQ to signal data available to read, or both could just not be used. The UMFT240XA development module or just plain SSOP-24 to DIP adapter would adapt to a mere 24 pin DIP footprint. 24 pins replace 2-3 chips. Am I reading this right that it would be fully compatible to TTL 74LS levels? \$\endgroup\$ Aug 30, 2022 at 5:44
1
\$\begingroup\$

Another idea:

MCP2210 USB-to-SPI adapter chip (not a DIP package, but you can easily enough buy a circuit board to adapt it to a DIP shape).

Using SCK, MISO and MOSI, you have a serial interface that's probably compatible with a 74xx165 PISO shift register and a 75xx595 SIPO shift register. Now you have an 8-bit input and 8-bit output. You should be able to build a workable protocol on top of that. Daisy-chaining multiple shift registers would allow you to transfer more data at once in either direction, e.g. chain 3 of them and you can send/receive a 16-bit address + 8-bit value.

The chip also has 8 pins for chip-select or GPIO. You might consider stopping the clock of your breadboard computer while the chip-select is low, to prevent torn reads and writes, and using another one to trigger an interrupt on your computer, and another one to trigger an interrupt on the host (I think the chip has this feature).

Note that all communication will be controlled by the host computer - your PC, not the one you are building - which is to be expected with all of these USB schemes as USB is a fairly complex protocol.

I had the idea to look at USB-to-SPI adapters because you mentioned shift registers. There are also USB-to-GPIO adapters which would allow your computer to have full control of several pins (perhaps 16).

Instead of a set of shift registers you could choose to wire the SPI port to some completely different adapter chip such as MCP23S08.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.