I'm not finding any documentation that specifically covers the mass storage class driver included the MCUX SDK. Does this documentation exist?
It appears to be a continuation of the same Freescale driver I've been using for many years and now that I'm in the process of porting some projects from Kinetis to LPC55S69 I'm remembering some of the issues I've had in the past.
The big one is about the callbacks. If I recall correctly, at least some of those callbacks happen in interrupt context. For an RTOS-based system with the MSC driver hooked in to an external SPI flash memory the problem is that the SPI access is usually protected by a mutex. With the MCUX FreeRTOS SPI driver this is automatic. And of course you can't have the ISR waiting for a mutex so it can read data from flash.
I handled this before with a bunch of logic that includes suspending USB interrupts during non-interrupt SPI accesses, and switching between DMA and polled operation depending on whether it's in an interrupt.
I also remember a macro buried in the USB stack somewhere that'd let you keep some of the processing in a task, deferring processing from the ISR to the main loop or RTOS task. I also seem to remember that it didn't defer ALL callbacks and I don't remember if it existed it in all versions. Is that option there? Is there documentation on what things happen in the USB interrupt context?
Ideally I'd like to keep all USB interactions in RTOS tasks and not have any callbacks happening in interrupt context at all.
Thanks,
Scott
Edit:
I checked and the macro is USB_DEVICE_CONFIG_USE_TASK. Googling it takes me right back to a question I asked here 3 years ago.
The questions I really need answered are:
1. How do I properly use this option? What's the function I need to call and are there any other considerations I need to be aware of, like minimum task stack size?
2. Does this option guarantee that ALL class callbacks will happen in the task context and not interrupt context?