Trying to avoid using USB

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Trying to avoid using USB

552 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by IanB on Fri Jun 06 09:50:23 MST 2014
My customer seems to think that I can add a USB socket to his product, and (miraculously) the flash-memory in the product will appear like a USB external memory when he connects his computer to the USB socket.
Can someone confirm that this is massively non-trivial to implement?

(Then we can go back to transferring the data with an SD card, as in his first prototype)
Labels (1)
0 Kudos
2 Replies

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by rocketdawg on Mon Jun 09 13:46:34 MST 2014
Tell customer that they indeed can have the remaining flash memory be used as a USB mass storage device (MSD).
but tell them that warranty issues are inevitable.
Most parts need to run the erase/reprogram code out of RAM.  so, you lose RAM, you have enough RAM for more code and buffering?
and all interrupts must be off, so device is dead except for reprograming.
And what good is a flash drive with a few 10's of K of space?  the FAT section will take up most of the space
and this flash is rated at a limited number of cycles, so every time a file is modified, the FAT section has to be rewritten, very bad, it will wear out.
100ms flash sector erase cycle on some parts.  dam slow thumb drive.
and you have to erase a sector so you need more RAM for read/modify/write.
USB is going to add a lot of code space as well.

So, tell them you can do it.  Yes, it is a massive amount of work.
Yes it will fail, rather soon, since the flash does not have the same hardware wear leveling, alternative block look up, ...  that a SD card does.  (and there are patents)
but make it VERY CLEAR, that warranty issues are not your concern if they want to do this.
because it will fail.

better to have the SD card as the storage device to the USB MSD.  Still a lot of work.
and there can be only one master.  The PC attached to the USB MSD is that master.  If the device changes a file while it is attached to a PC, Windows will freak out.
the master might delete files that the device thinks are still open, or not yet flushed and closed.

Just quote them a very very big number for this feature creep.
0 Kudos

514 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by mubes on Fri Jun 06 16:29:05 MST 2014
Ian,

You've left a shed load of detail off your problem statement that directly impacts how easy or hard what you're proposing would be...it is certainly possible to do something like this and, if the on device memory can be fat formatted, then it is indeed reasonably straightforward and there are plenty of examples around (the PC side does all the hard work of organising data in the flash, so the work of the embedded side is limited to herding sectors back and forth). Factors like minimum erase page size and access of the data on the embedded side are the primary problems then.

...if however you want the data to be 'flat' on the embedded side you've got a bit more work to do...that's what the mbed interface does, for example. The Apache licenced code for that is downloadable.

Finally, don't forget about the ISP modes on many chips, which may do what you need.

Dave
0 Kudos