cancel
Showing results for 
Search instead for 
Did you mean: 

usb mass storage with spi-flash m25p64

klaus239955
Associate
Posted on November 30, 2009 at 05:42

usb mass storage with spi-flash m25p64

#usb-spi-flash #mass-storage #serial-flash
4 REPLIES 4
klaus239955
Associate
Posted on May 17, 2011 at 13:31

I tried to change the mass storage medium to the spi-flash (m25p64) on the stm3210e-eval board.

I modified the functions in the medium access layer (mass_mal.c) and the sizes of Block, page and memory.

Mass_Block_Count[lun] = 128 * 256 ;

Mass_Block_Size[lun] = 256;

Mass_Memory_Size[lun] = (128 * 256 * 256);

But I had no success yet.

Probably i have to change the usb-descriptors.

So, does have anyone ported the usb mass storage to the Spi-Flash?

A descriptor for the spi-flash? What layers must i modify?

The example's documentation tells about customization of the BOT and SCSI layer, but i don't think that is necesary, if i change only the storage medium. Is that right?

Every hint is welcome.

Thanks, Klaus

pranamesh
Associate II
Posted on May 17, 2011 at 13:31

hi klaus,

did you have any success with this yet? I was blindly assuming that it should work for one of my projects.

Mikk Leini
Senior
Posted on April 17, 2012 at 18:57

Hello,

Old topic, but i have the same problem. I have custom board with STM32L151 and SPI Flash (Amic A25L040). I took the USB Mass storage example as a basis, configured the mass_mal.c and SPI flash pins. Windows detects the drive and wants to format it but it fails (''Windows was unable to complete the format'').

In debugger i see Flash page write function gets called but what is most strange is that nobody doesn't call Flash erase functions... It's quite hard to find a good place to put it.

Has anybody made success in this configuration?

BR,

M

alok472
Associate II
Posted on April 22, 2012 at 07:22

In the mass-storage, PC sends the data in multiple of 512Bytes. When using the memory as 24P64, kindly note that the erasable memory area is 64KB.

So when a Write command for 512B is received from Host, only these 512B needs to be written and rest of the data needs to be same as before. So, this means Copy the Orginal data from a sector to a New Sector (64KB), . Erase the minmum block from 24P64 and then Copy the previous data which is un-changed and write the 512B data received from Host.

 

In my opinion, it is better to use 24PE / 45PE series (Page Erasable) memory. Page erase area is 256B.

Just a curiosity, what is the application to have such a small memory for USB mass-Storage ?