• Updated 2023-07-12: Hello, Guest! Welcome back, and be sure to check out this follow-up post about our outage a week or so ago.

SCSI to IDE, z-80 conv:Prototype, looking for a project lead

Bunsen

Admin-Witchfinder-General
Wow, that's disappointing :( You're a bit familiar with AVRs iirc; would a faster AVR help there at all?

I have a few of the CURIO SCSI ICs, but no docs :(

 

techknight

Well-known member
Yes, but they only top at 20mhz, His code is timed at 16Mhz. unless we go AVR32 which is ARM based. And if thats the case, there are much better ARMs than the AVR32.

Now im sure there are multiple ways at making his routines much more efficient and speeding up the system. AVR8s these days are system-on-chips that are much faster than what they had then... So its possible to speed it up given if the code was made more efficient (C isnt my strongpoint).

 

Gorgonops

Moderator
Staff member
Regarding the "speed" question (along with the "uses a hard to find SCSI chip" objection), any design which requires the microcontroller to bit-bang the SCSI bus directly is inevitably going to suffer some performance issues. The reason why SCSI chips like the 53c80 and friends exist is because SCSI has very specific and rigorous requirements for the generation and handling of handshaking and arbitration signals, and if you're not going to invest in a fair amount of logic in a state machine which the provides buffers and triggers to offload some of that handshaking overhead the CPU is going to be spending a *lot* of its time either polling for activity or running precise timing loops to hold X wire high or low for however long the protocol calls for.

Here's the original draft specification for the SCSI interface. It *is* complicated, more complicated than most 8 or 16 bit CPU buses. This is why IDE seemed like a good idea when it came along: it's actually a simplified subset of an already simple 16 bit bus.

An MCU, even if it's one that *almost* manages one instruction per cycle like AVR (or even ARM), is going to be working pretty hard just watching the bus pins and keeping track of what phase of the conversation it's in at any given time. If you want good performance (without going ridiculously overboard on the CPU) it would help a *lot* to have some of the bus handler in hardware. (That design that Techknight was playing with uses a second AVR as the bus handler, which is a clever idea that moves hardware complexity into software, but it still leaves you with one core that's having to spend most of its time listening to and triggering pins with just enough left over to shove semi-decoded data out the back door to the other AVR. That's not a recipe for "fast". Even *with* a SCSI ASIC to get speeds in the 1Mbyte/sec-plus territory you'll probably be needing a pretty darn fast CPU and/or DMA. And this is ignoring the fact that you're having to deal with the overhead of having to talk out the other side to the IDE/SD/USB/whatever drive and doing the necessary command translation.)

Anyway, having a bus handler in hardware which isn't a hard to find EOL IC is what leads us back to CPLDs/FPGAs. But FPGAs/CPLDs aren't magic; you'll still need a hardware design for the state machine to program into the devices. In casual Googling I have yet to find *anyone* who's "open-sourced" code for making a SCSI MAC, let alone a complete target out of CPLDs/FPGAs. (The closest I came is a confusing thread about making an ASCI-SCSI adapter for Atari ST machines out of CPLDs, which may well be a promising start.) One approach would be to try to find documentation/schematics for *very old* SCSI target devices (I.E., early SCSI hard drives, especially those ones utilizing SCSI-to-MFM adapter boards) and use an example which does SCSI with discrete TTL as a starting point. Quick googling turned up schematics for some primitive SCSI (and SASI) *host adapters* out there that fit into a dozen or two TTL devices, presumably the hard drive side isn't much harder. (And the manual/schematic for one may well be out there. It looks like based on the few board photos I've seen that a lot of the early formatter boards lacking ASICs used Zilog Z8 CPUs as the go-between for the TTL-decoded SCSI bus and the hard drive controller, which is convenient given the Z8 is vaguely comparable to an 8-bit PIC or AVR in capabilities.) From this point the project branches depending on whether you're using a CPLD or an FPGA:

CPLD: You figure out what triggers and buffers would make your life easier, pick the optimal bus design for presenting the simplified bus to the MCU of your choice (you'll still need one), and see how compressed you can make things. If you *really* want fast you still might need to consider working, say, an SRAM chip into the design so both SCSI and IDE transfers (if that's what you go with) can use DMA, in which case your CPLD(s) will need to arbitrate that too.

