cancel
Showing results for 
Search instead for 
Did you mean: 

NAND FLASH + STM32F4 DISCOVERY + USB MASS STORAGE

069349773
Associate II
Posted on July 29, 2013 at 10:41

Hi,

I want to make project NAND FLASH + STM32F4 DISCOVERY + USB MASS STORAGE, but isnt't easy ))

I have any examples (Discovery\Open407V-D\USB HS Examples\Project\USB_Device_Examples\MSC) with MSC, but it works with SD card. Can anybody help me with port this example to NAND FLASH ??? 

#nand-flash-msc #help-!=-do-it-for
19 REPLIES 19
069349773
Associate II
Posted on August 08, 2013 at 13:34

I thought that the Projects will be interesting to you and other users and you can help me with it. I do not even know where to start porting, there is so many levels, I have never engaged in this.

crt2
Associate II
Posted on August 08, 2013 at 14:13

Basically you want us to do your work. If you dont know where to start then you need to go one step back and find easier example you can/would port. I dont know if you wrote the code for USB or just pasted the example, but you can try changing USB code from eval board to your board - and same process will apply for NAND flash.

069349773
Associate II
Posted on August 08, 2013 at 14:18

''but you can try changing USB code from eval board to your board- and same process will apply for NAND flash''  - i know it 😉

Come on, you can not help me

Posted on August 08, 2013 at 14:45

I think we're all plenty busy with our own projects to do yours for you. The level of help you're asking for is pretty burdensome, and you haven't really made any meaningful contribution to the community/forum.

Start by getting the NAND access routines working with your configuration, basic stuff like Read/Write/Erase
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
069349773
Associate II
Posted on August 08, 2013 at 15:07

ok, can you say me, if i'll replace routines of SD with routines of FLASH in that code

[code]

int8_t STORAGE_Read (uint8_t lun, 

                 uint8_t *buf, 

                 uint32_t blk_addr,                       

                 uint16_t blk_len)

{

  

  if( SD_ReadMultiBlocks (buf, 

                          blk_addr * 512, 

                          512,

                          blk_len) != 0)

  {

    return -1;

  }

#ifndef USE_STM3210C_EVAL 

  SD_WaitReadOperation();

  while (SD_GetStatus() != SD_TRANSFER_OK);

#endif    

  return 0;

}

[/code]

it will work???

Posted on August 08, 2013 at 18:04

For it to work the routines you substitute will need to have equivalent function. The READ will be relatively easy, and something you should test/validate outside the USB MSC first.

WRITE will be more problematic to emulate on the NAND because you will need to read the original NAND erasable unit, erase the NAND, insert the blocks you need to update/change, then write the whole new unit to the NAND. This is a technique often referred to as deblocking.

The blocks the MSC works on are likely 512 bytes (sector), the minimum erase unit/block on the NAND is likely 128 Kbytes, your code will need to deal with this disparity, and perhaps cache and lazy-write blocks back to the NAND so you don't destroy it with unnecessary erase/write cycles. ie the MSC gets 256 single block writes to different locations within the same NAND erase unit.

The MSC interface is also going to want to know/report the capacity of the NAND device.

A search of the SD functions and structures used should be illustrative of what the MSC interface requires.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
umitguleer
Associate II
Posted on December 13, 2015 at 09:20

Hi clive,

I'm sorry to bother you all the time, but I could not figure it out.

I set up a 1-second timer and I want to save the variable every second.

How do I create a loop in the main??

I'll be glad, if you help me..

umitguleer
Associate II
Posted on December 13, 2015 at 09:21

I ask for MSC USB.

Posted on December 13, 2015 at 15:06

Can we start this as a new thread, it's a bit off-topic in this older one. See ''New'' button, top left just above the listing of threads in the main page.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..