I am using a MSP430F5438A microcontroller to read and write on a delkin 2GB micro SD card using SPI interface following the Part1_Physical_Layer_Simplified_Specification_Ver6.00. I could successfully read and write on the card initially but one day the card just cannot be read and written to anymore, but initialization of card seems to be still fine. This has happened for a few times. Sometimes it takes a few days before it happens, sometimes it takes a few months. The screenshots taken below are captured using the Beagle I2C/SPI analyzer.
This is how I initialized the card.
and the response I get is
After that, I tried sending the SEND_STATUS command (CMD13) and the response I received is 0x0001 which indicates that the card is in a locked state.
I did not send any lock command in my firmware. After initializing the SD card, I only performs block write (CMD24), block read (CMD17) and block erase (CMD32), so I am unsure how did the card get locked or what the pwd is to unlock it. So I tried to force erase the card. When I do that, the card seems to enter an infinite busy state until I power cycle. I attached a screenshot of the MOSI transmission and the corresponding MISO transmission below
As captured in the screenshot, I send the SET_BLOCKLEN (CMD16) command to change the block length to 1 before sending the LOCK_UNLOCK (CMD42) command followed by a data of 0x08 (ERASE bit set) and two bytes CRC. The response I get from doing so is 0xE5 which seems to indicate that the data is accepted. However, after that my MISO line is stuck low infinitely. I attached another screenshot below showing the overview of what happened
So I would like to ask how can I recover the card from this state and what could be a possible reason why the card enters this locked state even though no lock command was sent to the card.
I added a screenshot showing the response when I try to erase, read and write from the card after it entered this locked state. All three response seems to indicate an illegal command, even for read block command (CMD17). So it does not seems like the card entered read-only but more of it cannot even be read anymore.