serial interface bus
Posted: Fri Dec 29, 2006 10:42 am
Edit: The final spec. is at viewtopic.php?t=1064&start=105 . This is on the 8th page, after all the background that led up to it.
I originally wrote this as a private E-mail to Samuel Falvo, then decided it ought to be on the forum for everyone, and modified it accordingly.
This is regarding an interface to expand a 6502-based system, similar to how IEEE-488 is used to connect lab instrumentation in a rack or on the workbench to a computer through cables that may be up to several meters long. It is at best a medium-speed interface, maxing out at perhaps a few hundred kbps.
Goals:
Since our tiny new company is getting going and it looks like we may need a lot more in-house testing than before, I was again thinking about the interface loop idea and alternatives. I know home-brewing of test equipment in many big-company situations is unwise for several reasons; but I hope I never work in a big company again, and there are many reasons home-brewing may make sense for us. Regardless, my home-made workbench computer has been an invaluable tool in my work, and I will continue to develop it further.
Samuel, although I plan to go back and refresh my memory on the E-mails we exchanged a couple of years ago (which are on a different computer I don't use anymore) regarding the HPIL-inspired interface loop using the 6522's serial port, I'm sure your thinking has evolved some since then, and I'd like to hear it. I did go back and re-read your related threads here entitled "And the winner is . . ." and "Kestrel 8K Finished!", both under "Hardware". The latter especially has quite a bit of discussion on this sort of thing.
Regarding a port that's basically SPI like wirehead suggested:
Some possible pros are:
Some cons are:
SPI might require setting each device's address, possibly with a DIP switch like IEEE-488, instead of having auto-addressing like an interface loop. Besides the fact that I'm not sure that's much of a problem, I did not list it with the "cons" above because there's a way around it, below.
I seem to be gravitating toward one SPI port on my workbench computer, possibly with TTL logic levels so it will work with 3V logic as well. Daisychaining of devices can be done with each device having two connectors. The CLK, DI, DO, and IRQ lines would be bussed; ie, the pair of connectors on a given device would be wired in parallel for these four lines (plus ground and power). There would be seven select lines. This accomplishes two things: the devices don't need to decode an address bus (which would otherwise be 3 bits in this case), and auto-addressing can be done by rotating [Edit: shifting, not rotating] the select lines from one connector to the other on each device such that the device closest to the controller responds to address 1, the next device responds to address 2 even though it thinks it's address 1, the device after that responds to address 3 even though it thinks it's address 1, and so on. I plan to put at least one power supply line through the connector so things that don't require much power don't have to have their own power supply (except maybe a small IC regulator).
This kind of interface would make it easy to implement things like programmable power supplies, loads, DMMs, signal generators, and signal-routing networks, graphic LCDs, flash storage, UARTs and modems, and maybe even a USB controller (plus tons of other possibilities).
I don't foresee any hot-plugging with the commonly available connectors. I don't know if that would really be a problem or not. It wouldn't be hard to shut the interface down at the controller end so at least the controller itself doesn't have to be turned off in order to connect or disconnect a device. Ribbon cable with twisted pairs might be appropriate. (It goes flat again every so many inches in order press IDCs on, and it's often more flexible than standard ribbon cable.) At least the CLK, DI, and DO lines would be paired with a ground line and a large ferrite bead for each pair should be added as a balun at each pin header on the boards for reduced crosstalk and radiation and improved noise immunity.
For myself, this topic is not for more vaporware discussions that don't lead to actual hardware. I'm ready to build it right now, but wanted to hear any new ideas first. A few years ago I devised serial and parallel do-everything expansion buses that were more complex (and thus never completed), but the added experience gained since then tells me that simpler is not only more realistic, but will do the job just as well. Besides, more SPI and I²C parts have become available since then, and I already have a working I²C port. I should add that I have successfully used SPI devices on several occasions, but not on a bus of this type.
I originally wrote this as a private E-mail to Samuel Falvo, then decided it ought to be on the forum for everyone, and modified it accordingly.
This is regarding an interface to expand a 6502-based system, similar to how IEEE-488 is used to connect lab instrumentation in a rack or on the workbench to a computer through cables that may be up to several meters long. It is at best a medium-speed interface, maxing out at perhaps a few hundred kbps.
Goals:
- The 6502's own buses are not run off the SBC-- not even in a card cage.
- One connector, or a pair of connectors (in the case of an interface loop), is all the host computer needs in order to interface to many devices, without added hubs or expanders.
- Simple software and hardware
- inexpensive, not-too-big connectors. The board-side connector should fit into the .1" grid on breadboards.
Since our tiny new company is getting going and it looks like we may need a lot more in-house testing than before, I was again thinking about the interface loop idea and alternatives. I know home-brewing of test equipment in many big-company situations is unwise for several reasons; but I hope I never work in a big company again, and there are many reasons home-brewing may make sense for us. Regardless, my home-made workbench computer has been an invaluable tool in my work, and I will continue to develop it further.
Samuel, although I plan to go back and refresh my memory on the E-mails we exchanged a couple of years ago (which are on a different computer I don't use anymore) regarding the HPIL-inspired interface loop using the 6522's serial port, I'm sure your thinking has evolved some since then, and I'd like to hear it. I did go back and re-read your related threads here entitled "And the winner is . . ." and "Kestrel 8K Finished!", both under "Hardware". The latter especially has quite a bit of discussion on this sort of thing.
Regarding a port that's basically SPI like wirehead suggested:
Some possible pros are:
- It would be easy to interface standard SPI parts
- SPI would allow dumb devices to be simpler, using 74-family parts with no processor.
- Custom smart devices can be home-brewed using microcontrollers that can act as an SPI slave.
- SPI would be less complex softwarewise for both the controller and the devices than an interface loop would be.
- SPI could be faster than an interface loop when message packs are small and/or there are a lot of devices connected.
- With SPI, one slow device would not slow all the other devices down.
Some cons are:
- Real SPI would require bit-banging if done with the 6522. (The 6522's serial port is close to one of the most commonly used SPI modes, but no cigar.)
- To allow some cable length, slowish comparators like the LM339, along with hysteresis, should be used at the receivers to keep parasitically coupled transients from causing unwanted trigering. The interface loop OTOH could just use something like cat-5 cable with receiver ports terminated, so the cable would not limit the speed.
- For devices that interface through a 6522, receive interrupts could be a little messier with SPI than with the CB1/CB2 serial port.
SPI might require setting each device's address, possibly with a DIP switch like IEEE-488, instead of having auto-addressing like an interface loop. Besides the fact that I'm not sure that's much of a problem, I did not list it with the "cons" above because there's a way around it, below.
I seem to be gravitating toward one SPI port on my workbench computer, possibly with TTL logic levels so it will work with 3V logic as well. Daisychaining of devices can be done with each device having two connectors. The CLK, DI, DO, and IRQ lines would be bussed; ie, the pair of connectors on a given device would be wired in parallel for these four lines (plus ground and power). There would be seven select lines. This accomplishes two things: the devices don't need to decode an address bus (which would otherwise be 3 bits in this case), and auto-addressing can be done by rotating [Edit: shifting, not rotating] the select lines from one connector to the other on each device such that the device closest to the controller responds to address 1, the next device responds to address 2 even though it thinks it's address 1, the device after that responds to address 3 even though it thinks it's address 1, and so on. I plan to put at least one power supply line through the connector so things that don't require much power don't have to have their own power supply (except maybe a small IC regulator).
This kind of interface would make it easy to implement things like programmable power supplies, loads, DMMs, signal generators, and signal-routing networks, graphic LCDs, flash storage, UARTs and modems, and maybe even a USB controller (plus tons of other possibilities).
I don't foresee any hot-plugging with the commonly available connectors. I don't know if that would really be a problem or not. It wouldn't be hard to shut the interface down at the controller end so at least the controller itself doesn't have to be turned off in order to connect or disconnect a device. Ribbon cable with twisted pairs might be appropriate. (It goes flat again every so many inches in order press IDCs on, and it's often more flexible than standard ribbon cable.) At least the CLK, DI, and DO lines would be paired with a ground line and a large ferrite bead for each pair should be added as a balun at each pin header on the boards for reduced crosstalk and radiation and improved noise immunity.
For myself, this topic is not for more vaporware discussions that don't lead to actual hardware. I'm ready to build it right now, but wanted to hear any new ideas first. A few years ago I devised serial and parallel do-everything expansion buses that were more complex (and thus never completed), but the added experience gained since then tells me that simpler is not only more realistic, but will do the job just as well. Besides, more SPI and I²C parts have become available since then, and I already have a working I²C port. I should add that I have successfully used SPI devices on several occasions, but not on a bus of this type.