HxC Floppy Disk Emulator

For some years I was looking for a replacement of the Floppy Disk Drive from my HP1652B Logicanalyzer. Now I have found a combination of hard/software that can, after some modifications, replace that internal Floppy Disk Drive.

The hardware is a Floppy Disk Emulator from company Gotek, type SFR1M44-U100K. The modul costs about 24 EUR including shipping. It was bought via ebay, with the article number 262505439058. This emulator supports 1.44 MB MS-DOS format only, but because I need to read sectors with a length of 1024 byte I had to look for other emulator firmware.

Fortunately since about a year there is a software you can by for 10 EUR (Paypal transaction), by writing an Email and asking for an account to download the software STM32 Based hardware bootloader Downloader and Flasher.

For download go to the hxc2001 homepage.

The source code for the PC (Linux, Mac OS, Windows) part is on github

attachment:HxC_HP1652B_DSC06618.jpg

/!\ Click on the picture to enlarge.

Floppy Disk Drive

The Floppy disk drive in my Logicanalyzer is a Sony MP-F52W-30. You can find a MP-F52W_Product_Specifications .pdf file (Sept. 1985) in the internet. Here I will just list the most important specifications.

attachment:HxC_HP1652B_FDEmu_DSC06619.jpg

The two pictures on the right shows the mounting of the Gotek Floppy Disk Emulator inside the Logic Analyzer HP1652B.

Floppy Disk Format

There is a useful HP mass storage handling program hpdir for Windows 32 available on the internet.

Under Windows 7-64 it shows the info from the HP1652B System disk:

> Hpdir.exe -info 0:
Info:  FDC sense: Windows NT/2000/XP/VISTA detected
Info:  FDC sense: 82077 controller detected
Info:  FDC get drives: drive 0 = DS/DD 3.5" (720k)
Info:  FDC get drives: drive 1 = not installed
Info:  FDC get drives: drive 2 = not installed
Info:  FDC get drives: drive 3 = not installed
Info:  FDC autodetect: HP1652B 3.5 DS/DD1024 found.
-- Floppy drive info --
Media type: HP1652B 3.5 DS/DD1024
Media capacity: 790 bytes
Number of cylinders: 79
Number of heads: 2
Sectors per track: 5
Sector size: 1024

Info:  No valid cylinder/head/sector data in system record, using device data

-- File system info --
Image format: Logical Interchange Format (LIF) id=$1000 version=0
Image size: 808960 bytes
Volume label: "HPLIF "
Creation date & time: 00-<?>-00 00:00
Sectors per track: 5
Number of heads or surfaces: 2
Total number of user accessable tracks: 158
Total number of user accessable records: 790
System area starts at record #0
Directory starts at record #2
Directory size: 22 records
File area starts at record #24
Total number of system tracks: 5
Total number of usable data tracks: 153

4294499328 bytes of 195840 free.

/!\ You have to consider, that in a normal PC 3.5" Floppy Disk Drive with 300 RPM, the bit data rate is just 250 Kbit/sec.

Concerning the HP LIF (Logical Interchange Format) File System you can find a specification from HP LIF_excerpt_64941-90906_flpRef_Jan84.pdf. For the Cylinder mode addressing you will find the statement:

With the program fdio for Windows 32 you can handle raw sector data from a floppy disk.. When I use this program under Windows 7-64 to show the analysis from the HP1652B System disk you will see:

>fdio.exe -analyze a:
Using presets from fdc.ini
Analyzing disc
FDC analyze: --- testing sector geometry for side 0 ---
FDC analyze: testing modulation & data rate...OK
FDC analyze: testing sector size, start sector and sectors/track...OK
FDC analyze: testing interleave...OK
FDC analyze: testing intra-track consistancy...OK
FDC analyze: --- testing sector geometry for side 1 ---
FDC analyze: testing modulation & data rate...OK
FDC analyze: testing sector size, start sector and sectors/track...OK
FDC analyze: testing interleave...OK
FDC analyze: testing intra-track consistancy...OK
FDC analyze: --- testing track geometry ---
FDC analyze: testing cylinders...
FDC analyze: testing track integrity & media density...OK
FDC analyze: testing head skew...OK
FDC analyze: testing cylinder skew...OK
FDC analyze: testing R/W GAP3...OK

