Read SDCard from USB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Read SDCard from USB

580 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gdigiulio on Tue Sep 16 02:42:24 MST 2014
Hi,

I would to connect my board LPC4088 to the PC via USB cable, in order to read the SD Card.

I tested the USB_MSC_RAM example and it works fine, I tested the SDMMC example and it works, but is there a project that merge both the example?

I tried to do it myself, but I don't know the function to be wrapped here in order to read/write the SD Card:

static void translate_rd(uint32_t offset, uint8_t * *buff_adr, uint32_t length, uint32_t hi_offset)
{
*buff_adr = &g_memDiskArea[(((uint64_t) offset) | (((uint64_t) hi_offset) << 32))];
}

/* USB device mass storage class write callback routine */
static void translate_wr(uint32_t offset, uint8_t * *buff_adr, uint32_t length, uint32_t hi_offset)
{
*buff_adr = &g_memDiskArea[(((uint64_t) offset) | (((uint64_t) hi_offset) << 32)) + length];
}

/* USB device mass storage class get write buffer callback routine */
static void translate_GetWrBuf(uint32_t offset, uint8_t * *buff_adr, uint32_t length, uint32_t hi_offset)
{
*buff_adr = &g_memDiskArea[(((uint64_t) offset) | (((uint64_t) hi_offset) << 32))];
}

/* USB device mass storage class verify callback routine */
static ErrorCode_t translate_verify(uint32_t offset, uint8_t *src, uint32_t length, uint32_t hi_offset)
{
if (memcmp((void *) &g_memDiskArea[(((uint64_t) offset) | (((uint64_t) hi_offset) << 32))], src, length)) {
return ERR_FAILED;
}

return LPC_OK;
}

How I should replace the function?

thanks

Giulio
Labels (1)
0 Kudos
1 Reply

542 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mc on Fri Jan 23 11:40:55 MST 2015
Hi,
Example at below link can be helpful to implement code underneath these functions.
http://www.lpcware.com/content/blog/lpcxpresso-lpc11u14-usb-sd-card-exmple
0 Kudos