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!