Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a .Net Micro Framework app that is failing to write bytes to a microSD card. When I take the card out of the device and look at it on my PC using a microSD to SD adapter the PC cannot write to the device as it appears to be locked. I'm trying to work out if the lock is a faulty adapter (the switch on the side of the adapter is set to the unlocked position) or the sate of the microSD card itself.

MicroSD cards have no visible way of locking and unlocking them but is there any setting in the card itself that locks it?

I have tried searching but most threads I can find (e.g. this one and this one, to choose two SO ones) talk about the adapter. Is there locking in the microSD specification?

share|improve this question
    
Its only a mechanical lock –  Ramhound Jul 19 at 5:44
    
The hardware lock switch doesn't exist on microSD cards. Even on full SD cards, it's a physical switch only. (That is, it doesn't connect to the card internals at all.) –  duskwuff Jul 19 at 5:50

1 Answer 1

up vote 4 down vote accepted

MicroSD cards have no visible way of locking and unlocking them but is there any setting in the card itself that locks it?

Yes, there are several SD commands which can be used to do this. In particular, CMD27 (PROGRAM_CSD) can be used to set bits which control temporary or even permanent write protection, and CMD42 (LOCK_UNLOCK) can even be used to turn on and off password-based read protection.

Most of this is likely meaningless to you, however, as most computer-based SD card adapters are unable to execute arbitrary commands on an SD card. These commands are generally only available to (and used by) embedded devices.

share|improve this answer
    
It is an 'embedded' device I'm building, so this is useful. Since this is clearly a software answer you may want to get in quick and answer on SO too before the question's closed there. –  dumbledad Jul 19 at 10:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.