alexthecat123 / ArduinoFile

An Arduino-based device for testing and emulating ProFile hard drives.
13 stars 2 forks source link

Drive formats and can backup a 5MB profile but wont boot #6

Open Gary-Clark opened 4 months ago

Gary-Clark commented 4 months ago

Hi

Not sure if your still actively supporting this but

I can connect the device to the parallel port of our Lisa, and format the image from the OS, back up a 5mb profile HD to it and all the files are there. I can read and write to the drive fine

However, it wont boot.

When I try to boot I get the

000000000A03 2 Read phase 2: Host didn't respond with a 55! Maybe the drive was reset?

Any ideas ?

alexthecat123 commented 4 months ago

Hi Gary,

Sorry you're having issues!

Two questions. First, what model of Lisa are you using? I'm assuming you're using a Lisa 1 or 2/5 based on the 5MB ProFile comment, but I just want to double-check that! Second, are you hooking the ArduinoFile to the built-in parallel port or to a port on a 2-port parallel card? There has been some ArduinoFile weirdness with parallel cards and with the 2/10, so let's try and rule that stuff out first. But the fact that you say the OS can read/write to the drive just fine seems to point to something else.

Are you trying to run LOS or some other operating system? If you're running LOS, then the procedure you seem to be describing of formatting the drive, copying all of the files over, and then rebooting the machine won't result in a bootable volume, so that could definitely explain things too. If this ends up being the problem and you don't feel like installing the OS from floppies yourself, I can provide a pre-installed bootable LOS image that you can just throw on your SD card and try out.

I hope we can get to the bottom of this! Alex

Gary-Clark commented 4 months ago

Hi, thanks for responding

Its a Lisa 2/5 with the single floppy and a 5MB profile and the emulator drive is plugged into the inbuilt parallel port.

I did wonder if I needed to do an install from the floppies but unfortunately the floppy drive is defective. I used the duplicate option from the Lisa OS to backup the drive but wasn't sure if that would make a bootable image.

Its a museum display machine and the Profile drive is making a lot of noise so I am wanting to make sure I have a booting drive if/when it fails but we want it to boot just like an original machine rather than use the selector.

A pre-installed version would be great :)

alexthecat123 commented 4 months ago

Yeah, that's almost certainly the problem! Duplicating the contents of the hard drive won't copy the system files over, so your new disk won't boot.

Do you want an image of LOS 2 or LOS 3? Or both? Don't worry, the LOS applications will work just fine on your Lisa despite our differing Lisa serial numbers because I wrote a program that disables the serialization check on all the LOS apps!

Gary-Clark commented 4 months ago

Both sounds ideal, cheers

Can you publish them on here for download ?.

I do need to fix the floppy on this machine, but its one of may jobs.

alexthecat123 commented 4 months ago

Sorry for the delay in getting back to you! My ArduinoFile SD card with all of my images somehow got corrupted, and I lost everything on it. Luckily, I had a backup of most stuff, but not the two images that I was going to send you since I made them fairly recently and hadn't backed them up yet. So I had to pull out a Lisa yesterday and remake them from scratch.

But I finally got them recreated, so here you go! Note that LOS 2 will sometimes fail to boot on your first boot attempt with an error code for some reason; try booting again and it'll work just fine. And sometimes LOS 2 will randomly reset the system during the boot process, but the same thing is true here as well; just try again and it'll work.

For whatever reason, Github won't let me attach files with a .image file extension, so I changed the extensions of both files to .txt, which is one of the allowed filetypes. Just change them both back to .image when you download everything. And since you said you'd rather not use the Selector, rename whichever image you want to use to profile.image in order to get the ArduinoFile to recognize it at power-on.

Let me know if these work. And if so, make sure that you can create documents in all of the apps without serialization issues. If not, we've got more troubleshooting to do!

LOS 2 - No Serialization On Apps.txt LOS 3 - No Serialization On Apps.txt

alexthecat123 commented 4 months ago

And as for fixing your floppy drive, it probably won't be too difficult. These floppy drives are the same ones that are used in the Mac, and they're pretty darn reliable. Some lubrication of the moving parts and a cleaning of the heads normally brings them back to life, although you might also have to replace the eject gear if you have the 800K drive upgrade installed in your Lisa. There are plenty of tutorials showing how to do all of this online since the drives are also used in the much more common Mac, so it really shouldn't be too bad!

Gary-Clark commented 4 months ago

You are a star !

Perfect timing as I will test these at the Museum on Friday when I am next in (shameless plug - Northwest Computer Museum - Leigh - UK) then close the issue when they work :) Rather than use the selector, the interface will be installed in the Profile case and made to look and operate just like the real thing (without the jet engine noise !)

