ST506 is possible #644
Replies: 7 comments 16 replies
-
The constraints of the current Gotek hardware and the need for an interface board anyway raises the question: Why not port to rp2040? The Pi Zero board would be quite convenient to solder direct to an interface+buffers board. The main thing I'm not clear on is how STM32 peripherals translate across: eg stm32 idiom is to lean on timers+dma a lot, but I haven't seen how/whether these concepts port across to the rp2040 pio engines? The other thing is if you wait a bit longer (hopefully just weeks) you'll get Gotek board with AT32F435, 384kB RAM configurable up to 512kB, and 288MHZ Cortex-M4. Which would be a lot more comfortable for HDD emulation! |
Beta Was this translation helpful? Give feedback.
-
When I started I knew PIO with rp2040 would make it much easier, but I had not designed a board before and it would require more involved porting which would have its own set of headaches. In short, I didn't want to boil the ocean, especially since I knew I also had the option to replace the stm32 chip. Originally I thought the Cortext-M3 at 72 MHz was the primary limiting factor. So it was mainly a question of "can I produce efficient enough code" for a few critical sections. I hadn't found the DMA controller documentation so I hadn't realized how slow DMA is nor fully understood the memory bus organization. And I definitely hadn't read the AHB-Lite documentation to learn about batched accesses to explain rare bit flips. The AT32F435 would be very welcome, and would allow more features. Things are actually working with the STM32F105, but it is hard to acquire for any new interested users. The flash space would be nice; I disabled SD support to make space for my ST506 work. The extra memory would allow for more platters, although I don't personally have a strong need for that. |
Beta Was this translation helpful? Give feedback.
-
You can do that approach some. But we wouldn't need to use timers for RD and WD; those would be PIO programs. There is no need to do bit banging with the Cortext on the rp2040 in talking with peripherals like the screen as well, also because of PIO. |
Beta Was this translation helpful? Give feedback.
-
Update: I did clean up the st506 branch a reasonable amount so it is now semi-comprehensible. But within a week of my first post my Vector 4 stopped responding when powered on so I have even more hardware needing repair before I can usefully test this work. (I do have FF_TestBed hacked to help testing, but a retro machine is the real litmus test.) |
Beta Was this translation helpful? Give feedback.
-
@ejona86 I have 4 samples of the new 435-based board. Email me if you'd like one. |
Beta Was this translation helpful? Give feedback.
-
Necro-bump : There is still a demand for cheap(er) RLL/MFM emulators for ST506 controllers. Has this project been parked? Superceeded? I'd be curious to know if this would work with the Acorn ADK52, Atari MegaFile or Commodore A590 XT. |
Beta Was this translation helpful? Give feedback.
-
This solution would be very welcome as I have several machines with ST506's that need replacing at the museum and we can't afford DREM type solutions. What is the status and future of this project ? |
Beta Was this translation helpful? Give feedback.
-
ST506 is the common interface name used by "RLL" HDDs before IDE took over. It is very similar to floppy signaling, but is 5 MHz data rate (MFM is 10 MHz). Since the microcontroller on the Gotek is 72 MHz, that leaves only 7 cycles to process a half-bitcell, or 14 cycles for full bitcell/data bit. I was very uncertain whether it was possible, but it also wasn't clearly impossible... Except for current Artery; it needs to fully buffer an HFE track and current Artery doesn't have enough RAM. With stm32, there's only enough RAM to emulate a single platter.
I've been working on this for some months, and as of this weekend it seems to work. Ugly code is at https://github.com/ejona86/flashfloppy/tree/st506 . It requires a hardware adapter to convert to ST506, but it basically just rearranges the pins and has a RS-422 differential driver/receiver for RD/WD. It also involves removing two resistors.
In the end I did overclock to 80 MHz to have stronger syncing on the host. It also makes write decoding more reliable and provides 16 cycles per bitcell as otherwise 8 value load/stores (
stmdb
/ldmdb
) entering/exiting functions can block DMA long enough to cause rare-but-not-rare-enough bit flips.I have seen this mostly work on Vector Graphic Inc's Vector 4 with its Dual-Mode Disk Controller, but my testing has exposed that my Vector needs repair since sometimes the WG won't activate. I had trouble with an actual ST506, but I blamed it on the drive which crashed soon thereafter. The Vector has been able to write and read many sectors successfully, and isn't bothered by slow seek speeds.
Needless to say, this took some invasive work, but might not be as invasive as you (err, probably only keirf) might expect. Some of the changes I think would be fair to do for floppies, but I'll need to take some time and clean things up and break it into pieces. I've been targeting MFM; RLL(2,7) would have a performance issue to resolve.
While the changes turned out not to be too bad, getting there was quite an effort. This taught me a lot about the stm32 so that I can really appreciate the performance of the rp2040. PIO, clock multipliers+dividers, memory bandwidth, freedom to over/under clock and officially still use USB, peripheral queues, dual core, fast DMA... Any one of those items opens the door for much easier solutions. Although upgrading the stm32 chip does allow for some things as well.
The adapter plugs into the floppy connector and performs approximately this mapping:
ff-st506-adapter-v1.zip
ff-st506-adapter-gerber-v1.zip
Wiring your Gotek:
stm32f105:
at32f435:
Beta Was this translation helpful? Give feedback.
All reactions