Skip to main content
Visitor II
November 8, 2021
Question

USB communication only via control transaction (EP0)

  • November 8, 2021
  • 7 replies
  • 5500 views

I need to write an application which should communicate only via endpoint 0, i.e. using only control transactions. My question is whether this is possible with STM32 family (regardless of the series (F0, F1, ...)). I think that it should be possible according to this video: https://www.youtube.com/watch?v=DJiWi5aJA44

    This topic has been closed for replies.

    7 replies

    Super User
    November 8, 2021

    Every USB device is capable communicating via EP0, by definition of USB.

    Whether you can implement it easily using any arbitrary "library" such as Cube, is another question.

    JW

    dr.lookAuthor
    Visitor II
    November 8, 2021

    I know that every USB device should be able to communicate via EP0 but not all stacks allow this. So my question is about the STM USB Stack, which is available via CubeMX.

    Super User
    November 8, 2021

    The CubeMX library does not have a custom USB communication device code that only communicates only via EP0, if that's what you're asking. This isn't a standard device, so it would require drivers on the PC side as well. Not sure USB allows non-control/config stuff to be sent over EP0.

    Super User
    November 8, 2021

    > Not sure USB allows non-control/config stuff to be sent over EP0.

    How do you define control/config stuff?

    USB2.0 9.3.1 bmRequestType (of 9.3 USB Device Requests):

    The USB Specification defines a series of standard requests that all devices must support. These are

    enumerated in Table 9-3. In addition, a device class may define additional requests. A device vendor may

    also define requests supported by the device.

    There are no constraints on Vendor requests in the standard.

    It's an inefficient way to transfer data, but possible.

    > This isn't a standard device, so it would require drivers on the PC side as well.

    By "standard device" you here mean class-compliant device. OP is certainly aware of this, since his question is rather specific.

    JW

    dr.lookAuthor
    Visitor II
    November 8, 2021

    I have to implement a vendor specific device using the provided ST template. The current application is running on the old MCU which is no longer available and I need to replace it for a new one. This means that I have the PC drivers and the non-control data can certainly be sent too.

    Super User
    November 8, 2021

    I don't use Cube, but I'd recommend you to have a look at how the standard control (EP0) requests are implemented, and hook on there.

    JW

    Super User
    November 8, 2021

    The DFU class is example of device class that uses only the EP0 for its functionality.

    As for the host (PC) side, look at this.

    dr.lookAuthor
    Visitor II
    November 10, 2021

    Thank you for the tip.