Build SPI Master using shift registers

Thread Starter

wdlyons_at_gmail_dot_com

Joined Jan 10, 2019
5
Hello,

I am looking for some advice on how to construct an SPI master port using IC's.

I have an 8085 retro kit and I would like to create a SPI master port. My first attempt was simple bit banging
away and that works great, but I would like to read/write to an sd card, and bit banging is far too slow.
This is also a learning experience for me, my background is mostly software, I'd like to explore the hardware side.

I own a couple of HC299's which seem to fill the requirement, but I'm stuck on how to get the shift register to indicate it has finished shifting all 8 bits.
Ideally the processor would load an 8 bit value into the register, enable the clock and wait for an interrupt indicating the shift has finished.
Any ideas along this line is greatly appreciated.

thanks
 

JohnInTX

Joined Jun 26, 2012
4,782
Welcome to AAC!

Ah.. the 8085. Written many a line of ASM for that one..

If I were doing that, I'd consider a PIC with a PSP (parallel slave port) and MSSP (master serial interface) with a little glue firmware. The PSP probably will go right onto the 8085 bus as a memory or IO mapped peripheral. Write to it, let the PIC drop the parallel byte onto its MSSP, do the SPI then interrupt the 8085 and provide the parallel data returned via PSP read.

It's not 'cool' like using contemporary SSI parts but a lot easier, IMO. I don't know of any MCS-85 peripheral that did SPI but you might look at Motorola peripherals for the 6800. A little glue logic might make them work on the 8085.bus.

A hardware shift-register solution would require a counter and maybe a control flip flop. When you load the SR, clear the counter and set the f/f to enable shifting. When the counter counts up to 8, clear the f/f and assert one of the RST interrupts - may be that could be from the Q/ output of the control f/f - RST x.5 inputs are edge triggered IIRC. Remember that you have to shift out the data to the SD (MOSI) AND shift in at the same time (MISO). You might be able to eliminate the f/f by using a presettable down counter with a zero or underflow output OR a presettable UP counter that counts up from the preset to carry out and stops. Hitting the LOAD line in either case presets the counter, clears the over/underflow and counts 8 more clocks. As before, the shifting is enabled when the counter is.

You probably can use ALE for the clock source for all of this.

Sorry for the drive-by thinking.. just came in to shut things down and didn't pull any 8085/6800 datasheets to refresh my memory. Hope it gives you something to think on.
 

Attachments

Last edited:

nsaspook

Joined Aug 27, 2009
12,345
I agree with @JohnInTX Looks like you might need an external divide by 8 clock counter chip to generate a interrupt. Reset the counter to zero before clocks begins and then use the counter output to generate the interrupt. If you have a 8254 Programmable Counter on the retro board it might do the trick.
 
Top