Ivan Krestyaninov

LPC1857 usb host+device msc

Discussion created by Ivan Krestyaninov on Jun 22, 2017
Latest reply on Jun 28, 2017 by Carlos_Mendoza

Hi everyone!
I've got such a task.
I need to make a double mode working USB0 port.

p.1) If I connect it to the PC windows see a internal flash disk (about 64kB size) - usb device mode.
A working example of it I've already made by modifying the usbd msc example with fat fs lib.

 

p.2) If I connect it by OTG cable to the Flash Drive(any) I need to automatically copy some file into internal flash disk
(mentioned in p. 1) - usb host mode.
A working example of it I've already made by using a usblib host msc example, also with fat fs.

 

But now I wanna join this two examples.
And there 're such a questions.
- How can I identify pc/flash mode automatically to switch between usb dev/host modes?
Does it real to make it such way? Maybe somebody has the same and there is some realization of this?
- How can I make two filesystems by Fat FS using two different disk access types(internal flash or external USB flash)?

All my best.
Ivan.

Outcomes