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.

[参考译文] TM4C1294NCPDT:TM4C1294NCPDT 带有 SDCard 读取错误

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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1335238/tm4c1294ncpdt-sdcard-read-error-with-tm4c1294ncpdt

器件型号:TM4C1294NCPDT

我的一个项目需要 SD 卡与 TM4C1294NCPDT 连接才能定期存储数据。 我已经从"Resource Explorer"中选择了"fatsdraw_ek_TM4C1294XL_TI"项目。

我已使用 FAT32格式化 SD 卡、并使用2GB 和32GB。 SD 卡模块通过 SPI2与 TM4C 连接。 SD 卡模块来自 robocraze.com/.../sd-card-module

我能够发送适当的 CS、时钟(400kHz)和 MOSI 信号。 但是、我会看到"FR_NOT_READY"状态。

需要支持来解决该问题。

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

    您好!

     我不熟悉 TI-RTOS SDcard 示例。 您是否在未对 LaunchPad 进行修改的情况下按原样尝试了该示例? 根据示例指令、它使用 SPI0。 我建议您按原样运行、并确保它在 LaunchPad 上正常工作。 这样、您可以更轻松地调试/诊断问题。  

    Example Summary
    ---------------
    Sample application to read and write data onto a SD Card (SPI interface)
    
    Board Overview
    --------------
    Board_LED0    Indicates that the board was initialized within main()
    Board_SDSPI0  Connection to SD card
    
    Resources & Jumper Settings
    ---------------------------
    Please refer to the development board's specific "Settings and Resources"
    section in the Getting Started Guide. For convenience, a short summary is also
    shown below.
    
    | Development board | Notes                                                  |
    | ================= | ====================================================== |
    | CC3200            | Requires an external SD Card boosterpack               |
    | EK-TM4C123GXL     |                                                        |
    | ----------------- | ------------------------------------------------------ |
    | DK-TM4C123G       | It uses the onboard SD Card slot.                      |
    | DK-TM4C129X       |                                                        |
    | ----------------- | ------------------------------------------------------ |
    | EK-TM4C1294XL     | Requires an external SD Card boosterpack               |
    | EK-TM4C129EXL     |                                                        |
    | ----------------- | ------------------------------------------------------ |
    | MSP-EXP430F5529LP | Requires an external SD Card boosterpack               |
    | MSP-EXP430FR5969  |                                                        |
    | MSP-EXP430FR6989  |                                                        |
    | MSP-EXP432P401R   |                                                        |
    | ----------------- | ------------------------------------------------------ |
    | TMDXDOCK28M36     | It uses the onboard SD Card slot.                      |
    | ----------------- | ------------------------------------------------------ |
    | TMDXDOCKH52C1     | It uses the onboard SD Card slot.                      |
    |                   | Connectivity Bank 22-25: B-C position (SD card slot)   |
    | ----------------- | ------------------------------------------------------ |
    
    Example Usage
    -------------
    Run the example. Board_LED0 turns ON to indicate TI-RTOS driver initialization
    is complete.
    
    The example proceeds to read the SD card. If an "input.txt" file is not found,
    the file is created on the SD card with the following text:
    
        "***********************************************************************\n"
        "0         1         2         3         4         5         6         7\n"
        "01234567890123456789012345678901234567890123456789012345678901234567890\n"
        "This is some text to be inserted into the inputfile if there isn't     \n"
        "already an existing file located on the SDCard.                        \n"
        "If an inputfile already exists, or if the file was already once        \n"
        "generated, then the inputfile will NOT be modified.                    \n"
        "***********************************************************************\n"
    
    The "input.txt" file is then read and its contents are written to a new file
    called "output.txt". If the file already exists on the SD card, it will be
    overwritten.
    
    The contents of the "output.txt" file are then written to the console.
    
    Application Design Details
    --------------------------
    This application demonstrates how to use TI-RTOS's SD Card driver to read and
    write data onto a SD Card using FatFS API calls (f_open, f_read, f_write, etc).
    
    This application uses SysStd instead of SysMin. This was done because
    real-time was not a concern and the size of the internal SysMin had to
    be large to hold the output. Please refer to the TI-RTOS User Guide's
    "Generating printf Output" for a comparison of the different System
    Support implementations.
    
    This application uses one task:
      'fatSDTask' performs the following actions:
          Create and initialize SDSPI driver object.
    
          Prints the disk size and the amount of free space on it.
    
          Open the "input.txt" file.  If not found, create the file for reading and
          writing.  Write the default message to the file.
    
          Open the "output.txt" file.  Content will be overwritten if found.
    
          Copy the contents of "input.txt" to "output.txt".  Close both files
          afterwards.
    
          Open "output.txt", read the file and print the contents to
          System_printf. And closes "output.txt".
    
          Again, prints the disk size and the amount of free space on it. If the
          disk was empty, the difference in free space should can be observed.
    
          The SDSPI driver is closed and the example is terminated.
    
    For GNU and IAR users, please read the following website for details about
    semi-hosting:
        processors.wiki.ti.com/.../TI-RTOS_Examples_SemiHosting

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

    尊敬的 Charles:

    感谢 Charles 的快速响应。

    是的、我正在使用 Tiva LaunchPad。 我已经连接到了 SPI2。 我将尝试更改为 SPI0并更新结果。

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

    尊敬的 Charles:

    我尝试了更改 SPI、但错误仍然相同。 SD 卡的裸机代码是否可用于 TM4C1294NCPDT?

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

    您好!

     是的、在 C:\ti\TivaWare_C_Series-2.2.0.295\examples\boards\dk-tm4c129x\sd_card 中有一个裸机示例。 该示例是为具有 LCD 屏幕的 EVM 板创建的。 您需要删除与 LCD 相关的代码、并针对您的特定器件型号调整相应的代码(例如引脚多路复用。)