New SCSI Host Adaptor

discuss both original and modern hardware for the bbc micro/electron
User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Sat Jun 13, 2020 11:09 am

Just following up on my commitment / responsibility to make this project open source. My preference would be to publish on Github, but I'm very much a Github novice, so please bare with me. I'm using Git Gui on Windows.

As a start, I've forked the entire BeebSCSI project from simoninns/BeebSCSI. I''m only using a subset of that project, so is that the correct thing to do?

Assuming it is, I've then cloned the project using Git Gui, and it appears to have made a local copy on my hdd.

I've then created a branch using Git Bash as follows:

Code: Select all

git checkout -b BeebSCSIHostAdaptor
I can switch between (checkout) the Master and BeebSCSIHostAdaptor branches using Git Gui but I'm not seeing any files in the Unstaged Changes section for either branch, so I guess I'm doing something wrong?

Sorry for the dumb questions!

User avatar
simoni
Posts: 547
Joined: Wed May 25, 2016 7:18 pm
Contact:

Re: New SCSI Host Adaptor

Post by simoni » Thu Jun 18, 2020 7:49 am

It really depends on what you want to do. You can fork a repo (like BeebSCSI) then branch it; that way if the underlying repo changes you can merge it with you branch. You can have a forked repo as part of your main repo to... so you treat BeebSCSI like a library 'under' your own code. Generally, if you make a repo and then clone another repo into a sub-folder, git will sort-of ignore the sub-repo (so any user compiling from source will need to clone the sub-repo too as part of making the build environment). Git is flexible, git is confusing :D

Another way is to fork the base project (BeebSCSI) and just have at it; treating your master as you currently do your branch. You can always resync the fork with the original BeebSCSI repo (it's really the same as using a branch if you think about it). This makes the fork 'your own' but, if you are intending to resync often, can be a little more unclear imho.

There are other ways too but it's difficult to say what's best for you (and there really isn't a 'right' way - just different ways :) ). It's worth learning git though, so my recommendation would be to order a book like "Version Control with Git" (O’Reilly) or similar as they have good well laid-out examples.

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Mon Sep 14, 2020 9:04 pm

Folks - apologies for digging up an old thread here, but just looking for a bit of quick advice from those with more experience in this.

Without having to read through the whole thread, it was earlier recommended that I add some buffering between the XC95xxxXL CPLD and the SCSI drive I am trying to interface with. Given the CPLD is a 3.3v device (with 5v tolerant inputs) and the drive is a 5v device, I've been looking at a couple of solutions. I'm curious to know what the best solution would be.

Firstly, I was considering using a 74LCV245 device, which is a 3.3v device that can tolerate 5v inputs, and have the level shifting done between the LCV245 and the drive, but then I thought it might be better going for a 74HCT245 device that is a 5v device, and have the level shifting done between the CPLD and the HCT245.

Is there a recommended way to do this, or does it not really matter?

Thanks

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Wed Sep 16, 2020 4:23 pm

Ok, so buffering is not quite as straight forward as I had initially anticipated. The problem I have is that the 8 bit SCSI data bus is bi-directional, and is open collector. Referring back to this schematic for the original host adaptor design:

https://www.domesday86.com/wp-content/u ... dapter.gif

With my BeebSCSI implementation, there are 8 pins on the CPLD assigned to the SCSI drive data bus, and logic within the CPLD reads input, writes output (open collector), and drives the bus open collector when idle. I can't find any simple way to buffer this externally.

1. Writing data from CPLD -> SCSI Drive
The original host adaptor uses a pair of 74xx38N open collector NAND gate ICs to both drive and isolate the databus. One input to the NAND gate is one of the eight data bits from 1MHz bus (via some latches), and the other input (common to all 8 data bits) is the SCSI drive I/O status and is used to isolate the bus (or enable it to be driven).

I need to do something similar with my BeebSCSI implementation. Unfortunately, this part seems to be obsolete, but I have found a newer SN74HCS03 that looks to be compatible. The trouble is this part isn't available from JLCPCB, so I'd need to solder the thing on myself. I'm trying to avoid that as much as I can. I guess the alternative would be to to use a more conventional NAND gate (74xx00), and open drain buffer (74xx07), but that's adding extra components that I would rather avoid.

2. Writing data from SCSI Drive -> CPLD
I think this is more straight forward. Here, all I need to do is add a 74xx244 (or 245), and put this in parallel with the devices above. The OE would be driven again by the SCSI drive I/O status (inverse of above). In this case, the individual bits wouldn't need to be open-drain as they're just feeding into the CPLD


One other option I was considering was to separate out the SCSI inputs and SCSI outputs at the CPLD I/O. If I do that, I don't need the NAND gates for part 1 above. That would be done in the CPLD. All I would need is a more simple open drain buffer which is available from JLCPCB.

This all seems to be a bit complicated, so I just want to check that I'm not over thinking things here.

User avatar
simoni
Posts: 547
Joined: Wed May 25, 2016 7:18 pm
Contact:

Re: New SCSI Host Adaptor

Post by simoni » Wed Sep 16, 2020 4:29 pm

I could be miles off (working from memory) - but the 74245 is an 8-bit bi-directional buffer with open-drain iirc... it should have a direction pin and a !OE pin - if you disable the outputs they should float... so with 2 control pins from the CPLD (on for direction and one for output enable) you should be able to externally buffer in any way you like?

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Wed Sep 16, 2020 4:36 pm

simoni wrote:
Wed Sep 16, 2020 4:29 pm
I could be miles off (working from memory) - but the 74245 is an 8-bit bi-directional buffer with open-drain iirc... it should have a direction pin and a !OE pin - if you disable the outputs they should float... so with 2 control pins from the CPLD (on for direction and one for output enable) you should be able to externally buffer in any way you like?
The 245 is 3 state. I can disable all 8 outputs together with the /OE, but from what I understand, there's no way to disable individual bits and allow them to individually float, which (I believe) I need to do.

User avatar
simoni
Posts: 547
Joined: Wed May 25, 2016 7:18 pm
Contact:

Re: New SCSI Host Adaptor

Post by simoni » Wed Sep 16, 2020 5:25 pm

Which SCSI signal do you consider needs individual control? I don't recall any; pretty much all the SCSI pins should be terminated via pull up/down resistors (so can't by definition be floating).

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Wed Sep 16, 2020 6:31 pm

simoni wrote:
Wed Sep 16, 2020 5:25 pm
Which SCSI signal do you consider needs individual control? I don't recall any; pretty much all the SCSI pins should be terminated via pull up/down resistors (so can't by definition be floating).
I was thinking of the SCSI data bus; DB0..7 on the original host adaptor schematic. You're absolutely right about the fact that they're terminated.

