Initializating SanDisk SD card using SPI fails after doing HW reset

I am using an STM32 micrcocontroller to interface an SD card memory using the SPI peripheral. I have done tests with 2Gb , 4Gb , 8Gb and 16Gb SanDisk cards. When I perform a reset with the 2Gb and 8Gb cards , nothing happens and I keep going with my tests. However, with 4Gb and 16Gb , once the reset is performed intialization fails . In fact , at the first insert in the SD slot , these cards are quite good initialized but one I perform the reset it does’nt pass.

When I tried to debug this problem, I discovered that when dealing a reset the response to command CMD0 is wrong . I get 0x00 instead of 0x01 which means that my card is not in Idle state.

I supposed that the problem is due to timing issues with the CS line. So , I tried to de-assert the CS before sending the CMD0 command and sending dummy bytes in order to make the card waiting 8 cloks period. Then , I send CMD0 and I assert the CS line to High. ( see below )

SD_IO_CSState(0);
SD_IO_WriteByte(SD_DUMMY_BYTE);
response = SD_SendCmd(SD_CMD_GO_IDLE_STATE, 0, 0x95, SD_ANSWER_R1_EXPECTED);
SD_IO_CSState(1);
SD_IO_WriteByte(SD_DUMMY_BYTE);
Using this solution , the Initialization passes after few reset tests. But , at any moment it can fails which is not the case with the 2Gb and 8Gb cards.

So I accidentally forgot to close the sd card file before deleting it or something like that :smiley: . And because of this, my SD card is now unrecognizable by any SD module and computer. When I put my micro sd card in the computer(windows 10), nothing appears, instead, my disk management keeps loading forever.

When I try different micro sd cards with the Arduino, they work fine, so the wiring is all correct; my bricked micro SD card is the problem.

I am facing the issue with my 24 GB SanDisk SD Card. What I have learnt is that perhaps SD Cards once initialized in SPI mode don’t accept CMD0 again (which is the software reset command!), the only method to bring them back to initial state is to perform their power cycle.

9Apps VidMate 9Apps

I am facing the issue with my 24 GB SanDisk SD Card. What I have learnt is that perhaps SD Cards once initialized in SPI mode don’t accept CMD0 again (which is the software reset command!), the only method to bring them back to initial state is to perform their power cycle. 9Apps VidMate 9Apps

Nice to see this here. Thanks for sharing this to us. watch series website is of the most popular site that people use it to watch and download the movies. Check this for more details. 

https://yipcreations.com/watchseries-alternative/  

I am using an STM32 micrcocontroller to interface an SD card memory using the SPI peripheral. I have done tests with 2Gb , 4Gb , 8Gb and 16Gb SanDisk cards. When I perform a reset with the 2Gb and 8Gb cards , nothing happens and I keep going with my tests. However, with 4Gb and 16Gb , once the reset is performed intialization fails . In fact , at the first insert in the SD slot , these cards are quite good initialized but one I perform the reset it does’nt pass.

When I tried to debug this problem, I discovered that when dealing a reset the response to command CMD0 is wrong . I get 0x00 instead of 0x01 which means that my card is not in Idle state.

I supposed that the problem is due to timing issues with the CS line. So , I tried to de-assert the CS before sending the CMD0 command and sending dummy bytes in order to make the card waiting 8 cloks period. Then , I send CMD0 and I assert the CS line to High.

no reply? https://redtube.vin