Analysis summary:
-----------------
Rotational speed:  299 RPM
Form factor:       3.5"
Track density:     135 tpi (high density)
Capacity:          808960 bytes (790k)
Data rate:         250 kbit/s
Modulation:        MFM
Sector size:       1024 bytes
First sector ID:   1
Sectors total:     790
Sectors per track: 5
Cylinders:         79
Heads:             2
Interleave:        1:1
Minimum R/W GAP3:  0 bytes (22 recommended)
Format GAP3:       44 bytes (44 recommended)
Head skew:         0
Cylinder skew:     0

Errors:
- Found 1 unreadable track(s) on side 0 (maybe spares)


Recommended preset data for fdc.ini:
0x10,1,790,79,2,5,790,1,1024,2,0x16,0x2c,0xdf,1,0,0,0x40

OK, so I know now a lot about the Floppy Disk File System, but when I try to copy a System Floppy Disk copy on a PC it does not work. The next chapter explains the problem and shows the solution.

HP Copy Protection

While investigating the HP Floppy Disk topic, I found a web page about a HP 4145B Semiconductor Parameter Analyzer Systerm Disk. There I found some information about a Copy Protection of the System Floppy Disk.

The program http://simonowen.com/samdisk/ helped me to sort out the problem. A floppy disk scan shows:

>samdisk.exe scan a:
83 Cyls, 2 Heads:
250Kbps MFM,  5 sectors, 1024 bytes/sector:
  0.0  1 2 3 4 5
  1.0  1 2 3 4 5
.....
 77.0  1 2 3 4 5
 78.0  1 2 3 4 5
 79.0  97 98 99 100 101
 80.0  <blank>
 81.0  <blank>
 82.0  <blank>

It is very unusual to have sector number 97 - 101 on a floppy disk. The data I found on track 79, side 0 and 1 are:

>samdisk.exe view a: -c79-79 -h0 -s97
250Kbps MFM,  5 sectors, 1024 bytes/sector:
 79.0  97 98 99 100 101

Sector 97 (1024 bytes):
0000  E6 00 00 FF FF FF FF FF FF FF FF FF FF FF FF FF  ................
0010  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  ................

More data I found on sector 98:

>samdisk.exe view a: -c79-79 -h0 -s98
250Kbps MFM,  5 sectors, 1024 bytes/sector:
 79.0  97 98 99 100 101

Sector 98 (1024 bytes):
0000  50 02 88 05 03 01 02 01 A3 01 A3 E6 32 16 32 FF  P...........2.2.
0010  FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF  ................

The rest of the sectors are filled with 0xFF.

The solution is to copy 80 tracks, instead of 79.

HxC Floppy Emulator Software

This program allows you to convert floppy image files for the Gotek HxC Floppy Emulator in *.hfe (HxC Floppy Emulator) format.

The procedure to create an .img and .hfe file is:

  1. Start program HxCFloppyEmulator v2.1.4.0
  2. Insert your System floppy disk into the drive
  3. Click on button Floppy disk dump (80 tracks)

  4. Close the window with button Close

  5. Click on Button Export

  6. Save a file with file type .img (Image)

  7. Save once more a file with file type .hfe

  8. Patch with an Hex Editor the data bitrate to 500. This is needed, because the real floppy disk drive turns with 600 RPM, instead of normal 300.

