This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F6747A: Communication with eMMC MTFC8GAM through SPI interface

Part Number: MSP430F6747A


Tool/software:

Hello,

We're currently trying to communicate with en eMMC MTFC8GAM thourh the eUSCI SPI interface of the MSP.

Previously we were using an SD card and it worked fine. For testing purpose we used the same PCB and just soldered wires to connect pin-to-pin from the SD card reader to our eMMC.

We're not able to make it work for now though. We did some research and actually discovered that SPI interface has been removed from MMC support in the latest versions.

What we're not able to understand is what prevents us from communicating to the eMMC card following the MMC protocol with an SPI interface ? Has anyone done something similar before ?

We also checked with an oscilloscope and data and clock are sent correctly to the eMMC (MOSI to CMD pin, and SPI clock connected to CLK pin). We're not getting anything back from DAT0 though (connected to MISO).

Thanks in advance,

Maxence

  • I have never used an eMMC card but I have used a 64MB MMC card. A long time ago. The protocol for that was different than for an SD card. While it was similar, unless the SD card code had been specifically written to fall back to an MMC setup, it would fail.

  • We've compared both SD and MMC standard, while the response format does differ indeed it looks like the command format is similar for the master (6 bytes command, with command index and CRC7 for the last byte).

    Issue is the eMMC is not responding at all, it would have been nice to at least get an response from it that tells the command we sent was invalid.

  • Another difference with MMC is that they really leaned into that multi-drop bit. Their outputs begin in an open collector/drain mode so  you must have a pullup resistor.

    Looking at some of my old code, you should get a response to CMD0.

  • Yes we've got pull-up resistor on all the eMMC data lines and CMD line as well.

    Your code look very similar to ours, here what our command sending function looks like :

    static void sdSpiSendCommand(unsigned char *res, unsigned bufferLength)
    {
        unsigned tries = 0;
        unsigned char crc = 0;
        unsigned i;
    
        // sdCardCommand.command is the command id, 0 for init, 24 for write block etc
        // sdCardCommand.params is an uint32_t containing the command arguments
        const unsigned char rawCommand[5] = {
            0x40 | sdCardCommand.command,
            (sdCardCommand.params >> 24) & 0xFF,
            (sdCardCommand.params >> 16) & 0xFF,
            (sdCardCommand.params >> 8) & 0xFF,
            sdCardCommand.params & 0xFF};
    
        pinClear(SDCARD_CS); // Assert CS line to low level
    
        for (i = 0; i < sizeof(rawCommand); i++) {
            crc = crc7Tab[(crc << 1) ^ rawCommand[i]];
    
            // sdSSpiSendByte() both write a byte then read one which is returned
            sdSpiSendByte(rawCommand[i]);
        }
    
        sdSpiSendByte((crc << 1) | 0x01); // send CRC-7 followed by end bit
    
        do {
            if (++tries > SD_CMD_RESPONSE_TIMEOUT) {
                pinSet(SDCARD_CS);
                sdStatus |= SDCARD_CMD_TIMEOUT;
                return;
            }
            res[0] = sdSpiSendByte(0xFF);
        } while (res[0] == 0xFF); // There is a pull-up on DAT0, which means 0xFF is read if nothing is sent by the eMMC
    
        // Usually for MMC format, command response is 6 bytes
        for (i = 1; i < bufferLength; ++i) {
            res[i] = sdSpiSendByte(0xFF);
        }
    
        pinSet(SDCARD_CS);
    }

    When this function is called, it never reaches past the do-while loop, we're not getting anything back and we end up with an error.
    On the oscilloscope the DAT0 line is constantly at logic level high due to the pull-up.

    Do you see anything wrong with this code ? (This used to work with SD card)
  • You mentioned that the latest versions don't have SPI support so does this device have an SPI mode? If not then the MMC mode interface sends the response token on the same signal line that it received the command on.

  • Ok so yes i think this might be the reason, our eMMC supports the MMC standard version 5.2 and from what we've found on internet and the datasheet the SPI support has been removed from the MMC standard since version 4.2 or 4.3.

    But we couldn't find a single explanation about why SPI wasn't compatible, or what the chip does differently when it's in SPI mode vs MMC mode.

    Now i understand, we'll make a second observation with the oscilloscope to check that our eMMC is indeed responding on the CMD pin too.

**Attention** This is a public forum