davidgiven / fluxengine

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

fluxengine rpm fails with Error: failed to receive command reply: No such device (it may have been disconnected) #122

Open evoncken opened 4 years ago

evoncken commented 4 years ago

Hi David, I finally got around to building the FluxEngine - impressive project, very clear instructions, thanks! ;-) I have a couple of Acorn BBC 5.25" disks that my BBC won't read, hence FluxEngine.

Today I flashed the latest precompiled binary and installed the latest Windows client on Windows 10 Pro v.1809. Connected the 'BBC' floppy drive (DS 80) to the board, USB to PC and tried the initial testing commands, see below. Blue LED keeps flashing troughout.

Note that I get different error messages over time. I tried pressing the reset button on the board to no avail, unplugged / replugged everything as well.

Perhaps relevant: I connected Ground to the pin next to 1.7, and soldered it across several pins on the second row of the IDC connector (adjacent to 1.7 till 1.2.0 SCL). I'm assuming they are ALL ground?

Any suggestion where to start looking?

First, rpm test with disc inserted - the drive motor sometimes spins up, but the command fails:

C:\Users\Ed\FluxEngine>fluxengine.exe rpm
Error: failed to receive command reply: No such device (it may have been disconnected)

C:\Users\Ed\FluxEngine>fluxengine.exe rpm
Error: bad USB reply 0x 3

C:\Users\Ed\FluxEngine>fluxengine.exe rpm
Error: bad USB reply 0x13

Voltage test with disc inserted - the drive motor does not always spin up; the command fails:

C:\Users\Ed\FluxEngine>fluxengine.exe test voltages
Error: failed to receive command reply: Operation timed out

C:\Users\Ed\FluxEngine>fluxengine.exe test voltages
Error: bad USB reply 0x 9

C:\Users\Ed\FluxEngine>fluxengine.exe test voltages
Error: bad USB reply 0x 3

C:\Users\Ed\FluxEngine>fluxengine.exe test voltages
Error: bad USB reply 0x15

C:\Users\Ed\FluxEngine>fluxengine.exe test voltages
Error: bad USB reply 0x 3

Bulk transport test with disc inserted - this also gives intermittent results

C:\Users\Ed\FluxEngine>fluxengine.exe test bulktransport
Error: bad USB reply 0x15

C:\Users\Ed\FluxEngine>fluxengine.exe test bulktransport
Transferred 1048576 bytes in 1156 (885 kB/s)
Error: bad USB reply 0x 3

C:\Users\Ed\FluxEngine>fluxengine.exe test bulktransport
Error: bad USB reply 0x 9

C:\Users\Ed\FluxEngine>fluxengine.exe test bulktransport
Transferred 1048576 bytes in 1157 (884 kB/s)
Error: bad USB reply 0x 3

Second try: C:\Users\Ed\FluxEngine>fluxengine.exe test voltages Error: bad USB reply 0x 3

C:\Users\Ed\FluxEngine>fluxengine.exe test bulktransport
Error: bad USB reply 0x15
evoncken commented 4 years ago

Note: issue verified using different micro-USB cable in different PC port, different BBC floppy drive (with different flatcable). Same results.

davidgiven commented 4 years ago

The 'bad USB reply' error usually means that the device and the computer have got out of sync. I still haven't figured out a way to reset them in software; you need to unplug and reattach the FluxEngine manually. USB is a nightmare.

That said, I rather cocked up the last release by changing the firmware (and the client) but forgetting to update the internal version number. This means that it's possible to use the client with the wrong firmware, and vice versa, at which point they'll get very confused and you'll get these errors, so please double check that you have the latest firmware and the appropriate client.

Re grounding pins: all the odd-numbered pins should be connected together at the drive, so you only need to ground one of them. That said connecting more can't do any harm and can only help if the drive is weird.

Right now I'm on holiday and away from my hardware so my ability to fix things is limited, but I did get a report from someone else that something's not right --- I'll look into this and fix it ASAP when I get back. (It's possible I just checked in the wrong firmware binary...) Until then, unless resetting the board helps things, the only way forward is to install the PSoC development kit and build the firmware yourself. Sorry for the inconvenience.

