AnsweredAssumed Answered

USB host device library - interrupts

Question asked by Juha Aaltonen on Dec 22, 2013
I read the USB CDC/VCP device driver code (STM32_USB-Host-Device_Lib_V2.1.0) and saw that it was built on interrupts.
How does the RS receive routine cause the USB device endpoint interrupt?

How about the USB host? I saw the device endpoint interrupt bits in the USB controller registers, but which interrupts are used in host mode, and how?

I'm interested manly in FS, but knowing about HS doesn't hurt either.

That is, it seems like the IN transfer is done via USBD_OTG_ISR_Handler, but what triggers that? Serial interrupt doesn't seem to do that, nor does it seem to be a cyclic polling there. I've been trying to read the code, but it seems to be quite hard to figure out the call-trees due to the function pointer tables (hard to search). Even with a "supported" frameworks (IAR workbench in my case).

Well, it looks like the IN transfer is handled by a call in the USBD_OTG_ISR_Handler, and that the interrupt is caused cyclically by using a periodic transfer - not yet clear to me how.
It might be a good idea to add these aspects into the document, especially because the USB controller(s) in the STM32 chips are quite complex.