FDS technical drive control and reading.

Started by tommycom, July 24, 2023, 08:42:08 am

Previous topic - Next topic

tommycom

July 24, 2023, 08:42:08 am Last Edit: July 24, 2023, 10:44:12 am by tommycom
Alright! I'm messing around seeing what I can do with an Arduino connected to the disk drive, and have a few questions for anyone who knows about this stuff! I've tried this out on two drives so far, one of which at least seems to work perfectly with the famicom and ram adaptor, once i replaced the belt...

I currently have all the inputs and outputs connected directly (no pull up resistors). For read pin (9), i have a 10k resistor in series. I have no plans to connect the motor power pin (pin8 ). I'm also not doing anything with writing to disks yet... Also, I'm connecting both the +5v and ground, but I notice that one or the other of these may not be connected with the fdsloader? I don't really get why this is (my electronics knowledge is somewhat lacking). I've tried alternately disconnecting them, anyway, to mixed results, none of them right (and hoping that I haven't somehow put it into write mode in doing so, I'm not yet sure if I have one with the write disable circuitry in or not!)

Questions are:

How does stop motor work? It seems it is supposed to be kept high, and brought low briefly to stop the motor, but as far as i can tell, this does nothing? Also, i'm reading that scanning media bringing pin 3 low shouldn't work with this pin (12) set low, but it does? I've checked my soldering, and i think it is fine... What am i doing wrong?

Also, the battery pin (6) should go high when i start a scan, shouldn't it? But it isn't... The drives, as i said, work fine with the Famicom, so again, what could be happening?

Finally, and most importantly, i'm timing recieved read pulses on rising edge, and getting plenty of pulses of expected lengths for short, medium, and long, though I am getting a lot of non short pulses straight after the ready signal has been received, shouldn't there be like thousands of 0's on the start of a disk?

I'm also getting plenty that are far too short, or fall too far outside of the 10% that the ram adapter is apparently happy with, what could this be?

What am i doing wrong?  :bomb:  :mario:  :help:  Thanks to anyone that can help. Hoping to put something out for everyone using an Arduino, if i can get this to work!

P

I'm not sure that I'm much of a help at all as I haven't really tinkered with the disk drive anything myself, but here are my thoughts at least:

Quote from: tommycom on July 24, 2023, 08:42:08 amI'm connecting both the +5v and ground, but I notice that one or the other of these may not be connected with the fdsloader? I don't really get why this is (my electronics knowledge is somewhat lacking).
According to the FDSloadr documentation the ground pin (pin 6) is only connected when connecting the RAM Adapter to FDSloadr but not when connecting the disk drive to FDSloadr for some reason. It is supposedly used when RAM Adapter and disk drive are connected together though (I guess you could check the disk drive to make sure this pin is populated and used for something).

The +5V pin (pin 2) on the other hand is only used when connecting the disk drive to FDSloadr but not when connecting the RAM Adapter to FDSloadr.

I guess the disk drive receives +5V from the RAM Adapter to power some logic (the batteries or AC-adapter might only be for powering the motor) and in the case of the FDSloadr it must somehow be connected from a +5V source in the computer as the parallel port doesn't carry any +5V lines. In your case you can of course just use a +5V pin from your Arduino.


Quote from: tommycom on July 24, 2023, 08:42:08 amHow does stop motor work? It seems it is supposed to be kept high, and brought low briefly to stop the motor, but as far as i can tell, this does nothing? Also, i'm reading that scanning media bringing pin 3 low shouldn't work with this pin (12) set low, but it does? I've checked my soldering, and i think it is fine... What am i doing wrong?
According to the wiki the motor only reacts to the falling edge of pin 12 (meaning the moment when pin 12 goes from high to low). It shouldn't matter if it is set high or low, only the change from high to low matters. The wiki says nothing about the /media scan output not working when pin 12 is low either.
I guess the stop motor output is used after you have set the /scan media output to low and are done with the reading or writing of the disk.
You might want to check how the BIOS is doing things for all the details. Brad Taylor made a disassembly of it if you can read 6502 code.


Quote from: tommycom on July 24, 2023, 08:42:08 amAlso, the battery pin (6) should go high when i start a scan, shouldn't it? But it isn't... The drives, as i said, work fine with the Famicom, so again, what could be happening?
Yeah pin 6 should go high whenever the motor is ON. How long are you waiting for it to happen? The disk drive must have batteries or the AC-adapter plugged in to work.


The last question is beyond my knowledge, sorry.

tommycom

July 27, 2023, 05:36:43 am #2 Last Edit: July 27, 2023, 09:56:26 am by tommycom
Ah, well thanks for answering, anyway!

Quote from: undefinedAccording to the FDSloadr documentation the ground pin (pin 6) is only connected when