evoncken commented 4 years ago

No problem, enjoy you holidays - I'll try and build the firmware

evoncken commented 4 years ago

Hi David, I rebuilt the firmware (from github, 2020-01-08) and flashed it. I did not replace / rebuild the fluxengine.exe on my Win10 box (file modified date 2019-‎12-‎14 ‏‎20:56; CR32 25F55859).

This does not seem to solve the issues. I'll need to look into rebuilding the Windows client, or perhaps switch to MacOSX / Linux as I'm more familiar with Unix.

davidgiven commented 4 years ago

I've just rebuilt everything, bumped the protocol number (so as to prevent client/device mismatches) and pushed the new release. It sounds like you're seeing something else going wrong, but in the interests of double checking, could you try https://github.com/davidgiven/fluxengine/releases/tag/FluxEngine-Windows-client-version-261 please?

Assuming that fails too, please try fluxengine test bulktransport with the floppy disk drive disconnected. It occurs to me you may have ground loop style problems (although it seems unlikely). If that still fails, then there's a board issue which is completely unrelated to the drive.

evoncken commented 4 years ago

I downloaded and installed the new versions; ran a couple of tests.

The "fluxengine rpm" test always fails with the "disconnected" error - with or without a drive connected:

C:\Program Files (x86)\FluxEngine>fluxengine.exe rpm
Error: failed to receive command reply: No such device (it may have been disconnected)

This error message is accompanied by the Windows "unplug device" sound, I just realized. So the board actually seems to drop off the USB bus.

With no drive connected, there cannot be any ground loops. I've checked my soldering, no shorts likely. About the only thing left to replace is the PC itself ;-) I'll try and connect everything up to a Mac, see if that yields different results.

davidgiven commented 4 years ago

Ah! I know what's going on! I'm sorry, I should have realised this earlier...

I bet the BBC drive has no index sensor. Many 8-bit floppy drives didn't. FluxEngine relies on the sensor to figure out when to start and stop sampling, because it expects to be plugged into a modern PC drive.

It is possible to spoof the index sensor on the drive by patching a wire from 3.1 (for 360 RPM drives) from the FluxEngine to the index sensor logic on the drive; you need this to read flippy drives. But that's rather an advanced technique. See http://cowlark.com/fluxengine/doc/Index_sensor_mod_FDD_1.1.pdf for all the juicy details. But that's really intended for tricking the drive into returning data (modern drives won't return anything until they sense that the disk is up to speed).

For spoofing the FluxEngine itself I'd need to route that signal internally. Fairly easily done; let me have a go...

evoncken commented 4 years ago

Ha! ;-) Let me first go search my junk heap^W^W meticulously organised warehouse for a 5.25" PC floppy drive - pretty sure I have one or more laying around.

Thanks for spending your time helping me, by the way!

davidgiven commented 4 years ago

I've just pushed a change --- a new release will show up on github in a few minutes. Now you can add --index-source=1 for fake 300RPM index pulses or 2 for fake 360RPM index pulses. Let me know if this works for you?

There's also an actually meaningful response if rpm doesn't detect index pulses --- long overdue, as this happens whenever you use it with no disk in the drive...

evoncken commented 4 years ago

Updated firmware and client - interesting behaviour with my Acorn DFS disk in Acorn 5.25" drive, with --index-mode=2 option:

The option does not work with "rpm" or "test" commands, but that's normal I guess? Might be nice to see "rpm" command report the fake RPM.

Unfortunately, all attempts to read data from disk still fail (known good disk, readable by Master in same drive)

C:\Users\Ed\Downloads\fluxengine-267>fluxengine read dfs -s :d=0 --index-mode=2
Reading from: :d=0:s=0:t=0-79
[ ... ]
  0.0: 331 ms in 31360 bytes
       giving up
       0 bytes decoded.
