-
Notifications
You must be signed in to change notification settings - Fork 198
Enhanced Gotek
Gotek clone designers can choose to add various enhancements to the standard Gotek, all supported by the FlashFloppy firmware. Note that these instructions are intended for PCB designers and cannot be retrofitted to a standard Gotek without fine soldering skills. Regular Gotek users should therefore skip this page.
- Gotek Bug Fixes
- PC12-15: Board Identifier
- PA3: Second Drive Select
- PA15: Motor-On Signal
- PA4-5: USB Power Switch
- PB12-15,PC9 SD Card Connector (optional)
- NRST: Remove the 4k7 pull-up.
- BOOT0: Connect BOOT0 to VSS (GND) via a 10k pull-down.
- PB2 (BOOT1): Connect PB2 to VSS (GND).
- Output buffer: The original Gotek uses a 74HC04 to buffer the outputs of the STM32. Strictly speaking it is out of spec to power the HC04 with 5V while driving its inputs at 3.3V. Hence it is recommended to: Replace the output buffer with 74HCT04.
Pins PC12-15 are used to identify an enhanced Gotek. On a standard Gotek board these pins are disconnected and floating; FlashFloppy internally pulls them high to identify an unenhanced board.
On an enhanced Gotek PC12-15 are selectively connected to VSS (GND). The four inputs PC[15:12] form a four-bit board identifier:
- 0000: Enhanced Gotek, no SD card connector
- 0001: Enhanced Gotek, with SD card connector
- 1111: Standard Gotek (no enhancements)
FlashFloppy may in future emulate two drives in a single Gotek. To support this pin PA3 may be connected to a second drive-select line and pulled up by 1K to VCC (5v). If second-drive select is not supported then the pull-up is still required, to avoid PA3 floating.
FlashFloppy uses the motor-on signal to optionally improve emulation accuracy. To support this pin PA15 may be connected to the motor-on line (eg floppy pin 16) and pulled up by 1K to VCC (5v). If the motor-on signal is not supported then the pull-up is still required, to avoid PA15 floating.
A power switch with active-low enable and open-drain fault output may be connected as follows:
- PA4: active-low enable (output to USB power switch)
- PA5: open-drain active-low fault signal (input from USB power switch)
These connections are optional and either pin may instead be left disconnected and floating (the STM32 will pull them to a defined level).
A suitable power switch is STMicroelectronics STMPS2141.
An SD card connector may be connected as follows:
- PB12: SPI_CS (Chip Select)
- PB13: SPI_CK (Clock)
- PB14: SPI_MISO
- PB15: SPI_MOSI
- PC9: Card Detect
Card Detect should float when a card is inserted, and be driven low when no card is present. For simplest connection, this will require a card-detection switch which is open when a card is inserted, and closed when ejected. A switch with the opposite sense will require extra circuitry (eg. pull-up resistor and an open-drain MOSFET to invert the switch signal).
Although FlashFloppy firmware supports SD hotplug, care must be taken in circuit design to safely handle hot insertion. When an SD card is inserted, there is a sudden and significant inrush current while the onboard capacitor is charged. This inrush can cause the 3.3v power rail to drop significantly for many microseconds: Sufficient to crash or lock up the FlashFloppy microcontroller!
For references on how to solve this issue, please see:
- Chan FatFS: "Consideration to Bus Floating and Hot Insertion"
- Arduino Forum: "How much current is drawn on hot insertion?"
A reasonable alternative is to disallow hotplug, permitting SD card removal and insertion only while powered down. You should document this restriction if you do not design and test your board to support hotplug.