USBMSD SD connect to pc in long time LPC1768

Hi everyone,
I have a problem with USBMSD example, when I connect my LPC1768 via USB to my computer, it takes a long time (2~3 minutes) to detect the size of my microSD connected to LPC1768. But when my computer detects correctly the USB Mass Storage Device, everything works well. My code is the same shown in Mbed examples:

#include "mbed.h"
#include "SDBlockDevice.h"
#include "USBMSD.h"

SDBlockDevice sd(p5, p6, p7, p8);
USBMSD usb(&sd);

int main()
{
    while (true) {
        usb.process();
    }
return 0;
}

How can I reduce the time that my computer takes in order to detect the SD connected to LPC1768? Or it is not posible?

Thanks for your help.
Best Regards

@tomrod
Use a smaller SD card if that is an option, that way the size enumeration will be faster.
Of course there would be room for improvement in the USBMSD API (right now it can only read 1 block at a time which limits speed significantly), but at least we have basic functionality.

1 Like

@projectX_V thanks for your advice. I tried with a smaller microSD card, but my computer didn’t recognize it. For default, SDBlockDevice sets SPI frecuency to 1MHZ, then I changed it to the max value (25MHz) resulting in a reduction time for my computer to recognize my microSD card. With this change the time was reduced from 3 minute to 1 minute, not perfect but better.