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.

TMDSCNCD28388D: C2000

Part Number: TMDSCNCD28388D
Other Parts Discussed in Thread: C2000WARE

In the process of debugging the SD card driver, try to send the CMD0 command to the SD card, and then read back the return value. (The SPI protocol is used. Under normal circumstances, if CMD0 is sent and the command has been received, then the response is R1, what should R1 be, indicating that the SPI mode has been entered?)

After running the program I wrote, I found that the value of R1 read back was 0x95FF. The value of R1 is wrong. R1 has only 1 byte, and the highest bit is always 0.

What I am thinking about is:

It may be that the position of my sending command to the register is wrong, or when the response of the SD card is read back, the object read back is wrong.

Ask an expert to help analyze what is causing it?

The program code is as follows:

CS_LOW;
//Achieving 74 CLKs for power-on delay, in fact, the following cycle provides 80 *** pulses
for(i=0; i<10;i++)
{
SPI_writeDataBlockingNonFIFO(***, 0x00); // Send dummy data to receive status.
}
//
// Send the CMD0 command.
//
for(i=0;i<6;i++)
SPI_writeDataBlockingNonFIFO(***, CMD0[i]);

//Sending the command ends, and 16 clock cycles are added.
for(i=0;i<2;i++)
SPI_writeDataBlockingNonFIFO(***, 0x00);

R1 = SPI_readDataBlockingNonFIFO(***);

//
// Pull chip select high.
//
CS_HIGH;

Please tell me, is there a problem with the above write command function and read return value function?

The SD card I use is Kingston's high-speed card C10, and the memory size is 64G. The file system is FAT32.
Another question is, how to judge whether the SD card you are using supports the .SD3.0 protocol or other protocols?
According to the information, the commands are slightly different for different SD protocols.

According to the information, my SD card belongs to SDXC. Some sources say that it supports SD3.0 version.

Here to ask

Looking forward to your reply!

  • 查到的资料显示,在初始化过程中,SD卡时钟信号周期必须在100KHz到400KHz之间,不能大于400KHz。

    我的设置是:
    SPI_setConfig(SPIC_BASE, DEVICE_LSPCLK_FREQ, SPI_PROT_POL0PHA1,SPI_MODE_MASTER, 1000000, 8);
    DEVICE_LSPCLK_FREQ=
    (((25000000U * 32) / (2 * 2 * 1)) / 4)

    Is there a problem with the clock signal cycle setting of my SD card?

    Looking forward to your reply

  • Are you using the F2837x SD card example project from C2000Ware with FatFs as a starting point for your code?

    I don't see anything wrong with your SPI clock set up. Assuming you're using the default LSPCLK set up from the C2000Ware device.h/c files, that looks like the correct way to call SPI_setConfig() to get a 1MHz SPI clock. If you aren't sure, you could try bringing the SPI C CLK signal out to a pin on your controlCARD doc and measuring it on a scope.

    Whitney

  • I would like to ask, how to reduce the transmission speed of SPI?

    When SD is initialized, the transmission speed of SPI is required to not exceed 400kbit/s.

    Excuse me, the unit of 1000000 in the following function is the same as our commonly used baud rate. It is bps, which means that 1,000,000 bits of data are sent every second

    SPI_setConfig(***, DEVICE_LSPCLK_FREQ, SPI_PROT_POL1PHA1,SPI_MODE_MASTER, 1000000, 8);

    If this is the case, if I want to reduce the transmission speed of SPI, I only need to change 1000000 to 360000, which is to 360kbit/s.

    After initializing the SD card, the transmission speed of SPI needs to be increased. You only need to use the above function again, which is written as follows:

    SPI_setConfig(***, DEVICE_LSPCLK_FREQ, SPI_PROT_POL1PHA1,SPI_MODE_MASTER, 1000000, 8);

    I want to verify with you the correctness of the idea.

    Looking forward to your reply

    thanks

  • Yes, you've understood correctly. You only need to change the bitRate parameter when you call SPI_setConfig() and the function will calculate the new SPIBRR register value for you. You don't need to change any of the other parameters.

    Whitney

  • Glad to hear from you.

    thanks