I am using MCB2300 kit with LPC2378 processor. I had a look at the example provided in C:Keil\ARM\Boards\Keil\MCB2300\RL\USB_FlashFS . Here SD Card as storage media for USB memory. I am doing some processing on the files present on SD card via USB interface. Now I need to trigger the file processing the moment a file with a specific name is created on SD card instead of me typing the command on the serial window along with the file name for doing processing. Please let me know how to trigger this?
> Now I need to trigger the file processing the moment a file with a specific name is created on SD card
MSC (Mass-Storage Class) device can't tell the exact timing when the host finishes to write a file on the media. File write on host is split into sector read/write of FAT, directory and file content sectors on the device. Just the OS on the host knows the order of these sector read/write, device doesn't.
In most case, MSC is a bad idea for the communication which requires exact timing or transfer speed. For these applications, CDC (virtual COM port) or bulk transfer on generic class are better.
Tsuneo
I definitely recommend the CDC (or similar) route, where the embedded system gets a stream of data and ot its own writes it to the file system and then processes the data.
Look at it the other way. If the embedded system exports a file system to the PC, but itself also wants to read files, then your embedded device is a multi-user file server, supporting concurrent file accesses.
How do you synchronize such accesses between the PC and the embedded program? In truth - you can't without disconnecting from USB to claim ownership. Any other solution is a hack that requires you to have internal knowledge about the OS (or at least file system) implementation in the embedded unit, and the behaviour of the program on the PC who writes data.
Streamed, or pipelined, servers are the easiest way. The consumer (receiver) can decide if it should wait for low CPU load before starting to process data. Or wait until it has x kB unprocessed. Or it may process data on-the-fly. And it can send confirmations or errors back to the PC based on available file space, or acceptable format of transmitted data or whatever other attribute that is important to you.
But never implement a multi-user file server unless you need to - who would care about file locks if no program knows that it should lock file sections? What program - or OS - would expect a USB-connected memory device to require file locking?