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:通过 SPI 接口与 eMMC MTFC8GAM 进行通信

Guru**** 1828310 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1422445/msp430f6747a-communication-with-emmc-mtfc8gam-through-spi-interface

器件型号:MSP430F6747A

工具与软件:

您好!

我们当前正在尝试通过 MSP 的 eUSCI SPI 接口与 eMMC MTFC8GAM 进行通信。

之前我们使用的是 SD 卡、它运行正常。 为进行测试、我们使用了相同的 PCB、只需焊接电线即可将 SD 读卡器之间的引脚对引脚连接到我们的 eMMC。

但是、我们现在无法使它正常工作。 我们进行了一些研究、实际上发现最新版本中已从 MMC 支持中删除了 SPI 接口。

我们不能理解的是、有什么因素阻止我们按照 MMC 协议使用 SPI 接口与 eMMC 卡进行通信? 有人以前做过类似的事情吗?

我们还使用示波器进行检查、数据和时钟正确发送到 eMMC (MOSI 至 CMD 引脚、SPI 时钟连接到 CLK 引脚)。 但是、我们没有从 DAT0 (连接到 MISO)获得任何回报。

提前感谢、

Maxence

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我从未使用过 eMMC 卡、但使用过64MB MMC 卡。 我很久以前就这样做了。 它的协议与 SD 卡不同。 虽然与此类似、但除非专门编写了 SD 卡代码以回退到 MMC 设置、否则会失败。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我们比较了 SD 和 MMC 标准、而响应格式确实不同、看起来主器件的命令格式相似(6字节命令、最后一个字节为命令索引和 CRC7)。

    问题是 eMMC 根本没有响应、如果至少能够得到响应、告知我们发送的命令无效、这一点很好。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    MMC 的另一个不同之处在于、他们真正倾向于该多点位。 它们的输出始于集电极开路/漏极开路模式、因此 您必须配备一个上拉电阻器。

    在查看我的一些旧 代码时、您应该会得到 CMD0的响应。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、我们在所有 eMMC 数据线路和 CMD 线路上都安装了上拉电阻器。

    您的代码与我们的代码非常相似,我们的命令发送函数如下所示:

    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)
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您提到最新版本不支持 SPI、那么该器件是否具有 SPI 模式? 否则、MMC 模式接口会在与接收命令相同的信号线上发送响应令牌。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    是的、我认为这可能是原因、我们的 eMMC 支持 MMC 标准版本5.2、而从我们在互联网和数据表中找到的内容来看、SPI 支持已从 MMC 标准版本4.2或4.3中删除。

    但我们无法找到有关 SPI 不兼容的原因、或芯片在 SPI 模式与 MMC 模式下的不同行为的单一解释。

    现在我知道、我们将使用示波器来观察第二次、以检查 eMMC 是否也在 CMD 引脚上做出响应。