LisaList2

Advanced search  

News:

2019.06.07 fixed NChat for the "Curve" theme, will eventually move it to its own page and add it to the default theme as well. Other plugins are next. see post in the Meta board for details

Pages: [1]   Go Down

Author Topic: An Arduino-Based Parallel Port Hard Drive Troubleshooter  (Read 229 times)

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
An Arduino-Based Parallel Port Hard Drive Troubleshooter
« on: September 06, 2021, 05:10:36 pm »

I've been working on an interesting project for around a week or so that I figured you guys would want to know about! I built myself a USBWidEx a month or so ago and I really love the functionality that it provides, but it was pretty hard to find the Renesas processor that it requires and I ended up destroying 3 processors and 2 boards since I suck at such fine surface-mount soldering.

In order to remedy these two issues, I decided to try and build my own USBWidEx-like device using an Arduino Mega and a simple breakout board that only uses through-hole components. This was my first time trying to emulate a communications protocol like this and I was worried that it wouldn't work, but luckily it seems that my fears weren't justified.

My device communicates with the modern computer using a terminal emulator just like USBWidEx does and it uses XMODEM to transmit and receive drive image files. So far, it can read and interpret the spare table, read and write to any block that the user specifies, and backup and restore the entire drive to a file. It works great with my ProFiles and Widget, but random data errors crop up when I try to use it with a Cameo/Aphid for some reason, so I'll need to look into that some more. I've attached some pictures showing the device in action.

The SD card slot on the board is for the next phase of this project, where I hope to make the board emulate a ProFile in addition to communicating with one, but I'm skeptical about the Arduino being fast enough to emulate a drive since the host, not the drive, sets the pace of communication.

Once I add more functionality and get some more of the bugs worked out, I'll make sure to release the (sloppily written but functional) code so that other people can build their own. In case you can't tell, I'm pretty excited about this project! Let me know what you guys think and tell me if you have any tips or suggestions!
Logged

stepleton

  • Sr. Member
  • ****
  • Karma: +64/-0
  • Online Online
  • Posts: 226
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #1 on: September 06, 2021, 05:19:34 pm »

Wow, awesome! Congratulations on this new gizmo!

Quote
It works great with my ProFiles and Widget, but random data errors crop up when I try to use it with a Cameo/Aphid for some reason, so I'll need to look into that some more.

Oh yes, please let me know if you find anything out there. If it's OK with the real drive then any emulator ought to be able to deal with it too! (Unless it's the Xenix ProFile driver --- that's just weird.) I wonder if it's timing out on you --- there was an update to the software on 20 June that removed some timeout assumptions that had been there previously.
Logged

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #2 on: September 06, 2021, 06:33:43 pm »

Thanks! I'm using the latest version of the Cameo/Aphid software, so unfortunately that doesn't fix the issue. I'll keep looking and I'll try to figure out what the problem is! My guess is that it has something to do with the Arduino being slower at communicating with the drive than a Lisa, Apple III, or USBWidEx would be.
Logged

rayarachelian

  • Administrator
  • Hero Member
  • *****
  • Karma: +32/-1
  • Offline Offline
  • Posts: 580
  • "But what's puzzling you is the nature of my game"
    • LisaEm
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #3 on: September 06, 2021, 06:47:12 pm »

Very nice!
Logged
When you tear out a man's tongue, you are not proving him a liar, you're only telling the world that you fear what he might say. - GRRM

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #4 on: September 19, 2021, 05:48:47 pm »

I just uploaded the source code and a description of the device to GitHub, so feel free to check it out if you guys are interested!

It still doesn't work with the Cameo/Aphid, so I'll have to keep looking into that issue.

By the way, I tried using the Arduino to emulate a ProFile and it kind of worked, but it just couldn't always keep up with the strobe pulses from the Lisa.

Let me know what you guys think and if you have any suggestions!

« Last Edit: September 19, 2021, 09:20:34 pm by AlexTheCat123 »
Logged

stepleton

  • Sr. Member
  • ****
  • Karma: +64/-0
  • Online Online
  • Posts: 226
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #5 on: September 19, 2021, 05:56:19 pm »

Gotta be honest... call me thin-skinned if you like, but being close relations to a few folks who work in child welfare, I'm not a big fan of the name. I'm unlikely to have much to do with it as-is.
Logged

blusnowkitty

  • Sr. Member
  • ****
  • Karma: +44/-0
  • Offline Offline
  • Posts: 139
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #6 on: September 19, 2021, 07:02:34 pm »

As much as I appreciate the hardware and software engineering effort and as much as I like puns and wordplay,

Uh, really?
Logged
You haven't lived until you've heard the sound of a Sony 400k drive.

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #7 on: September 19, 2021, 07:26:02 pm »

