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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

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

4,106 次查看
lpcware
NXP Employee
NXP Employee
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!!!

标签 (1)
0 项奖励
回复
12 回复数

3,323 次查看
froux
Contributor II

Is there a mass storage class device driver for LPC17xx in the lpcopen 2 lib?

0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Gonzalo_Sipel on Thu Jan 29 10:31:42 MST 2015
TheFallGuy
I've seen that and I know that nxpUSBlib is obsoleted but I saw the code of the new library and it's the same that before (with the same bugs!!)
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by TheFallGuy on Thu Jan 29 10:18:37 MST 2015
As it says on the nxpusblib download page

Quote:
The nxpUSBlib software package is now obsoleted by the new LPCOpen Platform which can be found here.


0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Gonzalo_Sipel on Thu Jan 29 09:52:31 MST 2015
Hi Javos
Does the usb lib that you have used work ok?? is it from NXP?
Although I made it can work ok I still have some doubts about if I will use nxpusblib or not.
Regards
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by javos on Thu Jan 29 08:47:30 MST 2015
Thank you Gonza!!!!
I had used another usb lib for MSD.

I will take a look and try to implement these patches.

Regards!!!
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Gonzalo_Sipel on Thu Jan 29 08:09:36 MST 2015
Hi everyone
I've been able to write my sd. I had to make some modifications to usblibrary.
I post this here http://www.lpcware.com/content/forum/sample-code-lpc1347-and-usb-msd-sd-card#comment-1143210
Regards
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Gonzalo_Sipel on Wed Dec 31 05:10:01 MST 2014
Hi everyone,
I have the same trouble, I can  read my SD card without problem but when I try to write  the library goes into an infinity loop. I'm using a NXP1788 microcontroller.
Has somebody been able to make it work ok?

uint8_t Endpoint_Read_Stream_LE(uint8_t corenum,
void *const Buffer,
uint16_t Length,
uint16_t *const BytesProcessed)
{
uint16_t i;
if (endpointselected[corenum] == ENDPOINT_CONTROLEP) {
if (usb_data_buffer_size[corenum] == 0) {
return ENDPOINT_RWSTREAM_IncompleteTransfer;
}
}
else if (usb_data_buffer_OUT_size[corenum] == 0)    {
return ENDPOINT_RWSTREAM_IncompleteTransfer;
}

for (i = 0; i < Length; i++) {
#if defined(__LPC175X_6X__) || defined(__LPC177X_8X__) || defined(__LPC407X_8X__)
if (endpointselected[corenum] != ENDPOINT_CONTROLEP) {
[color=#c33]//HERE IS THE PROBLEM, WHILE LOOP NEVER ENDS
while (usb_data_buffer_OUT_size[corenum] == 0);/* Current Fix for LPC17xx, havent checked for others */[/color]

}
#endif
((uint8_t *) Buffer) = Endpoint_Read_8(corenum);
}
return ENDPOINT_RWSTREAM_NoError;
}
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Tsuneo on Wed Sep 04 07:54:11 MST 2013

Quote:
I could able to write any data in to it using SPI.


Do you mean, you want to drive the SST25VF064C over SPI?
The chip manufacturer (moved to Microchip from SST) opens this reference code on their product page.

SST25VF064C_Driver
http://ww1.microchip.com/downloads/en/DeviceDoc/SST25VF064C.txt

Above source code does bit-banging SPI, instead of SPI peripheral.
But you'll easily modify it for a SPI peripheral

Anyway, why are you asking this question on USB forum?

Tsuneo
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by haricharan on Tue Sep 03 23:19:03 MST 2013
Hi everybody!!
My application is also a data logger, i would like to interface lpc 1227 with external ic SST25VF064C
I could able to write any data in to it using SPI. Can any one help me regarding this..........
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by danhauck on Sun Feb 17 23:55:22 MST 2013
Hi,

I've the same problem. Any solutions?

regards

Daniel
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nxpUSBlib team on Mon Nov 26 12:35:47 MST 2012
The MSC device example in the library reads/writes 512 byte sectors to RAM. It is up to you to provide the code that accesses your particular type of storage medium.

In v0.97 of the library there is example code in the BSP file for Hitex boards (\libraries\BSP\HITEX\bsp_HITEX.c) that uses SPI flash as the storage medium. Perhaps you can use this code as a starting point for your application.

I suggest that you add your platform specific code to the functions in the bsp files rather than in scsi.c. For example, you might consider adding the call to disk_write() inside of MassStorage_Write().
0 项奖励
回复

3,323 次查看
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by javos on Thu Oct 04 12:22:18 MST 2012
I found that even with an SD card I can't write files, I only can read, but when a write the library enter in the same infinite loop. This time the code is:

//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();
    disk_write((BlockAddress+i),buffer,1);
    //MassStorage_Write((BlockAddress+i)*VIRTUAL_MEMORY_BLOCK_SIZE,buffer, VIRTUAL_MEMORY_BLOCK_SIZE);
}

I am really sure that the function disk_write() work properly.

Does the library really support MSD for external FLASH?
0 项奖励
回复