HP 1660AS Gotek drive mod

Home Forums Electronics HP 1660AS Gotek drive mod

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #1232
    modrobert's avatarmodrobert
    Keymaster
      Up
      3
      Down
      ::

      The floppy drive, an Epson SMD-1000, finally died in my HP 1660AS logic analyzer with oscilloscope.

      Epson SMD-1000 floppy drive partially disassembled

      No discs could be read, the drive head wasn’t moving.

      Floppy driver controller board

      I tried recapping after spotting two leaky electrolytic capacitors and greasing the mechanics with silicon grease, but no luck. I suspect one of the custom ICs controlling step motor have failed somehow, but haven’t analyzed much further after realizing some of the floppies with scope data were unreadable in another working floppy drive as well. I decided it was time to replace the floppy drive with a Gotek floppy emulator, so ordered one online via AliExpress.

      Gotek PC to Scope wiring.

      I installed the Gotek drive and rewired it for the custom Shugart interface using short jumper wires.

      HP 1660AS floppy drive pinout

      The HP 1660AS provides power 5V and ground via the 34 pin IDC connector and doesn’t have the same pinout as a standard PC floppy drive when comparing with the service manual (see image above). After testing a lot, what finally ended up working was connecting pin 2 “Disk Change” from scope to pin 34 on Gotek side, then grounding pin 34 on scope side, and the only jumper installed on the Gotek is “S1”. The rest of the pins were connected to the corresponding PC floppy pins signal wise. Note that this Gotek drive has the original stock firmware.

      HP 1660AS logic analyzer / oscilloscope with Gotek drive modification

      Finally it works, nice to have 1000 floppies on the USB stick. TIP: In order to initially format the USB stick with Gotek stock firmware to get 1000 floppies as raw sectors, hold down both buttons while powering on the drive, once the counter starts you can release the buttons. In Linux you can mount the USB stick using this bash shell script:

      #!/bin/bash
      # usbfd; A utility script to manage multiple floppy images on a single USB stick
      # Tested on a GOTEK 1000 floppy model
      # v. 0.91 Dennis Meulensteen 2013 dennis@meulensteen.nl -
      # This is unsupported software because I don't have the time to provide support
      #
      #This program is free software: you can redistribute it and/or modify
      #    it under the terms of the GNU General Public License as published by
      #    the Free Software Foundation, either version 3 of the License, or
      #    (at your option) any later version.
      #
      #    This program is distributed in the hope that it will be useful,
      #    but WITHOUT ANY WARRANTY; without even the implied warranty of
      #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the included
      #    GNU General Public License for more details.
      
      #    You should have received a copy of the GNU General Public License
      #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
      
      #Some variables with default values
      TASK="none"
      DEVICE="/dev/sda1"
      DEVICEDEFAULT=1
      OFFSET=1572864
      
      # Must be root for mounting, so check
      if [[ $EUID -ne 0 ]]; then
         echo "You must be root to do this." 1>&2
         exit 100
      fi
      
      #handle the options first
      while getopts  "fmuUld:o:" flag; do
      
      #  echo "$flag" $OPTIND $OPTARG
      
      #in order of ascending innocence so innocent options override dangerous ones if someone decides to throw the alphabet at us
        case "$flag" in 
        f) TASK="Format";;
        m) TASK="Mount";;
        u) TASK="UnMount";;
        U) TASK="UnmountAll";;
        l) TASK="List";;
        d) DEVICE=$OPTARG
           DEVICEDEFAULT=0
        ;;
        o) OFFSET=$OPTARG;;
      
        ?)
          echo "Invalid Option.Usage: usbfd -[OPTIONS] [OPERANDS]"
          echo "Valid Options are:"
          echo "  -f format one or more floppy images (for a minimum of security you must also provide -d [DEVICE])"
          echo "  -l to list mounted images"
          echo "  -m to mount one or many images"
          echo "    up to $(ls -1 /dev/loop? | wc -l) floppy images can be mounted."
          echo "  -u to unmount one or many images"
          echo "    if -m or u are used you must provide at least one number between 0 and 999 to mount the respective image(s)."
          echo "  -U to unmount all mounted images at once"
          echo
          echo "  -d DEVICE to set the device your USB stick is at ($DEVICE)"
          echo "    the choices are "$(ls /dev/sd?)
          echo "  -o NUMBER Provides an offset that corresponds to the distance between the images in bytes ($OFFSET)"
          echo
          echo "OPERANDS are one or many space seperated whole numers or ranges {N..M} corresponding to images on your USB stick"
          echo "  example of mounting: #usbfd -md $DEVICE {0..9} 12 18"
          echo "    {N..M} indicates a range of floppy images to operate on, -f and -u also take ranges."
        ;;
      
        :)
          echo "Missing argument for $OPTARG"
        ;;
        esac
      done
      #gets rid of all the complicated switches and their parameters, leaving just the arguments
      shift $(($OPTIND - 1))
      
        case "$TASK" in
      
        "Format") 
          FNAME=$(mktemp) 
          rm $FNAME
          if [ $DEVICEDEFAULT == 1 ]
          then
            echo "Formatting is dangerous! You must explicitly provide a device (-d)"
            exit -1
          fi
      
          for NUM in "$@"
          do
      	FLOP=$(printf %03d ${NUM%})
      	# Check the given file exists #
      	if [ -d "/media/usbfd$FLOP" ]
      	  then
      	    echo "usbfd$FLOP is already mounted, try -u first"
      	  else 
      	    mkfs.msdos -vC $FNAME -n FDISK$FLOP 1440|grep volume #using mkfs repeatedly because of the random volume ids and labels
      	    let MYOFFSET=$OFFSET/512*$NUM
      	    err=$(dd if=$FNAME of=$DEVICE seek=$MYOFFSET bs=512c count=36 conv=noerror &> /dev/null) || echo "Format failed on disk $FLOP" #only copy what we need
      	    rm $FNAME
      	fi
          done
        ;;
      
        # mount
        "Mount") 
          for NUM in "$@"
          do
      	FLOP=$(printf %03d ${NUM%})
      	# Check the given file exists #
      	if [ -d "/media/usbfd$FLOP" ]
      	  then
      	   echo "usbfd$FLOP is already mounted, try -u first"
      	  else
      	    mkdir /media/usbfd$FLOP
      	    let MYOFFSET=$OFFSET*$NUM
      	    mount -o loop,offset=$MYOFFSET,sizelimit=$OFFSET,users,rw,umask=000 -t msdos $DEVICE /media/usbfd$FLOP || rmdir /media/usbfd$FLOP
      	fi
          done
        ;;
      
        # unmount
        "UnMount") 
          for NUM in "$@"
          do
            FLOP=$(printf %03d ${NUM%})
            if [ -d "/media/usbfd$FLOP" ]
      	then
      	  umount /media/usbfd$FLOP
      	  rmdir /media/usbfd$FLOP
      	else
      	  echo "usbfd$FLOP was not mounted."
            fi
          done
        ;;
      
        # unmount all the usbfd... mounts
        "UnmountAll")
          for dir in /media/usbfd*/
          do
      	dir=${dir%*/}
      	if [ -d $dir ]
      	then
      	  umount /media/${dir##*/}
      	  rmdir /media/${dir##*/}
      	fi
          done
        ;;
      
        "List")
          for dir in /media/usbfd*/
          do
      	dir=${dir%*/}
      	if [ -d $dir ] 
      	then
      	  echo "Mounted: $dir"
      	fi
          done
        ;;
      
      
        esac
      
      

      Note: There are some changes I made to this script in order to make it work on modern Linux distributions which are not in the GitHub repo of the original author. Here are example commands (device might differ, depends on your system):

      # mount gotek floppies
      sudo usbfd -d /dev/sde1 -m 22 23 24
      
      # unmount gotek floppies
      sudo usbfd -d /dev/sde1 -u 22 23 24

      The first example will mount floppy disk 22, 23 and 24 on your USB stick, and the second one will unmount the same disks.

    Viewing 1 post (of 1 total)
    • You must be logged in to reply to this topic.