// Start of the .hfe file
Addr: 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F
Data: 48 58 43 50 49 43 46 45 00 50 02 00 F4 01 00 00
0010: 07 01 01 00 FF FF FF FF FF FF FF FF FF FF FF FF
typedef struct picfileformatheader_{// Addr. Data
unsigned char HEADERSIGNATURE[8]; // 0x00: “HXCPICFE”
unsigned char formatrevision;     // 0x08 Revision 0
unsigned char number_of_track;    // 0x09: 80 tracks
unsigned char number_of_side;     // 0x0A: 2 sides
unsigned char track_encoding;     // 0x0B: MFM-IBM
unsigned short bitRate;           // 0x0C: 0x01F4 = 500 = 500000 KBit/s (little endian)
unsigned short floppyRPM;         // 0x0E: 0x0000 (Not used by the emulator)
unsigned char floppyinterfacemode;// 0x10: GENERIC_SHUGART
unsigned char dnu;                // 0x11: 0x01 Free
unsigned short track_list_offset; // 0x12: Offset of the track list LUT in block of 512 bytes
// (Ex: 1=0x200)
unsigned char write_allowed;      // 0x14: The Floppy image is write protected ?
unsigned char single_step;        // 0x15:  0xFF : Single Step – 0x00 Double Step mode
unsigned char track0s0_altencoding;//0x16: 0x00 : Use an alternate track_encoding for track 0 Side 0
unsigned char track0s0_encoding;  // 0x17: alternate track_encoding for track 0 Side 0
unsigned char track0s1_altencoding;//0x18: 0x00 : Use an alternate track_encoding for track 0 Side 1
unsigned char track0s1_encoding;  // 0x19: alternate track_encoding for track 0 Side 1
}picfileformatheader;

There is one problem I encountered while experimenting and copying data onto the USB stick. It can happen, that the LCD shows: Invalid FAT. Then you have to format the USB stick, and copy the files again on the USB stick. In my case (LCD use, normal mode):

13.09.2015  18:05             8.192 HXCSDFE.CFG
27.07.2016  18:20            91.648 HXCFEUSB_HFE_V3_0_8_2a.upd
22.09.2016  08:51         2.008.064 HP1652SY.hfe
22.09.2016  09:32         2.008.064 HP1652DA.hfe

In the index mode (LED use) the first .hfe file must be named DSKA0000.hfe. The following files must increase the number (consecutive) in the file name.

HxC USB-Stick STM32 Version

At the beginning of the HxC Project (2006) a CPLD (Complex Programmable Logic Device) chip was used, to fit the timing requirements. In 2015 the emulation software was adopted to the Gotek Floppy Disk Emulator hardware with a fast STM32 ARM processor, which needs no longer a CPLD. Here you will find all HxC firmware for Gotek drive instructions.

Unfortunately very little information is available for the LCD use.

Push Button

Left

Center

Right

Function

down

up

toggle LCD info

attachment:HxC_LCD_DSC06614.jpg

Gotek Hardware Adaption

/!\ This adaption is needed only in case of a Sony MP-F52W-30 disk drive emulation.

On the picture to the right you will see the LCD (2 x 16 characters) adoption to the Gotek board. The interface is I2C bus and the power supply +5 V. The connection is described in a forum thread.

For me the most useful information I got, was the selected .hfe File Name, and the actual selected Track, Sector and Side number.

On the Sony MP-F52W-30 disk drive the power supply +5V, +12V is connected to the 34 pin plug. This must be modified on the board, before the Gotek emulator can be connected to the HP1652B 24 pin cable.

The easiest way to avoid a short circuit between +12 V power pins is by cutting off the three pins 29, 31 and 33 on the 34 pin plug, as can be seen on the left picture.

attachment:HxC_cut_12Vpins_DSC06606.jpg

attachment:HxC_cut_lower_DSC06608.jpg

attachment:HxC_cut_upper_DSC06592.jpg

The separation of the +5 V supply from GND is more difficult.

  1. On the center picture you see on the bottom that 2 GND traces has to been cutt off, and a red wire for the +5 V supply is soldered on.

  2. On the bootom left side, a jumper wire to GND is soldered to pin 33.

  3. An extra Load Capacitor 330 - 1000 uF/10V is soldered in parallel to the +5 V supply.