The original host adaptor schematic shows that each data bit is driven by an open collector NAND gate. When the data bus is active, the two voltage levels on the data bus are either 3v (set by the terminator bias resistors) or 0v. When the data bus is inactive, the data bus will still sit at a quiescent 3v level.

If I use a 245, then the two voltage levels on the data bus will be either 5v or 0v when the data bus is active, and will sit at a quiescent 3v level when inactive.

If it's ok to actively drive the data bus to 5v during operation instead of 3v, then that would make things so much simpler. I did try this yesterday, but it wasn't working. However, that may be down to me not using the correct logic for OE & DIR on my 245.

Thanks for your help.

User avatar
simoni
Posts: 547
Joined: Wed May 25, 2016 7:18 pm
Contact:

Re: New SCSI Host Adaptor

Post by simoni » Wed Sep 16, 2020 8:01 pm

The pull up/down configuration serves a couple of purposes; as well as terminating they have the effect of pulling the lines up to 5Vs when the cable is disconnected (which is why the values aren't symmetrical) - the SCSI bus is inverted logic, so all 1's is everything 'off'.

So on the 5V SCSI bus the signals should always be 0V or 5V; rather than 3V. If you have an output which is either driven or open and then connected to an asymmetric pull up/down resistor pair (connected between 0V and 5Vs) the output would always be 0V or 5V.

So, if you look again at the original Acorn schematic, you will see that either IC13/14 is enabled (the adapter is driving the databus, and all IC14 outputs are pulled to 0V or 5V by the terminating resistors) - or IC14 is disabled and IC3 is acting as an input buffer - in which case the far-end device is driving the databus, but it's still being pulled up/down to 5V or 0V by resistor network.

If the above doesn't make sense; just say so and I'll try to draw something to illustrate the databus stage of the Acorn adapter.

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Wed Sep 16, 2020 8:18 pm

I'm clearly getting confused! I assumed that when neither end is driving the bus that the terminating resistors would act as a potential divider, which is where I got the 3v from (5v x 330 / (330+220)).

User avatar
simoni
Posts: 547
Joined: Wed May 25, 2016 7:18 pm
Contact:

Re: New SCSI Host Adaptor

Post by simoni » Wed Sep 16, 2020 8:37 pm

I'm clearly getting confused! I assumed that when neither end is driving the bus that the terminating resistors would act as a potential divider, which is where I got the 3v from (5v x 330 / (330+220)).
Actually, I think you're right there; but it would only float at 3Vs with the cable disconnected... in operation all the lines would be driven or sinking keeping everything to 0V or 5Vs. Either the device or the host is always in control of the bus; the I/O line is bistate, not tristate (so there is no 'floating' state during operation).

The 3Vs would be over the swing point of IC14, so a disconnected cable would be all 1's on the input to the host (which, due to SCSI's inverted logic, is all zeros).

Sorry for confusing you :) You are right apart from the assumption that there is a state where neither the host or device are driving the lines.

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Wed Sep 16, 2020 8:53 pm

simoni wrote:
Wed Sep 16, 2020 8:37 pm
in operation all the lines would be driven or sinking keeping everything to 0V or 5Vs. Either the device or the host is always in control of the bus; the I/O line is bistate, not tristate (so there is no 'floating' state during operation).
I'm still struggling to understand this bit. From the host adaptor side, the bus is being driven by a 7438, which is an open collector device, so the output is either high impedance, or being pulled to 0v. When the host adaptor is driving, and puts the 7438 into a high impedance state, I would have again assumed the potential divider to be in operation and therefore the bus would be driven at 3v, and not 5v?

...and this is where I then started to question whether or not it was appropriate to use a 245 to buffer, as this device would put 5v on the bus when driving (and 3v when the outputs are disabled).

User avatar
simoni
Posts: 547
Joined: Wed May 25, 2016 7:18 pm
Contact:

Re: New SCSI Host Adaptor

Post by simoni » Wed Sep 16, 2020 9:25 pm

Right; I'm suffering from spending too much time playing with the AIV SCSI adaptor which has a better design... If the design does use a swing between 0V and 3V, it's not a good design as it wouldn't function if the device used CMOS buffers :) It's possible that the input circuitry on the 74LS240 is changing things though. I couldn't find a clear diagram showing the set up of the input pins for the chip.

The weird set up of the original host adaptor is a lot to do with the fact that the designer felt the need to invert the databus in hardware rather than (as in the better AIV design) simply letting the software do that. Thinking about it; it might be better to follow the IO design of the AIV SCSI adaptor - you can simply use the CPLD to invert the bus if required.

I only have one of the original SCSI adaptors (and it's in my Winchester drive connected to a Master) - otherwise I'd grab a spare original board and poke it with a scope to see what's really happening.

dp11
Posts: 1195
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: New SCSI Host Adaptor

Post by dp11 » Wed Sep 16, 2020 10:29 pm

SCSI Bus is designed to be driven with an open collector drive. The terminator is designed to terminate the bus at typically 2.85v. One of the reasons for open collector is if multiple devices are on the bus with the same IDs there won't be a bus conflict.

Input levels need to be : Vih >2v , ViL<0.8v . CMOS wasn't wasn't common at the time for want would have been a fast bus, so the specification was based on TTL

If you know there is one device on the bus then you could drive the bus with a push pull instead of an open collect driver. You need to check that you can drive 24mA with a VoL <0.5v . The bus should still be terminated.

Not doing the inversion in hardware would just slow down the software as every byte has to be inverted.

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Wed Sep 16, 2020 11:01 pm

Thanks, both, for the feedback and for verifying my understanding.

So, going back to my CPLD based host adaptor, I stuck a 74HCT245 on the data lines, between the CPLD output and the drive. CPLD -> 245 'A' -> 245 'B' -> SCSI Drive. I then connected SCSI I/O line to both DIR & /OE on the 245. I wasn't sure if either or both of these needed to be inverted, so I put the SCSI I/O signal through an inverter, so I could test all 4 combinations. Unfortunately I couldn't get it to work with any of these combinations. One combination gave a 'Broken Directory' on Break, all other 3 just caused the beeb to hang on Break.

I then realised that I was being stupid using the 245 as a bi directional device and relying on the SCSI I/O signal (as used on the original board) to isolate the bus (using /OE), since /OE will disable the outputs in both directions and would prevent the drive from writing back to the CPLD. I think I'll try putting 2 x 245s in opposite directions, force DIR in both 245s to fix the direction, and then wire in the SCSI I/O signal to /OE on one, and an inverted version of the SCSI I/O signal to /OE on the other! A job for tomorrow.
dp11 wrote:
Wed Sep 16, 2020 10:29 pm
If you know there is one device on the bus then you could drive the bus with a push pull instead of an open collect driver. You need to check that you can drive 24mA with a VoL <0.5v . The bus should still be terminated.
Ah, good point. I'd forgotten to put termination on the bus side of the 245.

dp11
Posts: 1195
Joined: Sun Aug 12, 2012 9:47 pm
Contact:

Re: New SCSI Host Adaptor

Post by dp11 » Wed Sep 16, 2020 11:47 pm

Remember 74hct245 can't drive 24mA so won't work.
Last edited by dp11 on Thu Sep 17, 2020 7:30 am, edited 1 time in total.

User avatar
KenLowe
Posts: 1311
Joined: Mon Oct 18, 2004 5:35 pm
Location: UK
Contact:

Re: New SCSI Host Adaptor

Post by KenLowe » Thu Sep 17, 2020 1:25 am

I think I've found what I need:
Datasheet wrote:The IDT74FCT621T is an octal transceiver with non-inverting OpenDrain bus compatible outputs in both send and receive directions. The B bus outputs are capable of sinking 64mA providing very good capacitive drive characteristics. These octal bus transceivers are designed for
asynchronous two-way communication between data buses. The control function implementation allows for maximum flexibility in timing.
https://www.idt.com/us/en/document/dst/ ... -datasheet

Post Reply

Return to “8-bit acorn hardware”