Its amazing how versatile the Mega 2560 is. I used one for my Commodore 8050 GPIB disk drive emulator but its a shame there isn't a modern and faster but still 5V version.

alexthecat123 commented 4 months ago

Awesome! I'm excited to hear how it goes. That seems like a really cool little museum; if I'm ever in the UK, I'll have to go and visit!

Make sure not to throw out the original guts of the ProFile when you install the ArduinoFile in its case! I totally understand why you want to replace it with an emulator (I've got some really loud ProFiles myself), but it would be a huge shame to lose that original hardware.

Yeah, the Mega is pretty awesome, and actually has higher I/O speeds than the ESP32 according to some of my testing! I tried porting the ArduinoFile code over to the ESP32, but its GPIO is somehow slower than the Mega, and it couldn't even keep up with the 2/5's slower VIA speeds! It would be really awesome to get a faster Mega that's still 5V-tolerant, but I'm not super optimistic that it'll ever happen.

Gary-Clark commented 4 months ago

File downloaded and renamed profile.image, the Arduinofile started with the green LED lit and responds with

Switching to the 5MB ProFile spare table. ArduinoFile is ready!

With it plugged into the internal parallel port, the Lisa responds with error 85 and the Arduinofile responds with

000000000A03 Read phase 2: Host didn't respond with a 55! Maybe the drive was reset?

Booting from the profile I can see the Ardinofile and open its contents.

Tried both images but same errors.

Will try to get the floppy working so I can see if I can do an install from the disks

alexthecat123 commented 3 months ago

Sorry; I completely forgot to respond!

Yeah, trying to install from floppies sounds like a good idea just to eliminate that as a potential culprit, but I'm not super optimistic that it's the problem. To me, it's sounding like the boot ROM and ArduinoFile are falling out of sync during the command confirmation phase of the ProFile handshake. So either the Lisa isn't seeing the ArduinoFile's acknowledgement of 0x02 and its lowering of /BSY, or the ArduinoFile isn't seeing the Lisa's acknowledgment of those two conditions by putting 0x55 on the bus and raising /CMD.

It's just strange that this only happens during boot, but not later on. I guess the ArduinoFile and LOS are happy with each other's drive routine timings, but the ArduinoFile and the boot ROM aren't happy with each other's timings.

Do you have a logic analyzer by chance? That's probably the easiest way to troubleshoot this further, although we could also make some modifications to the code and troubleshoot that way if you don't.

Gary-Clark commented 3 months ago

Hi

Thanks, As the machine is at the museum, I only get to try things when I am there, so dont worry, any help is really appreciated :)

I do have a LA which I can use, so will try to capture the activity.

Would burning a different boot rom be worth it (and maybe one that could use the 800k floppy as the internal drives motor has failed and finding a replacement 400k drive is proving difficult ?)

alexthecat123 commented 3 months ago

Awesome! Whenever you get the chance, just connect your LA straight to the debug header on the ArduinoFile board and that will capture all the signals that we need to see!

Yeah, burning an 800K ROM sounds like a good idea in terms of ease of finding a replacement floppy, although keep in mind that you won't be able to mount the 800K drive in the Lisa without a special bracket.

The boot ROM doesn't have to be changed to work with an 800K drive; just the I/O board ROM has to be changed. I'd recommend replacing it with the universal 400K/800K version that I've attached, which will work with either type of drive and you'll never have to worry about it again!

Also, you might want to read this topic on LisaList2 so you know what to do if your drive does weird eject-related things once you get it installed.

What version of the boot ROM do you have? Come to think of it, I believe I've only tested the ArduinoFile with H and 3A ROMs, so anything earlier might cause some kind of problem. If so, we need to figure out what's going wrong and fix it!

25SSDSM6.BIN.zip

Gary-Clark commented 3 months ago

Hopefully these are the images I captured during a boot. The signals are ordered top to bottom with Parity as D0 and PD0 as D12

Haven't done any analysis myself yet due to museum activities.

NewFile1

NewFile2

Gary-Clark commented 3 months ago

Pic 2 is after pic 1 and is all the activity on the cable during a boot attempt.

alexthecat123 commented 3 months ago

Interesting...

