Replies: 1 comment 2 replies
-
Doh. This was just recently brought up in #180 (comment) . I didn't see it until now! I had seen the issue, but it all looked old and generic "serial API" discussion. (I actually started down this path via the Raspberry Pi Pico and stm32 Black Pill which I had noticed supported USB-OTG.) |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Raspberry Pi Zero supports USB-OTG and USB gadgets on Linux are pretty trivial to set up. This provides some interesting possibilities for $5-$10. Any device that can act as a USB device could work, but the Zero is inexpensive and accessible.
With a 2-line configuration change you can take a normal Pi distribution (I used Arch Linux ARM, but Raspbian would work as well) and have it expose a file as a USB Mass Storage Device (so the Pi would act like a thumb drive). I added
dtoverlay=dwc2
to boot/config.txt andg_mass_storage.file=/root/zerodisk.img modules-load=dwc2,g_mass_storage
to boot/cmdline.txt. Most of the effort is to create zerodisk.img and put your floppy images inside it. You might also wantdtoverlay=gpio-shutdown
in config.txt to get a shutdown button; read overlays/README for details.With such a set up, writes can be faster than reads because there is no need to wait for backing storage. The entire floppy disk can trivially be buffered in 1 GB of RAM so we'd mainly be limited by USB Full Speed data rate (12 Mbps). Scheduling jitter from Linux doesn't seem to be a problem with some limited testing. 512 byte writes are 2.5-4µs. 2k reads are 6-10µs.
(Note: The Zero has two USB ports, one for power and one for power+data. However, you must not power the device from both ports at the same time as there is no protection circuit. This means that without some special preparations it has to be shut down and booted again if you change which machine it is plugged in to.)
That is "good enough" for me as a solution in case USB drive write latencies cause me trouble. But I sort of expect others might want to take it further.
Wifi. Since the Zero W supports Wifi, you can SSH to it, run
rmmod g_mass_storage
which "unplugs" the "flash drive", change the "flash drive" contents in the img file, and thenmodprobe g_mass_storage
to "plug it back in". This is enough to allow a web-based GUI for choosing the floppy image.USB serial. There is a serial gadget (the zero acts like a USB serial adapter). This would need some investigation to determine the effort to support the serial USB protocol in FlashFloppy, but there's the ability here to have rich communicating between the two systems.
Beta Was this translation helpful? Give feedback.
All reactions