lpcware

write to sd card via mass storage class using nxpusblib

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by Madara on Sun Nov 24 08:09:02 MST 2013
I am able to read and browse the sd card via usb mass storage but when i try to write the process fails and the card gets corrupted.

I am using bulk only transport and SCSi protocol. I am using nxpusblib
The read and write code is

if (IsDataRead == DATA_READ)
{   while(TotalBlocks--){
sdmmc_read(Buffer,BlockAddress,1);
while(!Endpoint_IsReadWriteAllowed());
Endpoint_Write_Stream_LE((void *)Buffer, 512, ((void *)0));
Endpoint_ClearIN();
BlockAddress++;
}
}
else
{  
while(TotalBlocks--){
while(!Endpoint_IsReadWriteAllowed());
Endpoint_Read_Stream_LE((void *)Buffer, 512, ((void *)0));
sdmmc_write(Buffer,BlockAddress,1);
BlockAddress++; ;
}
}

Can some body help me

Outcomes