FPGA: With a roomy enough device you could put your bus handler and the softcore of your choice on one chip. (And presumably you'll choose a softcore that has high-level language support and lets you turn the clock speed up to eleven. Heck, if you want to keep the "hardware design" super-simple maybe you cram two softcores together and duplicate the "dual-CPU" nature of that AVR design. To speed things up massively you could have them share memory instead of having to communicate over a narrow bus, for instance. Heck, use three. One driving the SCSI MAC, one doing command translation, and a third driving the storage bus...)

So... did I have a point? Oh, yeah. Talking about CPLDs and FPGAs is all great, but what seriously needs to be kept in mind is that they don't significantly reduce the number of "moving parts" in the design. (And massively optimizing for performance will increase it that much more.) All they do is compress a bunch of discrete logic into a single package: you still need to design that logic. I've read the thread on the VCF discussing the board that's the subject of this thread, and while I roll my eyes where it devolves into a self-righteous flaming match I do sort of understand the frustration that stemmed from and I shake my head myself when people throw out "use an FPGA!" as if it's a magic bullet that makes design problems go away with a wave of a wand. I agree that the Z-80 board here isn't an optimal solution for either performance nor future-proof-y-ness, but I have to give the folks some credit for actually pasting together something that at least partially works and is undoubtedly "educational". Two options for a next step, if someone wanted to take it slow, would be:

A: Interface a chip like 53c80 to a *fast* MCU and code a driver in a high-level language. Or.

B: Take this design (since it does have at least semi-working firmware that exists in source form) and concentrate on building a SCSI ASIC-in-a-CPLD/FPGA that works in place of the 53c80. (This of course could start with a few dozen TTL chips on a breadboard, later translated into a CPLD.)

Success with both A+B results in your dream board that's faster, easier to understand, and doesn't rely on EOL hardware. You don't *have* to do everything at once.

 

Bunsen

Admin-Witchfinder-General
a bus handler in hardware which isn't a hard to find EOL IC
Is there such a thing as a general-purpose bus arbitration IC which can be configured to a specific bus?

 

Gorgonops

Moderator
Staff member
Is there such a thing as a general-purpose bus arbitration IC which can be configured to a specific bus?
That would be a pretty magical thing if it existed. I'm sort of picturing a gigantic DIP package with a knob on it marked "SCSI/HIPPI/EPP/ISA/..." ;)

 

Bunsen

Admin-Witchfinder-General
That's... not really what I meant.

I don't know whether such a thing exists, or I wouldn't be asking: but what I'm imagining is an IC which is set up purely to do fast IO and bit/byte format wrangling from one side t'other. Obviously :p it would have to be programmed in a fairly low-level way in how to behave - no magic dials.

 

techknight

Well-known member
Well if there isnt any open source SCSI files for FPGA, perhaps we can do the opposite.

There are Z80 systems for the FPGA. We can take the address decoding, the ROM/RAM/ETC and toss it all on the FPGA, as the libraries are already out there. just have to patch them all together, and map the external I/O to the SCSI IC, and the ATA port.

For simplicity though, once the Z80 project is complete, i guess for a start we could simply implement all the tie-in glue logic, 74 series logic into a CPLD to help reduce the IC count. I am thinking in terms of 2.5" compatibility. Get rid of the UART, and use the PLCC versions of the Z80 and firmware, and SMD RAM. As a start.

 

uniserver

Well-known member
by: Wayne Warthen https://plus.google.com/u/0/110693559211154577764?prsrc=4

I have posted another very minor S2I firmware update on the Wiki (0.3B). The main difference is that the ROM automatically starts the SCSI Target Mode Command Processor automatically at boot. You can press to access the Zapple prompt.
Here are some more testing observations:

I pushed the CPU speed to 12MHz successfully. I was unsuccessful at 16MHz. My Z80 is rated for 20MHz. I would guess the limiting component is now the EEPROM which is rated at 150ns. Any thoughts on this? I don't see a faster version of the 28C256 available...

DOS 6.22 FDISK now working!!! :) It definitively started working when I increased the CPU speed to 12MHz combined with pseudo-DMA. Interestingly, it appears that newer host controllers are MORE tolerant of slower SCSI devices. My older controller (TMC-860) defnitely struggles more as the SCSI2IDE runs slower. Running the SCSI2IDE at 12MHz w/ pseudo-DMA has resolved all remaining compatibility issues I can determine.

The IDE interface is substantially faster than the SD Card interface. I strongly recommend sticking with the IDE interface if possible.

I believe the firmware is definitely ready for serious testing in other environments.

If anyone is building/testing, please keep us posted here!

Thanks,
by: Andrew Lynch

Thanks Wayne! Wow that is an interesting discovery! Great news on fixing the MSDOS 6.22 anomaly! I imagine the SCSI host firmware might have some timing dependencies built in that are getting tripped up by the slower response of the S2I.
What sort of logic chips are you using on your S2I prototype? If speed has become an issue it is probably time to move from 74LSxxx to 74Fxxx or 74ALSxxx or 74HCTxxx or 74ACTxxx or 74AHCTxxx. Especially the 74LS139 has slow propagation. Typically the 74LSxxx is good up to 20 MHz but when connected as a circuit the propagation delay can add up significantly and break the design. What speeds are your UART, PPI, SRAM, etc? I am a big fan of 74Fxxx but they can be power hogs. Unfortunately the only real ways to find the broken link is to substitute parts or use a logic analyzer to isolate the breakage. Neither is going to be much fun though…

There are some faster ROMs available:

29C256 (Flash drop in replacement) can get as low as 90ns. Probably difficult to source though.

http://www.digikey.com/product-detail/en/AT29C256-90PI/AT29C256-90PI-ND/399193

There are 28C256 as fast as 120ns.

http://www.digikey.com/product-detail/en/CAT28C256LI12/CAT28C256LI12-ND/1631037

Digikey has 27C256 EPROMs as low as 45 and 55 ns but they are UV eraseable EPROM which will be a PITA to use.

http://www.digikey.com/scripts/dksearch/dksus.dll?FV=fff40027%2Cfff80434%2C401985%2C4021d4%2C4022f5&k=27C256&vendor=0&mnonly=0&newproducts=0&ptm=0&fid=0&quantity=0&PV143=30&PV143=16

I am thinking the IDE will be the primary interface for the drive and the SD will act like a big local ROM for modules, disk images, utilities, and other things. It would be nice if it were faster but SD is inherently serial in nature and slow by design. The later SDHC are faster and are nibble wide which helps a lot but we don’t have the spare GPIO pins to drive it. Maybe in S2I V2.

Thanks and have a nice day!

Andrew Lynch
 
Top