I am trying to get the sd card which is connected to the SPI Port of my controller to be read as a mass storage device. But before that I just try by using a USBMem code example from keil (original code for RAM). When I connect a usb cable to my pc, it shows usb device is not recognize but in usb controllers it shows unknown device. Can anyone please suggest what I am missing.
It took me a long enough to detect the olimex board as a mass storage device. I had used the code keil USBMem(RAM). As my intention was to use the sdcard which is connected to the spi port will be read as a mass storage device. Can you please suggest what changes should I make in USBMem code to get the sdcard as msd. It will be more helpful if I get some reference code.
As I told you before, this MCU is not recommended anymore and the support is limited. I will strongly recommend you to change to other MCU.
However, if you want to develop using LPC2300 you can take a look to the Sample Code Bundle for LPC23xx/24xx and from the link below:
I appreciate your suggestion, but it is a existing project which was
developed a years ago, and I had asked to add the usb msd in that existing
project. Otherwise I would love to use the cortex- m3 and other higher
And USBMem (RAM) code is working on my board. I need to know that how to
read the sdcard (SPI) as a msd instead of RAM.
Sorry for the inconveniences this may cause you but the information I already provided It's everything we have available. I would recommend you to migrate your project to a newer version as this part is not recommended for new designs.
I forget to tell about the hardware configuration of the board, my USB device is USB _D-2 and USB_D+2 which is pin37 and pin pin36. I can select the USB_D+2 P0(31). How do I select the pin 37 USB_D-2.
Please check the abstract that came with the LPC2368_USBMEM:
- P2.0: LED_RD is on when USB Device is performing Read access
- P2.1: LED_WR is on when USB Device is performing Write access
- P2.4: LED_CFG is on when USB Device is configured
- P2.5: LED_SUSP is on when USB Device is suspended
The USB Memory is automatically recognized by the host PC running Windows which will load a generic Mass Storage driver.
The Memory program is available for the following targets: MCB2300 Board: configured for on-chip Flash ROM
Note: set jumper J5 to 1[2 3] (jumper towards JTAG connector) for USB soft connect
As it says, if you had a driver that recognize USB mass storage, it should appear as this device automatically.
However, the LPC2388 is no longer recommended for new designs. So I wil suggest to check the LPC54xxx family.
But I have a different custom board designed for this project. I have to configure U2,
In which P3.24 is VBUS, P0.31 is D+2, Pin 37 is D-2, P1.30 is USB_PWRD2, P1.31 is USB_OVRCR2.
In datasheet what does it means USB Port Select register (USBPortSel - 0xFFE0 C110 – LPC2378 only)
void USB_Init (void)
PINSEL1 |= 0X40000000;//USB_D+2
PINSEL1 = (PINSEL1 & ~(1<<30))|(2<<30);
Don't know how to configure USB_D-2 Pin
PINSEL7 |= 0X00; // VBUS
PCONP |= (1<<31);
USBPortSel = 0X3; // the U2 port:USB_CONNECT2, USB_UP_LED2, USB_D+2, USB_D-2.
USBClkCtrl = 0x12; /* Dev clock, AHB clock enable */
while ((USBClkSt & 0x12) != 0x12)
VICVectAddr22 = (unsigned long)USB_ISR; /* USB Interrupt -> Vector 22 */
VICVectCntl22 = 0x01; /* USB Interrupt -> Priority 1 */
VICIntEnable = 1 << 22; /* Enable USB Interrupt */
can you please suggest, what I am missing.
The pin P3.24 can't be used as VBUS. This is the description of the pin P3.24
If you want to use VBUS you should connect it to the to P1.30
Or used it like the next schematic:
Yes I had configured the P1.30 as a VBUS,
And I also try to run the existing code USBMem on Olimex board (LPC2478),
which has a USB device U1. But still I am facing the problem. Is their some
other things that I should need to change in the code.
Trying this, I think this is more a pc problem that from the MCU.
Unfortunately, the LPC2387 is now a legacy device, there is not available a specific driver for this device including signature.
In the Olimex webpage there's some software that maybe could be useful.