2020-12-08 03:25 PM
I'm using an STM32F407 development board and trying to make a USB/CDC terminal server. I want my app code to be notified by the USB/CDC class code when the host sends something out to the device. I'm having trouble because I want to conditionally block the receive function on DMA transfer completion in some circumstances (if the server is still processing the last command). This would be fine because said receive function seems to enable an "auto-nack" behaviour that would serve as a rate-limiter.
My goal has led me to examine the LL_USB code which sets up the DMA transfer, but the code is somewhat confusing and I'm having to read through this code line-by-line and search the reference guide for register names in order to make sense of it.
My question: is there a more comprehensive documentation or examples for the stm32xxxx_ll_usb.c code either publicly or internal to ST. I've looked at UM1734. While it gives a scattered overview of the layers, the diagrams are a bit confusing and the API function docs are very scant.
Anyway I would also cast a user vote for beefing up UM1734 or making the diagrams more consistent with each other. Also for adding an LL USB section to the relevant HAL/LL driver documentation.
Cheers
2020-12-08 05:03 PM
Well, it turns out that you don't really need to muck about with the low-level USB drivers. At least, not THAT low-level. The HAL_PCD layer provides a set of callbacks weakly defined in the HAL codebase and are perfect for intercepting a USB DataOut. It doesn't look like the CDC class driver even bothers with these. It sets up a DMA transfer for an incoming OUT packet and just returns. But it doesn't seem to care any more about the buffer, the packet, or the "data out" event after that.
I still want better USBD_LL_xyz() docs. :smiling_face_with_smiling_eyes: