• 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.

SCSI2SD Project - anyone interested ?

dougg3

Well-known member
Cool on the speed doubling! Very nice.

Yeah, after you mentioned that, I can see the internal drive size database. Darn :( I tried changing to other drive models that are bigger (some even have a size of 0 blocks in the internal database, which might mean "trust what the drive says"), and they are definitely recognized as valid by HD SC Setup, but they fail to initialize.

At some point I may try to figure out what is causing it to fail on those other drive models. Perhaps when it thinks it's talking to these other drive models, it sends other SCSI commands that are not yet supported. I'll try to figure out a good way to debug and see what SCSI commands are being sent.

 

dougg3

Well-known member
Well, I've been messing around with disassembling Apple HD SC Setup and trying to figure out how to make SCSI2SD fully compatible with it. I'm making progress, but it's not working yet.

The very last entry in the internal drive database is manufacturer "x" (followed by 7 spaces) and a drive name filled with spaces. As far as I can tell it's a placeholder entry used in certain cases like when you have the patched version that works with any drive. It seems like a good "dummy" entry to try to match because it doesn't specify a drive size. So I gave the SCSI2SD that manufacturer and name, and it was recognized as a valid drive.

Unfortunately, right before formatting, Apple HD SC Setup does a MODE SENSE(6) command for page 0x01's default values. That page is the Read/Write Error Recovery page, which is not yet supported. I added code to SCSI2SD so it replies to requests for that page, but for some reason the mode sense command still ends up with an error, so I may be doing something wrong in my implementation of it.

If I patch Apple HD SC Setup to always act like that mode sense command was successful (so I'm pretending that I got past that first hurdle), it gets to the point where it says it's verifying the formatting, and then it fails again, which I believe is because it's sending a command (haven't determined which one yet) that SCSI2SD doesn't know how to handle yet. Haven't gotten that far yet, first I just want to make it work correctly with the read/write error recovery page. Once it's passing that, I'll figure out what is causing the verify to fail.

I'm pretty sure that even the patched version of Apple HD SC Setup won't work until I figure out why these commands are failing. The reason it works when pretending it's a ST225N is because there are other flags in the drive table that tell Apple HD SC Setup to change its behavior for each drive, and apparently the flags for the ST225N don't cause any of these extra commands to get sent.

 

dougg3

Well-known member
OK, nightly update. I figured out what's going on with the read-write error recovery page.

It looks like to make it work with Drive Setup, there was a hack to make it assume the DBD bit is always set (disable block descriptors) during mode sense requests, so the replies never return a block descriptor. The reason was so the allocation length would be big enough to contain the format device page, and the standard doesn't require you to return a block descriptor. I read about that in the comments--makes sense, still follows the SCSI standard.

Well, it turns out that Apple HD SC Setup assumes the drive always includes a block descriptor in mode sense replies. Technically this is against the SCSI standard because drives are not required to include a block descriptor in mode sense replies, but in practice it looks like real drives tend to always include a block descriptor. With the length it was asking for when requesting the read-write error recovery page, it was going past the end of the actual page length and causing an error. Anyway, if I change it so that drives always include a block descriptor when the DBD bit is 0, everything works OK and I get past that first problem.

It also appears that drives tend to include as much data as they can when the allocation length is too short rather than error out. So to (hopefully) make it work, I've changed the code so if the allocation length is too short, it simply truncates the response to the allocation length instead of returning an error. This should fix the case described in the comments about Drive Setup not providing a big enough allocation length. I've also verified this is how a real SCSI hard drive would respond.

Now I'm past that page problem and I'm at the point where Apple HD SC Setup is sending a command that SCSI2SD doesn't yet know how to handle. I'll fix that shortly, but first some very good news:

During my disassembly of Apple HD SC Setup, I noticed that the code pays attention to whether the command key is pressed when you click Initialize. Sure enough, if the command key is pressed, it completely skips the low level part of the formatting which means it formats really quickly. This also makes it skip the unknown command, so it actually works! It definitely gives the full usable drive space too. I just formatted a 2 GB SD card and it came out to 1,883.7 MB available.

This is true for Apple HD SC Setup 7.3.5. Unfortunately older versions such as 7.0.1 don't have the command key trick, but they also seem to not try the bad command that causes an error. Sadly this means they will format slowly though. (The older versions also assume that the special drive name is a small 20 MB drive. Grrrrrrr....)

So in conclusion: I'll make it completely work soon if someone's crazy enough to want to do a low level format without holding down the command key, but with the changes I described (add the read-write error recovery page, fix the block descriptor thing, set manufacturer to "x" followed by seven spaces, set drive model to all spaces), it works as long as you hold down the command key when you click Initialize and you have a new enough version of Apple HD SC Setup. I'll get some patches ready soon. I'll also verify it still works with Drive Setup.

Edit: Oh, wow. So even though it defaults to 18.6 MB when you have the Seagate drive model, that's just a default partition size. You can click Partition and then click Custom, and that will let you delete the partition and create a new one that fills the entire drive. In other words, I didn't need to do any of this work in the first place...it works with the SEAGATE ST225N drive name, just kind of in a confusing way. The internal drive size database is used, but it's only for determining a default partition size. It's not blocking you from using the rest of the drive. Oh well...all the things I found will still probably help reliability.

 

dougg3

Well-known member
And one last reply about this. The unsupported command it was failing on was the VERIFY command. It does a verify where it only wants the drive to verify the medium without comparing it against data. Basically just making sure the drive is OK. So I made it return success. There's also a way for it to send data to verify against, but I was too lazy to implement that command (and Apple HD SC Setup doesn't use it anyway).

Anyway, with that final change in place, everything works fine now.

In conclusion:

When configured with the SEAGATE ST225N drive name, it works fine but defaults to a small partition because it assumes the drive is 20 MB. You can click Partition and then go to Custom to fix that after the fact though.

If you pick other drive types, it may fail with various errors, but that's because of unimplemented commands (which I implemented, and it works great now).

 

techknight

Well-known member
I enjoyed your last post. Work all the way through the issue just to find out that it can be solved using a much simpler method. Been there done that with similar projects. :)

 

dougg3

Well-known member
I enjoyed your last post. Work all the way through the issue just to find out that it can be solved using a much simpler method. Been there done that with similar projects. :)
Haha, it's always fun when it ends like that. A good learning experience either way!

 

Trash80toHP_Mini

NIGHT STALKER
< nested quote for *|\^%+^>^?#$^<#&^* page rollover continuity! :p >

I enjoyed your last post. Work all the way through the issue just to find out that it can be solved using a much simpler method. Been there done that with similar projects. :)
Haha, it's always fun when it ends like that. A good learning experience either way!
I picked a good night to try to catch up on this thread. It's the journey that teaches the most important lessons, arrival is the icing on the cake. Great work, doug!

 

uniserver

Well-known member
cool man so i got my thingie in… from seeed

i honestly have no idea what i am to do with it.

should i solder these headers on?

looks like its got a

micro usb connection

power plug for 7.5v

a momentary pushbutton switch

another switch that says 3v3_VCC_5v

i figured i would PM you but then again maybe more people might learn something?

[attachment=0]IMG_1227.jpg[/attachment]

 

techknight

Well-known member
Thats an arduino clone.

they can be fun, but it aint no SCSI2SD.

I have a smaller lower powered arduino that I use for quickly prototyping MCU based circuitry. Its handy, as you have a full compliment of I/O including ADCs, interrupts, etc.. and you have a USB UART as well. ;-)

 

techknight

Well-known member
its what i need in order to program the SCSI2SD, that is why i got it

Oh? Hmm i didnt know that. Well it is running A Mega32U4, So that microcontroller can be reprogrammed to repurpose for anything I suppose. As the U4 supports the ability to have its USB stack to be programmed for anything.

The older arduino that I have, uses a FTDI232 which was only serial port USB, thats it

 

uniserver

Well-known member
SCSI2SD_V3.0.jpg.1adaf7d0740143735a04d0dd83cb7265.jpg
 

uniserver

Well-known member
he said that it works

I've just been successful at using an Arduino to flash the device.
but he also said:

I'll upload the Arduino programmer source code after I clean it up a bit.
some tidbits:

The Arduino must:1) Operate at 5V (ie. AVR based !)

2) Have 32kb or more of flash

3) Run at 16MHz.
some links:

http://www.seeedstudio.com/depot/seeeduino-lite-p-1487.html

http://imall.iteadstudio.com/development-platform/arduino/arduino-compatible-mainboard/itaeduino-leonardo.html

 

mmcmaster

Active member
Yes, it is possible to use an Arduino to program the SCSI2SD. I haven't posted it publically yet because I'm unsure of the Copyright status of the example code I modified from a Cypress Application Note.

I'm still trying to get an alternate solution working with OpenOCD. I plan to use the "Remote Bitbang" OpenOCD interface with the "socat" utility to redirect a socket through the USB Serial device.

Powerbook PCB is practically done, I just need some test hardware! I've posted in the trading forum in the search of a Powerbook.

 

uniserver

Well-known member
you got it man let me send you my 520. its just shipping! I know its over 4 LBS. so that means expensive.

here let me get a specific price for a medium flat rate box, to AU.

Priority Mail International®

Expected Delivery Date

Price Online Price

Priority Mail International® Medium Flat Rate Box

USPS-Produced Box: 13-5/8" x 11-7/8" x 3-3/8" or 11" x 8-1/2" x 5-1/2"

Maximum weight 20 pounds.

6 - 10 business days to many major markets1, 2

$61.75

$58.65

so i can buy postage online for $58.65 is a 520 worth that shipping?

its up to you man if so .. np i can send it asap!

 

mmcmaster

Active member
Arduino programming details:

download:

http://www.codesrc.com/files/swdprog.tar.gz

Should work on 16MHz Arduino's with >= 32kb flash. A copy of the SCSI2SD bootloader is encoded within the Arduino sketch itself.

There are 3 wires that must be connected. These pins are labelled on the SCSI2SD board. On the Arduino, connect the wires as follows:

SWDIO Pin 12

SWDCK Pin 11

XRES Pin 10

 

cb88

Well-known member
cool... I'll be watching for the 2.5in version I need one to go in my sparcbook which has scsi-2.

Considering how cheap AVRs are... perhaps an ATTiny or something with USB could be added to the PCB to handle programming directly?

 
Top