MMieC

This is a project to replace the CBM 1541 floppy drive on the C64 with an MMC card.
I dont want a HUGE 1541 connected to my DTV, so im making an MMC reader that will emulate the 1541.

A schematic has been provided for me by Jussi, thanks go to him for this as I dont have the time to draw things like this up!
Schematic for MMieC

The hardware is very simple, the MMC uses the hardware SPI port on the PIC, The IEC bus on portB.
Pin – Function
13 – SPI Sel=C2 Chip select for MMC
14 – SPI Clk=C3 Clock data to MMC
15 – SPI Din=C4 SPI Data out of MMC
16 – SPI Dout=C5 SPI Data in to MMC

28 – atn=B7 IEC ATTENTION
27 – clk=B6 IEC clock
26 – dat=B5 IEC Data, all pins on IEC are bi-directional

A serial debug port on C,
17 – tx=C6 Serial Data out of PIC
18 – rx=C7 Serial Data in to PIC

2 – Led1=A0
3 – Led2=A1
4 – MMC detect=A2 For detection of MMC insert

This initial board is a standard DIL package but im going to use a surface mount SOIC for the final design to keep ths size compact. The 18LF2520 runs from 3.3v, so the DTV can power it. A small 5pin header could take both power and IEC data from the DTV to the MMieC. For use on an actual C64 you need to split that header off to IEC and Power seperately, and i’d recommend running it from a good regulated 3.3v supply. Its possible to make the board run from 5v by using resistors between the PIC and the IO pins for the MMC and DTV, but the MMC still requires 3.3v power.
The serial output is at the chip level, so 3.3v and will need level conversion to connect to real serial port. Im using a USB serial adaptor chip that has ttl io and also supplies 3.3v for the PIC.


It works too, here is a sample output that reads a file from an MMC and puts the output to the serial port of my PC.

Initialising SPI Mode on MMC           - [OK]
Bringing MMC out of IDLE               - [OK]
Setting Block length to  64bytes       - [OK]
Locating Boot Record                   - [0200]
Validating FAT Descriptor              - [FAT16]
Checking for valid FAT16 format        - [OK]
Current Volume Name                    - [NO NAME    ]
Bytes per sector                       - [0200]
Total Disk Sectors                     - [F4C0]
Total Disk Clusters                    - [F2B8]
Sectors per cluster                    - [0001]
Sectors Per FAT                        - [00F3]
Total number of FAT Sectors            - [01E6]
Total number of ROOT Entries           - [0200]
Number of Root Sectors                 - [0020]
Number of Data Sectors                 - [F2B8]
Number of Hidden Sectors               - [0040]
Root Directory Start Sector            - [0228]
Data Area Start                        - [0248]
FAT Sector Start                       - [0042]
First Filename                         - [TESTFILE.TXT]
First entry 0003 F8 FF FF FF FF FF 04 00 05 00
file sector 0248
THIS IS A TEST FILE.

Here is a second test with slightly modified MBR detection running on a 64meg Sandisk (thanks Jussi)

Initialising SPI Mode on MMC.......... - [OK]
Bringing MMC out of IDLE               - [OK]

Setting Block length to 512bytes       - [OK]
Locating Boot Record                   - [6A00] start_lsec= 3157557
Validating FAT Descriptor              - [FAT16]
Checking for valid FAT16 format        - [OK]
Current Volume Name                    - [NO NAME    ]
Bytes per sector                       - [0200]
Total Disk Sectors                     - [0000]
Total Disk Clusters                    - [3FBA]
Sectors per cluster                    - [0004]
Sectors Per FAT                        - [007A]
Total number of FAT Sectors            - [00F4]
Toral number of reserved sectors       - [0001]
Total number of ROOT Entries           - [0200]
Number of Root Sectors                 - [0020]
Number of Data Sectors                 - [FEEB]
Number of Hidden Sectors               - [0020]
Root Directory Start Sector            - [0115]
Data Area Start                        - [0135]
FAT Sector Start                       - [0021]
NO NAME     Volume Directory

BOUNDER

Reading File d.pr.g 0 Bytes Long.
First entry 0001 F8 FF FF FF 03 00 04 00 05 00
file sector 0130

0 Bytes Printed

As you can see the LFN entry for BOUNDER messed it up. A slight mod is needed to skip the LFN entries in the directory so BOUNDER.PRG would appear as the first file, not its LFN entry.

Leave a Reply

You must be logged in to post a comment.