2021-04-21 04:07 PM
I'm looking to control the CDC_Receive_FS interrupt in a manner that I'm hoping is supported by the lower level hardware, but I'm having difficulty locating registers and functionality to support this behavior.
To give a hint to the architecture I'm working with. When the CDC_Receive_FS callback is triggered by interrupt, I take the data and put it into a FIFO queue. I'd like to:
I'm trying to get a grasp of how the USB works internally, and how I should customize it for my use case. I know the USB MSC uses Bulk Transfer and DMA. Does the USBD CDC device class automatically support bulk transfer and DMA? I've seen information that points me in both directions. If it does, how do I activate the DMA/Bulk Transfer. There aren't any options in the .ioc or in the STM Source Code Comments. (Usually peripheral code [like spi.c] contain documentation on how to activate available features).
The MSC_Standalone usbd_storage_if.c interface gives examples of features and capacities I'd like to use, but that would require re-initializing my USB device in order to Register Storage in a different capacity specifically for the transfer, and then switching back again. Can the MSC features be used from the USBD CDC Storage class?
Thank you for the assistance!
2021-04-21 05:31 PM
I've just realized the "USBD_CDC_ReceivePacket" function from within CDC_Receive_FS() controls when new packets are able to arrive. So I can use that to control buffer overflow, and I can adjust the new buffer position with "USBD_CDC_SetRxBuffer" to the next increment in the buffer, to allow a filled buffer, then handle it at the end. Because the max byte size is 64, it's pretty easy to just do the math.
It looks like USB DMA has to be manually activated through a defined macro: USB_OTG_HS_INTERNAL_DMA_ENABLED. But it's recommended against. Are there any runtime instead of compile-time bulk-transfer tools that can be used?