petermeier wrote on Friday, March 26, 2010:
the USB Stack only uses one interrupt (if you use host mode only - like for USB sticks). You need to wrap this ISR in the style FreeRTOS needs it (there is a good example in the FreeRTOS package included). Next step is that you call once USBInitialize(0) when FreeRTOS is already running. After that you just need to call USBTasks() periodicly every 1…10ms (as you like). If you use a filesystem like FatFS from Chan there is a ready semaphore handling included - so you don’t need to worry about access rules from different tasks because FatFS will handle that.
If you use the MSD_SCSI functions for reading/writing a sector, think about this:
These functions normally block the statemachine processing (as the USB stack from Microchip is being designed). But these functions need a handling of the USBTasks() - so Microchip decided, to make the handling quite easy - to include the calling of USBTasks() in the blocking functions. And here you need to remove the call to USBTasks() because in your main-task USBTasks() will be already the called periodicly.
Hope that helps a little.