davidgiven / fluxengine

PSOC5 floppy disk imaging interface
MIT License
356 stars 68 forks source link

Can't get current fluxengine to work with greaseweazle on Linux #679

Closed qbarnes closed 1 year ago

qbarnes commented 1 year ago

I'm having bootstrapping problems with fluxengine on Linux (Fedora 37), but I'm stuck at this point. I admit this is in all likelihood a stupid user problem.

I did a build of fluxengine on the master branch (commit 2bef6ca). When running the commands below, although the drive select light turns on, the drive doesn't spin and the command usually just hangs until I ^C it (sometimes I'll hear what I think is a head seek). But doing the same thing with Keir's gw works fine.

$ sudo ./fluxengine rpm -s drive:0
      Using GreaseWeazle GW001B00383438510C36383538 on /dev/ttyACM0
^C
$ sudo ./fluxengine inspect -s drive:0
      Using GreaseWeazle GW001B00383438510C36383538 on /dev/ttyACM0
^C

Here's similar stuff with gw using the same system:

$ sudo gw info                                      
Host Tools: 1.11
Device:
  Port:     /dev/ttyACM0
  Model:    Greaseweazle F7 Plus (Ant Goffart, v2)
  MCU:      216MHz, 256kB SRAM
  Firmware: 1.3
  Serial:   GW001B00383438510C36383538
  USB Rate: Full Speed (12 Mbit/s)

$ sudo gw rpm --drive 0
Rate: 360.029 rpm ; Period: 166.653 ms

$ sudo gw read --drive 0 --format ibm.1200 test1.scp
Reading c=0-79:h=0-1 revs=2
Format ibm.1200
T0.0: IBM MFM (15/15 sectors) from Raw Flux (134931 flux in 333.83ms)
T0.1: IBM MFM (15/15 sectors) from Raw Flux (155802 flux in 333.83ms)
T1.0: IBM MFM (15/15 sectors) from Raw Flux (140044 flux in 333.83ms)
[...]

This is with a 5.25" drive with a IBM PC HD written diskette.

Is there another commit or tag I should try?

Is there something else I should be doing?

If it is a problem with flexengine, anything I can do to gather more information?

davidgiven commented 1 year ago

Are you using a Shugart interface drive? If so, you'll have to tell FluxEngine --- IIRC, gw defaults to Shugart, but fluxengine defaults to PC. Try:

./fluxengine rpm shugart_drive -s drive:0
qbarnes commented 1 year ago

What I'm using here is a Mitsubishi MF504C-318UG floppy drive. As far as I had seen (including reading its documentation), it doesn't mention Shugart at all anywhere, only discussing using it in IBM PCs, so I had assumed this fell under "PC", not "Shugart" insofar its use with fluxengine. I'm also using a PC floppy drive cable between the Greaseweazle and the drive (one with the half-twist in it). But given how late generation the MF504C is, this makes me wonder if all 5.25" drives with the 34-pin interface will always be a Shugart.

I had read the section on Shugart drives on this page. The page wasn't helpful to me understanding what the differences are and how it factors in when used with fluxengine. (Also, the link http://cowlark.com/fluxengine/doc/disk-shugart_drive.html is unfinished. I would guess this is where answers to what's below would be?)

I have drives that I know are Shugart (some ancient 5.25" and 8" drives that were for sold for use with 8-bit systems), but I don't use them with the Greaseweazle. I always took Shugart to basically mean "pre-PC". But going through the MF504C's documentation just now, I see it can be strapped for 4 drives (four drive select lines). Is this a good tell that a given floppy drive is a wired with a Shugart interface? Is there a better way?

Anyway, adding the shugart_drive parameter did solve the problem for rpm:

$ sudo ./fluxengine rpm shugart_drive -s drive:0
      Using GreaseWeazle GW001B00383438510C36383538 on /dev/ttyACM0
Rotational period is 166.663 ms (360.009 rpm)

Thank you. for pointing out shugart_drive.

But I'm going to side-track this discussion for a bit. If you want me to open another issue, I will.

But I can't get anything else to work, even trying examples like on page: http://cowlark.com/fluxengine/doc/using.html. This example fails immediately with ENOENT:

$ sudo fluxengine read ibm1440                                       
Error: Cannot open 'ibm1440': No such file or directory

So it's not finding its internal configuration file? Is this a stale example or another stupid user problem?

Based on examples I've found on the web pages, I would expect for my use case to do something like:

$ sudo fluxengine read -s drive:0 --usb.greaseweazle.bus_type=SHUGART --drive.high_density=1 ibm1200
Error: Cannot open 'ibm1200': No such file or directory

Ok, same problem as above, so maybe try it without ibm1200 to see if the generic decoder as mentioned on the IBM PC format page will trigger?

$ sudo fluxengine read -s drive:0 --usb.greaseweazle.bus_type=SHUGART --drive.high_density=1                 
Error: no decoder configured

Nope, it wants an explicit decoder, but I can find no syntax that'll provide it.

Has the argument parsing changed, or what am I not following?

davidgiven commented 1 year ago

Yikes. Looks like the documentation has big problems --- sorry about that! I recently refactored a lot of stuff and it seems that both the autogeneration has failed and that I forgot to update some of the manually-generated stuff... although I could swear I remember doing it. Possibly it's another autogeneration failure.

Anyway: Shugart drives are documented here: http://cowlark.com/fluxengine/doc/drives.html#shugart-drives There's a link to the pinout. Yes, it's the drive select lines which are mostly different. The light coming on but the motor not starting is a very common tell.

Re actually using it: the parsing has changed, yes. Try this:

fluxengine read ibm --1200 -s drive:0 shugart_drive --drive.high_density=1

All the old formats ibm1440, ibm1200, ibm720 etc have now been grouped together, so that it's ibm --1200, ibm --1440, ibm --720 etc.

(The GUI should make all of this more obvious, BTW.)

I will fix things: there should be cut-and-paste examples for every format.

qbarnes commented 1 year ago

Thank you. That got me further, but still stuck:

$ sudo fluxengine read ibm --1200 -s drive:0 shugart_drive --drive.high_density=1
      OPTION: 1200kB 5.25" 80-track 15-sector DSHD
Measuring rotational speed...       Using GreaseWeazle GW001B00383438510C36383538 on /dev/ttyACM0
166.7ms (360.0rpm)
 0.0: Error: hard sectors are currently unsupported on the GreaseWeazel

I double-checked. The disk in this drive still reads just fine using gw as cited earlier.

This disk is definitely not a hard sectored. Any ideas?

(Note that "GreaseWeazle" is misspelled in this and three other error messages in the source. The lib/usb/greaseweazleusb.cc file is the only one that has these misspellings. Just a copy-and-paste problem.)

davidgiven commented 1 year ago

Okay, so I've overhauled the documentation, fixed the spelling (keirf is quite firm about the capitalisation, too) and found and fixed the stupid bug which was preventing the Greaseweazle from writing disks. PTAL?

qbarnes commented 1 year ago

Yay! First successful read! Thank you!

davidgiven commented 1 year ago

Excellent. Let me know how you get on.