Difference between revisions of "ZipIt MMC"
|Line 102:||Line 102:|
i'm currently doing some MMC hacking on another device, [[
i'm currently doing some MMC hacking on another device, [], and was curious what possibilities existed for adding a MMC interface on the zipit, if i could get access to either 4 gpios, or 2 data lines, and the OE and WR lines i could fix up something. worst case, i could use one of the uarts to do the job.
Revision as of 19:18, 24 September 2007
To add a MMC card to your Zipit, you must obtain an MMC socket and wire it using very fine wires to several places on the Zipit PC board.
Good cheap source for the mmc/sd card sockets $3 http://www.sparkfun.com/commerce/product_info.php?products_id=136 Even cheaper source is from Mouser, $1.48 each: http://www.mouser.com/index.cfm?&handler=data.listcategory&D=*minisd*&terms=mini-sd+&Ntt=*minisd*&Dk=1&Ns=SField&N=0&crc=true
On the Zipit you connect from R9, R23, R26 and R27 to pins on the MMC socket that carry the digital signals.
Connect the four pins to an MMC receptacle. They are connected as follows:
MMC pin-1 nCS <-- PE (connect to R9) MMC pin-2 DI <-- PE (connect to R27) MMC pin-5 CLK <-- PE (connect to R23) MMC pin-7 DO --> nEXTFIQ (connect to R26) --------- 9 \ not used in MMC mode 1| /CS -- PE1 -- R9 right side - 0V card selected 2| SO -- PE2 -- R27 right side -- from CPU to card 3| GND -- for power (?) 4| +V 2.7-3.6V -- power 5| SCLK -- PE0 -- R23 right side -- serial clock 6| GMD -- for card insert sense (?) 7| SI -- nEXTFIQ -- R26 right side - from card to CPU 8| not used in MMC mode -----------
The ascii arrows were intended to indicate signal flow.
The SPI signal names (DI,DO,CLK,nCS) are all named from the MMC card's perspective. For example - DO (Data Out) is the output from the MMC card and needs to be connected to the input pin (nEXTFIQ) on the CPU.
An important distinction with regard to pin numbers: With an MMC card, there are only seven pins numbered 1 thru 7. On an SD card, there are 9 pins numbered 912345678. Pins 8 and 9 are a superset of the MMC functionality. You'll need to make accommodations based on the socket you use. If you only have 7 pins, start counting from "1".
Either SD or MMC cards will work in this application. The SPI implementations for both are designed to be interoperable. Since both cards will fit in either socket, and the Zipit only operates in the SPI mode, choosing a card and socket is dealer's choice. I chose the 9-pin socket and an SD card simply because I had them on hand.You also need to wire up power for the MMC socket. Migraine Man [email@example.com] and Cynfab on the ZipIt Yahoo Group did the design work on this.
The MMC driver source and binary are at: http://groups.yahoo.com/group/zipitwireless/files/MMC/
Thanks to Chris, the mmc driver works a whole lot faster now!! I have added a bit to it: 1) automatically determine if the mmc card supports multi-block reads. 2) "cat /proc/mmc-multi" returns 0 if no support, 1 if supported. Now there is only 1 kernel module required and it will use multi-block reads if it can. I have posted the new binary, and sources to the Files > MMC > mmc-multi folder. http://groups.yahoo.com/group/zipitwireless/files/MMC/ I have also posted nls.o, fat.o, and vfat.o kernel modules. Insmod them in that order and you will be able to read & write vfat formatted sd/mmc cards. This is the way they come out of the box. Remember that vfat formatted cards don't support Unix permissions. The mmc driver is named mmc-multi.c &.o just to keep it distinguishable from the old one. To rebuild the other kernel modules just enable them as modules while in make menuconfig, then make modules. The binaries will be found in fs/nls, fs/fat, fs/vfat.
More details and pictures of adding an MMC card to the Zipit are on http://va3uxb.dynip.com/mmc_2.html
There should be an entry in the fstab for the MMC device. It should be in /etc/fstab What does it say? Should go something like this:
/<device> /<mount-point> <type> <options> <...>
What is the "type"? Should be "msdos" for a stock MMC which is formatted as FAT16, or "vfat" for FAT32 formatted MMC, or EXT2, or ...
In any event, you should be able to manually mount the drive...
The MMC card has to be set up already with a linux partition and formatted for ext2. If your MMC card is still using a FAT filesystem that would be the problem.
What I've done is I have one of those USB -> multi card devices, and I pop the MMC in there. It usually turns up as /dev/sda for its device address. Then I used fdisk to delete the partion(s) that it came with, and add one primary partition, type 83, for the whole size of the card. Once that is done and written, I use
mkfs -t ext2 /dev/sda1
to format that partition for Linux. At this point you can the move or create your .config directory on the MMC card.
My flash files make some assumptions, the biggest one being what I've just outlined - the MMC card is formatted for linux, linux is the first partition, and it's ext2.
You can get some info as to what is happening, by first making sure that the mmc.o module is not active (rmmod mmc.o) then activating it manually and watch the output. That should give some hints as to what is going on. If the module loads properly then try mounting the card and see if that gives you any errors. You can see the instructions that set up the mmc card on the zipit in /etc/init.d/S10mmc
i'm currently doing some MMC hacking on another device, Juice BoxMMCHack, and was curious what possibilities existed for adding a MMC interface on the zipit, if i could get access to either 4 gpios, or 2 data lines, and the OE and WR lines i could fix up something. worst case, i could use one of the uarts to do the job.
Looks like there should be enough space there. Need to stay as close to the power connection as possible. Need some gpio lines next, yes?
based on the autopsy done, we don't have enough unused lines to do a gpio based solutions. our current choices are:
- use address/data lines with one gpio 2. use some of the used gpios and multiplex them 3. use a PIC or AVR accessed via i2c 4. use a i2c GPIO expander such as the PCF8574
Or, hijack Port-E as described in Yahoo Zipit group by Migraine Man
This method seems to work ok. I was able to port the driver from the WRT54G folks. I have posted the binary: mmc.o, source: mmc.c, and a patch integrating it into the kernel tree on the Yahoo bbs.
I have found that it is easy to knock off the resistors that connect to Port-E while doing this mod. Here are the values:
The datasheets for the 7312 says that it has two synchronous serial interfaces. SS1 and SS2. Are they used for the CODEC or are they available? In addition, there's a second serial port for the IR features, which zipit doesn't appear to use.
from ken mcguire's zipit autopsy:
The SSI1 port consists of the following signals:
|SMPCLK||Y11||pulled down by R3 (10k)|
These can be seen in the pictures I posted, unfortunately they don't come out from under the CPU chip so are impossible to connect to. The SSI2 port is configured as DAI and used to talk to the WM8751L Stereo Codec. The i2c is bit banged on GPIO Port B bit 6 & 7. Both the WM8751L and the LPC915 are on the i2c at address 0x1b and 0x55 respectively. The WW8751L is a write only device.
ok i just found this page http://www.i2cchip.com/mix_spi_i2c.html which explains how to do the spi on the same bus as the i2c. we have one unused gpio which can perform as the Chip Select for the SD/MMC card, so the hardware is pretty much no issue now,just need to do some coding.