I'm sorry if I offended anybody with the name. That really wasn't my intent. I have a pretty dark sense of humor sometimes and I guess this is a situation where I should just keep it to myself. I've changed the name to ArduinoFile in the interim while I think of a better name. Once again, I really didn't mean to upset anyone with the name and I'm really sorry if I did. Now that I've given it a less offensive name, hopefully people will feel more comfortable using it.

https://github.com/alexthecat123/ArduinoFile
Logged

stepleton

  • Sr. Member
  • ****
  • Karma: +64/-0
  • Online Online
  • Posts: 226
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #8 on: September 19, 2021, 08:24:22 pm »

No worries, and thanks for making the change. I'm looking forward to checking it out! (It may have to wait until after I move, though.)
Thanks also for sharing the materials.

I wonder if there's a way to keep up with that strobe pin. Maybe you could do it with AVR assembly? I don't know a lot about Arduino programming, so I'm not sure how much headroom there is for improvements over the Arduino C compiler, but maybe there could be enough?
Logged

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #9 on: September 19, 2021, 09:20:09 pm »

Quote
I wonder if there's a way to keep up with that strobe pin. Maybe you could do it with AVR assembly? I don't know a lot about Arduino programming, so I'm not sure how much headroom there is for improvements over the Arduino C compiler, but maybe there could be enough?

That's a good thought! I'm not very experienced with assembly, but I will definitely check it out and see if I can optimize things that way. A faster Arduino like the Due or something like an ESP32 would be more than fast enough, but they use 3.3V logic levels and one of my major goals with this project was to avoid any sort of level shifting for simplicity's sake, so I really hope that your AVR assembly suggestion works out!
Logged

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #10 on: September 23, 2021, 11:35:02 am »

Good news! I think I've managed to optimize things enough to keep up with the strobe, at least at the speed that the Lisa and USBWidEx pulse it. I don't know if it's fast enough for the Apple III and I don't have one to test it with, so I guess that will remain unknown. Luckily, I didn't have to resort to assembly at all; optimizing my C code was enough. I haven't had a formal education in computer science yet (I just started college a month ago), so many of the inefficiencies were probably stupid things that would have been obvious to anyone who has more experience with software development. Hopefully I'll have a prototype of the ProFile emulator going in a few days.
Logged

stepleton

  • Sr. Member
  • ****
  • Karma: +64/-0
  • Online Online
  • Posts: 226
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #11 on: September 23, 2021, 04:56:45 pm »

Wow, neat! So is the plan to interface with an SD card reader? All of these things are really very inexpensive!
Logged

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #12 on: September 23, 2021, 08:28:47 pm »

Quote
So is the plan to interface with an SD card reader? All of these things are really very inexpensive!
Yep! I got a little microSD breakout board off eBay for $3 and it handles all the logic level conversion for you, so I can just plug it into a header on my PCB and I'm ready to go. My goal with this project is to make it as cheap as possible and I think I'm doing pretty well with that so far!
Logged

stepleton

  • Sr. Member
  • ****
  • Karma: +64/-0
  • Online Online
  • Posts: 226
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #13 on: September 23, 2021, 08:58:18 pm »

Outstanding!

Now, it may be more of a programming exercise than an Arduino is ready to handle, but if you implement the protocol described at https://github.com/stepleton/cameo/blob/master/aphid/selector/PROTOCOL.md, your device will be compatible with the Cameo/Aphid selector program.

You know, you might be able to do it. I think you'd have to lean a lot on the filesystem on the SD card (assuming you choose to go with a filesystem at all): you could implement the key/value store by means of special files containing the data. But the Arduino's 2K of RAM may start to feel pretty cramped --- it looks like the libraries you'd need will consume half a kilobyte all on their own.

But that's probably getting ahead of things. A ProFile emulator made out of an Arduino is plenty awesome all on its own.
Logged

AlexTheCat123

  • Sr. Member
  • ****
  • Karma: +14/-0
  • Offline Offline
  • Posts: 85
Re: An Arduino-Based Parallel Port Hard Drive Troubleshooter
« Reply #14 on: September 24, 2021, 12:02:22 pm »

Once I get things up and running reliably, I'll definitely try to get the Selector protocol working! That would be a really nice addition to the emulator.

The Arduino Mega, which is what I'm using for this project, actually has 8K of RAM instead of the 2K of the other Arduino boards, so luckily RAM almost certainly won't be an issue! I originally wanted to go with an Uno or a Nano to make the device a lot smaller, but the ArduinoFile code just wouldn't fit in that limited RAM, so I had to go with the Mega instead. The emulator code should be somewhat less complicated than the ArduinoFile code since we don't have to deal with making a user interface, error-checking user input, and so on, so the emulator might actually be able to run on a 2K board instead of requiring the Mega.
Logged
Pages: [1]   Go Up