Having looked at this a lot, I think, and someone please correct me if I'm wrong about any of this, that in FDSloadr, the ground connection (pins 18-25 on the PC parallel port) are to be connected to FDS pin 4 whether you're connecting it to the RAM adaptor or to the FDS disk drive. But parallel port pin 15 is only to be joined to this if you're connecting it to the RAM adaptor, and this is only to let the FDSloadr software itself know that this is the mode that it is being used in (I guess that there must be internal pullup resistors within the PC on input pins in the parallel port, otherwise this would be left floating and be unreliable to be read?). The guide to making a cable for dumping disks using FDSloadr on famicomdisksystem.com definitely says to connect all of the grounds from parallel port 18-25, as well as from the usb that the +5v is to be gained from, anyway, and people must have had success with that.

Quote from: undefinedBrad Taylor made a disassembly of it if you can read 6502 code.

Yeah, I've looked at the disassembly a bit, helpful stuff. It seems there are a number of delays after ready signal received, before it starts reading any values totalling something like 272 milliseconds, plus some cycles, so the out of range pulse lengths right at the very start are likely normal.. Will have to have more of a look at this and add that delay. Doesn't explain the bad length pulses later on though. I haven't gotten any data that I can recognise from a disc yet... Been looking out for stuff from block 1, the *NINTENDO-HVC* string, for example (hopefully preceded by 00...00,80,01)

Quote from: undefinedThe wiki says nothing about the /media scan output not working when pin 12 is low either.

Regarding stop motor, it was this bit that I was referring to:
Register $4025 (write only):
bit 1  Electrically connected to pin 3 on RAM adaptor cable - pin 3, scan media
bit 0  Electrically connected to pin C on RAM adaptor cable - pin 12, motor stop
When active (0), causes disk drive motor to stop. During this time, $4025.1 has no effect.

And yet I haven't found this to be the case. I must be doing something wrong here, although it could well be, I guess, that it isn't in fact directly electrically connected, and the RAM adaptor itself is setting pin 3 high regardless of 4025.1 if 4025.0 is low. I very much doubt this, though. I have no easy way of checking this. Also, the motor is not stopping for me when I bring this pin low, so something is definitely wrong..

Regarding battery status:
battery status ($4033.7) "electrically connected to pin 6 on the RAM adaptor cable." "$4026 bit 7 must be set to 1 before the battery status can be checked via $4033 (otherwise it will always return 0)". So the question here is, does setting $4026 bit 7 send any signals outside of the ram adaptor to the disk drive somehow, or is this just a RAM adapter internal thing? Again, I don't have an easy way to verify this. I could record all of the signals coming out of the ram adaptor connector upon bringing the media present pin low on the bios screen, if I had a fancy oscilloscope. But I don't. The disassembly just shows a 0.15 second delay before the battery power pin is checked, which I'm already doing...

According to the "reverse engineered schematic, Shibesoft AS, FMD POWER-05" doc, the battery good signal seems to be taken from exactly the same place as the power LED on the disk drive, and that is lighting up, so you may be right about me not waiting long enough, I'll have to look into this first, as it seems easier than the rest...

Anyway, I'll keep at it. If anyone can help, please do! haha Cheers!


EDIT! been tinkering with breadboard, hoping not to see any magic smoke... what I've found slightly contradicts other info, but there you go.

power - You need +5v and ground connected to the disk drive.

scan media pin - bring low to scan media. If kept low, will continually scan. If put back high, motor will continue until it reaches outside, or wherever it is that it likes to park itself, then stop.

stop motor pin - bring low to instantly stop motor - WILL NOT stop motor if scan media is low, but will stop motor if it is kept low then scan media is brought high - so not edge detection. (additionally, bringing scan media low while stop motor is low will still perform the scan)

Also, my battery good pin is lighting an LED, but it is only initially bright. So I think my batteries may be nearly dead, and the RAM adapter is probably happier with measuring a lower (current? voltage? one of them, I don't know enough electronics!) as a "1" than an Arduino is..

now on to the false signal stuff i guess...

P

Yeah pin 15 is an input pin rather than a ground pin, it's probably only tied to ground as an input signal to FDSloadr as you say.

Yeah the stuff about the registers being electrically connected to this and that pin doesn't necessarily mean that the accessing these register addresses works exactly like reading or writing to the pins directly at all times (like would be the case if the CPU's data pins were directly connected to the pins). I would think that setting $4026 bit 7 is just a RAM adapter internal thing to make the battery status readable on the other register. The disk drive probably always outputs battery status.

The register system has a bunch of logic that checks if you are doing a read or write, to what address and acts accordingly, so what effects it has is entirely up to how the RAM Adapter was designed.
My point is that since you are working with the disk drive directly, all the information of how to control it via the RAM Adapter may not apply.