So it looks like the handshake goes smoothly and almost makes it to the end, but then gets messed up at the last minute. The drive and Lisa complete their initial handshake, the command is transferred properly (as evidenced by the 000000000A03 that you see in your terminal), and then we move onto the command confirmation phase. At this point (all seen in the second trace), the Lisa is supposed to lower CMD, and the ProFile is supposed to respond by putting [command byte + 2] on the bus, so 0x02 in this case, followed by the ProFile lowering BSY. Then the Lisa acknowledges this by putting an 0x55 on the bus and raising CMD. Once this finishes, the ProFile reads the desired block, raises BSY when done, and then the actual data transfer can begin.

But what's happening here is that CMD is being raised before the ArduinoFile responds with 0x02 and raises BSY, which means that the Lisa is aborting the transfer. So I'm thinking that the Lisa is timing out and giving up on the read because it thinks that the drive is too slow and isn't responding at all. I guess this is a property of some of the older ROM revisions, because this timeout is much longer in the revision H CPU board ROMs. This seems to be supported by some of the comments in the CPU board ROM changelog.

So I guess you have two options. First, just upgrade to H ROMs. Or second, keep your ROMs, and let's try to fix this. Personally, I think the second option is the better idea, simply because I feel that it's important for ArduinoFile to work with as many ROM revisions as possible, but it's up to you! I wish I could just do some testing here myself, but college is about to start back and I just moved into my apartment, leaving my Lisa 2/5 behind at home, so the best that I can do is send you modified source code and get you to upload it and see what happens. Does that work? Or would you prefer to just swap out the ROMs?

And the reason why the Office System works with the disk just fine is simply that LOS doesn't use the ROM's disk routines at all; it has its own completely custom access routines baked right in. And those clearly have a much longer timeout than the ROM's!

At least we've figured out the issue now!

Gary-Clark commented 3 months ago

I will be happy to test any code you send. I agree that it would be a really good idea to get it to work on all ROM's

Thanks.

alexthecat123 commented 3 months ago

Great! Thanks for your willingness to help!

Give the two files that I've attached a try whenever you get the chance. Try Fix1 first, and then go for Fix2 after that. With Fix1, you will no longer see commands get printed over serial (although errors will still be printed), so just keep that in mind. Fix2 will still print commands, so it's the more desirable option, but it's less likely to fix the problem than Fix1.

If Fix1 ends up working, but Fix2 doesn't, then there's still a couple other things I could probably do in order to get it to print commands and still work with these older ROMs. But I don't want to put any effort into those sorts of changes until we have some data on these first two patch attempts!

Github won't let me attach files with an .ino extension, so I've changed the extensions to .txt. Just switch them back to .ino before opening things in the Arduino IDE. proFileEmulator_Fix2.txt proFileEmulator_Fix1.txt

Gary-Clark commented 3 months ago

Ok, fix 2 worked perfectly 👍 i didn't check the output from the serial terminal as my laptop battery ran out and I had forgot to take the charger, but it works.

System booting into LOS2 from the file you provided, however trying to boot from the LOS3 disk, it throws up a bad checksum error. I shared this image with someone on VCFED (i think they are the creator of the selector) and LOS3 wouldn't boot on their Lisa 2/5 but would on the 2/10 ?

Well chuffed though. The intent is to fit it in the space around the profile without removing any of it so the original disk can be run when wished and while the selector is a great thing for owners, as a museum piece, booting as it would have in the day is perfect.

Thank you, its greatly appreciated.

alexthecat123 commented 3 months ago

I'm glad that LOS 2 is working now, but it's really odd that LOS 3 still isn't working properly. I have no clue why it would work on Tom's 2/10, but not his 2/5. As far as I'm aware, Tom doesn't even have an ArduinoFile, so he was probably testing this on a Cameo/Aphid device instead, making the think that the image is to blame. Images should be interchangable between the two Lisa types (as long as they're both made on a ProFile and not on a Widget), but I made the image on a 2/5 and not a 2/10, so the fact that it doesn't work on the 2/5 really makes no sense whatsoever.

Do you have access to a floppy drive yet? It would be interesting to see if installing LOS from scratch on your Lisa would fix things.

It really seems like the issue here is with the image, not the ArduinoFile, but some questions just in case I'm wrong:

  1. Does the ArduinoFile print any sort of error in the serial console when LOS 3 is trying to boot?
  2. Does LOS 3 do any better if you use Fix 1 instead?
  3. When you say that it gives a checksum error, you're talking about LOS error 663, right?
Gary-Clark commented 3 months ago

Hi

Not managed to make any progress but I haven't been able to find a replacement floppy (motor has power but not rotating)

I believe its error 663 but all I remember is a box on initial boot that shows checksum error. Hopefully get back to the machine in a couple of weeks.

alexthecat123 commented 3 months ago

Sounds good! Just let me know when you make some more progress.