2023-11-12 04:31 PM
I am in the process of building quite a complex device requiring many features all bundled into one unit. Generally speaking, the device needs to be seamlessly connected to the PC for both debugging and file transfer/storage. I've done some digging and I can't find much information that is relevant to the system I have in mind.
The device in question contains a STM32L4R7 MCU with an external NAND flash memory attached to its FMC interface (as well as a swath of other hardware). More specifically I'd like to have the following features:
Is this sort of set up even possible? I've not seen an example of this similar to what I need anywhere. The only configurations I can think of are the following:
1) A fully composite CDC + MSC device, then using the ST FAT-FS middleware to access the external flash. This is assuming that the format of ST (or other) File System API compatible with PC
2) CDC and MSB USB device classes are exclusive. Using a hardware switch to enable CDC or MSC mode. Then, again using ST (or other) FS API compatible with PC
3) (if unable to achieve either 1 or 2) Ignore trying to use CDC all together and just use a single device class.
The other problem is the firmware.
Due to the complexity of the whole system, I'm most likely going to be using some sort of RTOS to run the device. So, the solution would have to be RTOS compatible. For example, it seems that Azure RTOS has file system API and USB device API, but I've no experience with this. FreeRTOS (which I have used) does have FAT FS library, but no USB device API. I'm not sure if I even need RTOS level API to manage the USB and the File System.
From what I can see in the STM32Cube, I cannot use CDC and MSC at the same time when using the ST library. Is there something I'm missing here when looking through the STM32Cube? Or would I need to setup external libraries to achieve this?
In summary, is this setup possible? I don't have enough experience working with USB let alone something as complex as this. If it is possible, what might be the easiest (I can work on performance later) way to implement this in terms of the HAL and RTOS setup?
Thanks for reading.