Well it sounds like the Nesdev wiki might be wrong on many things, which isn't exactly surprising giving how sparse the information on the FDS is. I often have to check Enri's homepage to fill in the holes in the wiki. I would like to fix it up some day when some question marks are ironed out. Thanks for sharing your discoveries.
If you don't get a lot of replies here you may want to consider posting on the Nesdev hardware forum as well. There are much more technical people there, although it tends to be a bit more NES-centric.


Battery charge is normally estimated by measuring the battery's voltage output under load (which is exactly what a multimeter does when set in the battery measure mode, and using the voltage measuring mode does not work correctly as the battery is not under load). If it doesn't deliver the rated voltage steadily enough, the battery is assumed to have not enough charge left to work correctly. It might actually deliver a bit above the rated value when full and it goes down below it as the electric charge depletes.

I read there is a method of using current as well, but that basically requires counting the output current particles (in Ampere) over time and multiplying it with the time (in seconds) to get the up til now used charge (in Coulomb which is the same as Ampere * seconds or As). You would need to know how much charge the battery had to begin with though, so this is probably only useful for mobile phones and the like with a dedicated battery.

It's best to use good quality batteries all with the same charge and of the same brand. I remember people mixing in all sorts of batteries and another one using too cheap batteries, and they all got the battery error on the FDS until they changed to new quality batteries.

tommycom

Quote from: P on July 28, 2023, 01:36:37 pmWell it sounds like the Nesdev wiki might be wrong on many things

Yeah, in writing Famicom emulator stuff it has been my observation that a load of technical info about NES stuff available online is either badly explained, ambiguous, lacking important detail/making assumptions about reader knowledge, guessed in a different way to the way that somebody else guessed it leading to incompatibilities between the two methods, or just plain wrong. Pulled my hair out on several occasions. Can't blame the people who wrote it though, doing it for nothing with basically nothing to go on, they've done a great job, all things considered, but there's a whole lot that could do with filling in, rewriting, updating, etc.!

Quote from: P on July 28, 2023, 01:36:37 pmyou may want to consider posting on the Nesdev hardware forum as well.

Yeah, I'll definitely check that forum out in future, if I need to!

Quote from: P on July 28, 2023, 01:36:37 pmI often have to check Enri's homepage to fill in the holes in the wiki.

Haha, I can read hiragana, and recognise about 3 kanji, but have no idea what 99% of what I'm reading is saying. I bet there's a good bit of info around for Japanese speakers.

Quote from: P on July 28, 2023, 01:36:37 pmI remember people mixing in all sorts of batteries and another one using too cheap batteries, and they all got the battery error on the FDS until they changed to new quality batteries.

I've done a good bit more work, and I'm starting to think that a lot of the problems I have been having are down to the batteries... (Famicom itself is now giving low battery warnings loading some games, but somewhat interestingly not all games. Probably just the ones that need to load more data all at once, I would guess). I've managed, a few times, to write some data to a disc (modified quick disc, I'm not messing with any proper ones!), and read back almost what I wrote, but with all of the pulses longer than the ones that I wrote by pretty much the same factor, as if the motor is running slower when reading them back than it did when writing them. At least I'm now pretty sure that that disc drive must be an early one, or been write disable modded. I'll have to open it up at some point.

I'll have to get some more batteries, or be brave enough to try it with an AC adaptor. Never done this before, conflicting info about what to actually use, and the whole plugging it into an Arduino/computer is just another layer of things that can possibly go wrong...



Skawo

The AC adapter has to be DC 9 Volts, with negative on the inside of the tip and positive on the outside.

I would absolutely recommend just getting one like that (or modifying a positive-tip adapter) and not using the batteries.

P

The Nesdev wiki is probably the best English source of Famicom/NES technicalities on the internet, and it is very accurate and up to date on most things thanks to the large Nesdev community. Unfortunately the FDS is not one of those things. Famicom-specific things in general are often less detailed on Nesdev as there is a bigger focus on NES than Famicom (simply because it is an English-speaking community).


Regarding Enri, I know many people go there using translation tools to seek information without knowing more than some kana basics. I also recommend the Firefox plugin Rikai-chan (continued now as Rikai-champ) for navigating Japanese websites.


Regarding power, the power FAQ has details of what AC-adapter to use with the FDS. It has the same specs as the Famicom (but not the same as the Twin Famicom), just a little lower power rating. The official AC-adapter's barrel size is 2.0 mm inner-diameter according to that, but 2.1 mm is the closest industry standard and should probably work. I think some people use a splitter to power both the Famicom and the FDS disk drive with the same AC-adapter (but you might want to use one with enough juice for both in that case).

Skawo