thundercat636
New Member
Hi everyone,
I am basically pretty new to the whole electronics/digital electronics thing, so please assume a pretty low level of knowledge.
I am looking to improve the interface I have between my micro-controller and Z80 SBC, which can run at 4 or 8 MHz. Currently, I am using a two-wire serial interface with no control from an ATmega328 Nano to my Z80's SIO/2 chip to allow commands and basic data transfer between the Z80 and micro-controller.
I want to move my system on from breadboard to a more stable PCB design now and am taking the opportunity to look into improving the interface and (hopefully) freeing up the serial port on the SIO/2 for other uses by creating a dedicated interface between the micro-controller and Z80.
I am by no means limited to using the '328 Nano - in fact I don't intend to use it for the PCB version; my options are open so I am considering an ATmega2560, PIC (16F?) or even an STM32F103.
However, what I can't do is decide upon an efficient method of interface any of these micro-controllers with the Z80 other than through the standard serial interface, which I'd rather not use for reasons stated previously. So, I'm asking for suggestions (and perhaps even a bit of a leg-up in the design!) on a replacement interface.
I'm going for simplicity (of design and software to run it) over speed.
Here's what I've considered so far:
1) I2C/SPI
This has serious benefits in many areas, as just about every micro-controller supports I2C/SPI and libraries for the micro-controllers are readily available. Implementing the bus at the Z80 end is what holds me back from going for this method. I don't want to bit-bang an I2C or SPI interface on the Z80, but I do have some MCP23017s and MCP23S17s lying around - maybe I could use one of those with some supporting logic chips?
I'm guessing that I'd need a fast flip flop to catch the IO read or write from the Z80 and trigger the MCP23017 to capture the byte on the data bus so the micro-controller can read it whilst holding WAIT low to stop the Z80 from rushing on to the next command?
I'd also need a way of getting the micro-controller to tell the Z80 that it has data to return to it - perhaps hold the INT line low and supply a vector on the data bus (I'm using Interrupt Mode 2) to call the 'data receive' routine on the Z80?
2) I2C/SPI with DMA
As above, but with the micro-controller having access to the 16-bit address bus, BUSACK and BUSREQ as well so it can write data directly to the Z80's memory. This could replace the micro-controller having to tell the Z80 it has data to return - it could just write it to memory and set a flag in a protected section of memory that the Z80 periodically checks on. This will require another 8-bit latch and a load more micro-controller IO pins (unless I use another MCP23017?) It is desirable, however, as it provides another level of flexibility for the micro-controller.
3) Bespoke interface
Some custom-built 2-way interface of a design I haven't yet thought about or am aware could exist.
4) Give up and stick with the serial interface
This is what I'm faced with at the moment. My electronics skills aren't up to building options 1, 2 or 3 above from scratch - hence this post - I might have a rough idea of what is required, but the specifics elude me.
So, I'd be especially grateful for any help and guidance you're willing to provide. I do best with pictures and diagrams and learn from examples much better than anything else, so if there's a solution to this out there already that I have somehow missed during my Googling, please let me know! And thanks.
I am basically pretty new to the whole electronics/digital electronics thing, so please assume a pretty low level of knowledge.
I am looking to improve the interface I have between my micro-controller and Z80 SBC, which can run at 4 or 8 MHz. Currently, I am using a two-wire serial interface with no control from an ATmega328 Nano to my Z80's SIO/2 chip to allow commands and basic data transfer between the Z80 and micro-controller.
I want to move my system on from breadboard to a more stable PCB design now and am taking the opportunity to look into improving the interface and (hopefully) freeing up the serial port on the SIO/2 for other uses by creating a dedicated interface between the micro-controller and Z80.
I am by no means limited to using the '328 Nano - in fact I don't intend to use it for the PCB version; my options are open so I am considering an ATmega2560, PIC (16F?) or even an STM32F103.
However, what I can't do is decide upon an efficient method of interface any of these micro-controllers with the Z80 other than through the standard serial interface, which I'd rather not use for reasons stated previously. So, I'm asking for suggestions (and perhaps even a bit of a leg-up in the design!) on a replacement interface.
I'm going for simplicity (of design and software to run it) over speed.
Here's what I've considered so far:
1) I2C/SPI
This has serious benefits in many areas, as just about every micro-controller supports I2C/SPI and libraries for the micro-controllers are readily available. Implementing the bus at the Z80 end is what holds me back from going for this method. I don't want to bit-bang an I2C or SPI interface on the Z80, but I do have some MCP23017s and MCP23S17s lying around - maybe I could use one of those with some supporting logic chips?
I'm guessing that I'd need a fast flip flop to catch the IO read or write from the Z80 and trigger the MCP23017 to capture the byte on the data bus so the micro-controller can read it whilst holding WAIT low to stop the Z80 from rushing on to the next command?
I'd also need a way of getting the micro-controller to tell the Z80 that it has data to return to it - perhaps hold the INT line low and supply a vector on the data bus (I'm using Interrupt Mode 2) to call the 'data receive' routine on the Z80?
2) I2C/SPI with DMA
As above, but with the micro-controller having access to the 16-bit address bus, BUSACK and BUSREQ as well so it can write data directly to the Z80's memory. This could replace the micro-controller having to tell the Z80 it has data to return - it could just write it to memory and set a flag in a protected section of memory that the Z80 periodically checks on. This will require another 8-bit latch and a load more micro-controller IO pins (unless I use another MCP23017?) It is desirable, however, as it provides another level of flexibility for the micro-controller.
3) Bespoke interface
Some custom-built 2-way interface of a design I haven't yet thought about or am aware could exist.
4) Give up and stick with the serial interface
This is what I'm faced with at the moment. My electronics skills aren't up to building options 1, 2 or 3 above from scratch - hence this post - I might have a rough idea of what is required, but the specifics elude me.
So, I'd be especially grateful for any help and guidance you're willing to provide. I do best with pictures and diagrams and learn from examples much better than anything else, so if there's a solution to this out there already that I have somehow missed during my Googling, please let me know! And thanks.