3
\$\begingroup\$

I am designing a device which requires an SD card for logging data, and I am using Microchip USB2240 as USB to SD bridge. I have all the parts on board (Referenced by Microchip).

I am able to log data to SD card as well as read data on my computer, but I have just realized that I cannot format the SD card nor delete any files from it.

I have a thought that this might be the problem with SD card WP switch, as I am using Micro SD card which doesn't have WP switch and USB2240 Evaluation board comes with the MMC socket. MMC has a WP switch (but the connections are true).

What will happen inside MMC when I move the switch to the lock position?

On the other hand, USB2240 has a SD_WP switch, which in my case is floating. They have not provided any information on this pin in the datasheet; whether I have to pull it HIGH or LOW to remove Write Protect.

Could the problem be either the write protect switch or SD_WP pin?

All the documentation on USB2240 bridge can be found here : LINK

\$\endgroup\$
  • 1
    \$\begingroup\$ Replace the sd card, they can fail in a read-only state. \$\endgroup\$ – Turbo J Aug 25 '17 at 20:38
  • 1
    \$\begingroup\$ Tried with 5 new Micro Sd card, still the problem persists. \$\endgroup\$ – Mudassir Hussain Aug 25 '17 at 20:40
4
\$\begingroup\$

The Write Protect on the SD card standard is essentially a Honor System. The card reader host must choose to honor it. That's it.

As for your SD WP pin. If it is floating with no internal pull up or down, then you have a problem. The line needs to be pulled up to VCC or down to ground. Floating will cause you problems if your IC honors the write protection.

\$\endgroup\$
3
\$\begingroup\$

The switch does nothing to the card (microSDs don't have any). There is a sensing contact or metal pad in the socket that acts just like an ordinary switch and tells the controller if a write is allowed or not. The switch does nothing with the card itself.

Your chip has an SD_WP line. Its polarity is configured by ATT_LB register (7.2.3.19). If you can't easily change that register (via the USB driver) then try pulling it high or low and see which level allows writes.

\$\endgroup\$
0
\$\begingroup\$

Actually the SD_WP pin behavior is a bit more complicated.

On a normal SD socket there is a contact pair on the side. The SD card, in turn, has a plastic WP slider. The WP contact is normally closed to ground. When a SD card slides in, it opens the WP contact (which has a pull-up enabled in 2240 IC firmware).

Now, if the plastic "protect" slider is in normal (unlocked) position, the WP contact closes again when the card in in fully engaged position.

If the slider is in "lock" position, the contacts remains open, which is used by internal firmware to report the media as "write-protected". Host driver is supposed to honor this information and refuse to make writes.

There could be several modes of WP functionality, depending on SD socket construction, but the above mode is default for 224X chips. If no WP contact present, the SD_WP pin should be connected to ground.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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