Part Number:TMS570LS1227
Tool/software: TI C/C++ Compiler
Hi All,
My project is based on Hercules TMS570LS1227 where required to interface SD card based on SPI interface. I have found sample code from community from the following link
https://e2e.ti.com/support/microcontrollers/hercules/f/312/p/452304/1752469 (SD_CARD_1227ZWT)
This SD card source code ported for TMS570ls1227 and I am able to compile the source code and able to communicate over serial and SPI interface.
Problem is occurring when calling disk_initialize()function where the following subroutines are part of function
1. power_on(); ------> SPI initialization --working fine
2. send_initial_clock_train(); ----> Ensure the card is in SPI mode --working fine
3. SELECT(); ---> chip select ---- working fine
4. if(send_cmd(CMD0, 0) == 1) ----> Enter Idle state -- working fine
5.if( send_cmd(CMD8, 0x1AA) == 1) -----> find the SD card version (SDC Ver2+) -- working fine
6. if (ocr[2] == 0x01 && ocr[3] == 0xAA) ---> The card can work at voltage range of 2.7-3.6V --working fine
7. if(send_cmd(CMD41, 1UL << 30) ==0)---> SEND_OP_COND (ACMD) where CMD41 (0x40+41)
But its always return 1or 5 and never return the 0 as per expected result.
Please find the attached code and let me suggest what could be issue and how to resolve it.
1. Complete source code:
(Please visit the site to view this file)
2. Source file of error occurring function (disk_initialize()):
Thanks,
Anil