lpcware

Mass Storage Device (MSD) with external SPI flash sst25vf064c ussing LPC1769

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by javos on Thu Oct 04 08:30:54 MST 2012
Hi everybody!!!
I am working on a hand-held device, it will be a dataloger.
My idea, is to download the data through USB. So my device will be a mass storage device. (I am using an external SPI flash 8MB sst25vc064c).

I could enumerate and read every file created. But when I try to write some file into the mass storage (SPI flash) the library stays in an infinite loop "while(!Endpoint_IsReadWriteAllowed());", This is a fragment of the code:

//From SCSI_Command_ReadWrite_10 function
for(i=0;i<TotalBlocks;i++)
{
   while(!Endpoint_IsReadWriteAllowed());
   Endpoint_Read_Stream_LE(buffer,VIRTUAL_MEMORY_BLOCK_SIZE,NULL);
   Endpoint_ClearOUT();
   f25vf064c_wr_page512((BlockAddress+i),buffer);
   //MassStorage_Write((BlockAddress+i)*VIRTUAL_MEMORY_BLOCK_SIZE,buffer, VIRTUAL_MEMORY_BLOCK_SIZE);
}

I know that the problem is becouse the function f25vf064c_wr_page512() take some time... So, how can I solve this issue? is it possible to use this SPI flash?

Best Regads!!!

Outcomes