There are two 3.3 - 5.6 KOhm pullup (+5 V) resistors soldered to the I2C bus lines, for the LCD.

  1. On the right picture you see also two GND traces cutted off.

  2. In order to be able to cut the GND-traces, the black Isolation strip (about 4 cm long) from the 34 pin plug must be carefully removed (it breaks easy), and later put back on.

  3. The red wire is soldered to a jumper block to +5 V. The jumper is needed, in case I like to hook the Gotek floppy disk emulator again into a PC. In this case the Jumper must be removed, in order to avoid a short circuit of the +5 V supply.

attachment:HxC_upper_DSC06605.jpg

34 pin plug pinout:

-- Gotek --                         --HP1652B (MP-F52W-30)--
?                                       Change Reset +5 V (1)
FLOPPY_DSKCHG   (2)                      Disc Change      (2)
Reserved        (4)                      In Use           (4)
Reserved        (6)                      Drive Select 3   (6)
FLOPPY_INDEX    (8)                      Index            (8)
DS0             (10)                     Drive Select 0   (10)
DS1             (12)                     Drive Select 1   (12)
DS2             (14)                     Drive Select 2   (14)
MTRON           (16)                     Motor On         (16)
FLOPPY_DIR      (18)                     Direction        (18)
FLOPPY_STEP     (20)                     Step             (20)
FLOPPY_WDATA    (22)                     Write Data       (22)
FLOPPY_WGATE    (24)                     Write Gate       (24)
FLOPPY_TRK00    (26)                     Track 00         (26)
FLOPPY_WPT      (28)                     Write Protect    (28)
FLOPPY_DATA     (30)                     Read Data        (30)
FLOPPY_SIDE     (32)                     Head Select      (32)
FLOPPY_READY    (34)                     Ready            (34)

+5V             (Power connector)        +5V              (3-11)
+5V             (Power connector)        +5V              (5)
GND             (Power connector)        GND              (15)
GND             (1)                      GND              (17)
                                         +12V             (29-33)

Disk Change Problem

Unfortunately my HP1652B does not recognize a Disk Change from the floppy disk drive emulator.

After some investigation, I recorded the signals from the 34 pin floppy disk drive plug:

  1. Disk change, pin 2
  2. Motor ON, pin 16
  3. Ready, pin 34
    • while a disk change.
    • The signal Drive Select 0 was LOW all the time, in both cases.

You see at the diagram Disk_Change_Sony_FD2.PNG:

  1. Disk change goes LOW if the disk is removed, and
  2. Disk change goes HIGH when a disk is inserted.
  3. When I give the command show directory, the motor starts and Ready goes LOW (active).
  4. After that operation the motor is switched OFF, and Ready goes HIGH.

That seems logical for me.

The Sony floppy disk manual (1985) tells about the READY signal: The line is TRUE (low) when all of the following conditions are met:

  1. The drive is selected (always ON)
  2. A disk is inserted. (I think, if Disk Change is HIGH)
  3. The Motor ON signal is TRUE (low), and
  4. The index period of the motor settles within 200 ms+/- 2.5% (I think it must be 100 ms at 600 RPM)

Your see at the diagram Disk_Change_HxC_Shugart.PNG:

  1. The disk change signal is very similar to the Sony FD.
  2. The motor signal is always OFF. Why?
  3. The drive signals Ready LOW (active) while the disk change is not finished.

That seems not so logical for me.

I assume, that the HP1652B is confused by the HxC Ready signal, and does not assert Motor ON.

Because the signal is not asserted, no Disk change is seen.

attachment:Disk_Change_Sony_FD2.PNG

attachment:Disk_Change_HxC_Shugart.PNG

  1. HxC Floppy Disk Emulator for HP 4145B Semiconductor Parameter Analyzer

List of pages in this category:

-- RudolfReuter 2016-09-27 20:13:31


Go back to CategoryLogicAnalyzer or FrontPage ; KontaktEmail (ContactEmail)

HxCFloppyDiskEmulator (last edited 2016-11-04 10:52:58 by RudolfReuter)