Electronic – How to hardware protect a microSD from writing to

sd

I have a beagle bone black board and I want to make the card read-only so no modifications go to the microSD card. How can I achieve that?

I have searched over internet for this. SD card have a switch to do this, however microSD does not.

I am thinking that there must be a pin through which the info is written to the card. Is it possbile to make the card read-only by blocking that pin, or is there another, better, way to make the card read-only?

Edit: I want a non software way of blocking. I am trying to install a small os on it, and want that someone who could hack into, not to be able to add anything on that microSD card.

Best Answer

@Johnny above is 100% correct. The switch is not a switch at all, it functions in the same way as the tab on a floppy disk. With SD however there's only optional enforcement whereas with the floppy disk, the standard hardware enforced the write protect mechanism.

SD Card wiring

A circuit in front of me wires the "SD Card Protected" line from the card cage (in this case, full size) to a GPIO port and the driver detects that. The picture above is to emphasis that the "card present" and "card protected" mechanisms are seperate from the MMCSD data transfer bus.

In your case the microSD card has no switch and no mechanism on the card slot to detect anything. Without looking at the BeagleBone schematic, I'd say there's no Protect line. But, that doesn't prevent you from

  • Creating your own card protect line using a spare GPIO line and using a jumper to select protected/not-protected. Then changing the SD device driver to use that GPIO line.
  • pretending a line does exist by altering the SD device driver
  • Not bothering and asking the kernel to mount the image read only

So I'm afraid the question reverts to a linux OS question.