C:\Users\Ed\Downloads\fluxengine-267>fluxengine read dfs -s :d=1 --index-mode=2
Reading from: :d=1:s=0:t=0-79
[ ... ]
  0.0: 329 ms in 147628 bytes
       giving up
       0 bytes decoded.
davidgiven commented 4 years ago

That sounds like the drive is jumpered to respond to drive #0. PC drives should be set to respond to drive #1, both of them, and the twist in the cable lets the FDC address either drive. The easiest solution here is to find and change the jumper setting on the drive.

evoncken commented 4 years ago

I just connected one of my 5.25" PC floppy drives; looking good! Without disk inserted:

C:\Users\Ed\Downloads\fluxengine-267>fluxengine.exe rpm
No index pulses detected from the disk. Common causes of this are:
  - no drive is connected
  - the drive doesn't have an index sensor (e.g. BBC Micro drives)
  - the disk has no index holes (e.g. reversed flippy disks)
  - (most common) no disk is inserted in the drive!

With floppy inserted:

C:\Users\Ed\Downloads\fluxengine-267>fluxengine.exe rpm
Rotational period is 200 ms (300 rpm)

Next up: see that it actually reads the disk (could be a floppy head alignment mismatch - not sure if there's anything to tune). Thanks for all your help so far, much appreciated!

evoncken commented 4 years ago

Note: will re-test with old BBC floppy drive ASAP now I've verified that everything basically works with a more modern drive.

ch0mik commented 4 years ago

Hi, I have the same problem https://obrazki.elektroda.pl/2770627400_1579946929.jpg. Im trying read Amiga disk on PC 3,5 Floppy Drive. Im trying RPM too - but the same error.

davidgiven commented 4 years ago

@ch0mik That sounds like a different issue (as it's a normal PC drive) --- could you open a different bug?

evoncken commented 4 years ago

Hi David, as promised re-tested with same software versions to test the new "--index-mode" feature.

I used:

Reset the fluxengine board between attempts.

fluxengine read dfs -s :d=0 --index-mode=1

This DOES spins up the motor, does NOT step the heads. No data read/decoded.

fluxengine read dfs -s :d=1 --index-mode=1

This does NOT spin up the motor, but DOES step the heads. No data read/decoded.

I tried the same with --index-mode=2; no difference (mode 1 = 5.25", mode 2 = 3.5" ?)

The error message that I got without --index-mode are gone, but still no data being read.

I tried "fluxengine inspect", but that reports that no clock was detected:

fluxengine.exe inspect -s :d=0:s=0:t=12 --index-mode=1
[ ... all zeroes reported .. ]
Noise floor:  0
Signal level: 0
Peak start:   0 (0.00 us)
Peak end:     255 (21.25 us)
Median:       0 (0.00 us)
0.00 us clock detected.

There's something strange going on :-) Perhaps the artificial index pulses are not "seen" by the decoding engine?

davidgiven commented 4 years ago

I'm sorry, I thought I'd replied to this.

Spinning the motor but not stepping the heads is exactly the symptoms seem if the drive is configured internally to be on drive 0. Modern floppy drive cables with the twist rely on the both drives being jumpered to drive 1. Can you check the jumpers (if you have the data sheet for the drive)?

Gandalf-ND commented 4 years ago

A bit off-topic but... 8" floppies have the index hole in different physical locations so a DS/DD floppy in a SS/SD drive will not give off any index pulses. I was caught by this when my first trial run with an 8" drive failed miserably. :-)

8" drives for DS/DD usually have two sensors so the index pulse is physically shifted a certain angle between SS/SD and DS/DD floppies.

You might want to add 8" DS/DD floppy in an SS/SD drive to the error message in fluxengine rpm as a possible reason it doesn't work.

ch0mik commented 3 years ago

https://obrazki.elektroda.pl/2319567800_1615122708.png

Another floppy drive works with my FluxEngine!

https://www.youtube.com/watch?v=BbFkaMgtkto&ab_channel=8-Bitz