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.
工具/软件:TI C/C++编译器
大家好、
我的项目 基于 Hercules TMS570LS1227、 需要在其中基于 SPI 接口连接 SD 卡。 我从以下链接中找到了来自社区的示例代码
https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/452304/1752469 (SD_CARD_1227ZWT)
此 SD 卡源代码移植用于 TMS570ls1227、我能够编译源代码并 能够通过 串行和 SPI 接口进行通信。
调用 disk_initialize()函数时出现问题,其中以下子例程是函数的一部分
Power_on (); ------ > SPI 初始化--正常工作
2. send_inition_clock_train (); ---> 确保卡处于 SPI 模式--工作正常
3. select (); --> 芯片选择 --工作正常
4. if (send_cmd (CMD0、0)=1)-->进入空闲状态 --工作正常
5.if (send_cmd (CMD8、0x1AA)== 1)---- > 查找 SD 卡版本(SDC Ver2+)--工作正常
6. 如果(OCR[2]=0x01 && OCR[3]==0xAA)--> 卡可以在2.7-3.6V 的电压范围内工作--工作正常
7. if (send_cmd (CMD41、1UL << 30)=0)--> send_OP_COND (ACMD) ,其中 CMD41 (0x40+41)
但它始终返回1或5、并且永远不会按照预期结果返回0。
请找到随附的代码、让我建议可能出现的问题以及解决方法。
完整源代码:
e2e.ti.com/.../0456.SD_5F00_CARD_5F00_1227ZWT.zip
2.错误发生函数的源文件(disk_initialize()):
谢谢、
Anil
Anil、您好!
SD 卡使用哪种 CS? 我注意到您在 select()中启用了 CS0 (GIO),但您在 SPI_SENS()中使用了 CS1。 请在 GIO 模式下使用 CS0来选择 SD 卡。