Skip to content

STM32F407 fails to enumerate when polled periodically #9

@ryan-summers

Description

@ryan-summers

If the USB device is polled periodically, the STM32F407 fails to enumerate. To recreate, use the following example:
https://github.com/stm32-rs/stm32f4xx-hal/blob/master/examples/usb_serial.rs and update the loop as follows:

let cp = cortex_m::Peripherals::take().unwrap();
let mut delay = stm32f4xx_hal::delay::Delay::new(cp.SYST, clocks);
loop {
    delay.delay_ms(1u8);
    // ... rest
}

A wireshark capture of the USB transactions with the device give some insight as to what is happening:
image

The first BOS descriptor request gets no response. The following 2 requests do get a response. However, then the first DEVICE_QUALIFIER descriptor gets a malformed packet as a response. Analysis of this packet seems to indicate that this is actually a BOS descriptor response from earlier.

This seems to indicate that the descriptor responses are offset by 1 improperly. It is unclear why the first BOS descriptor response fails, but initial debugging indicates it may be an improper ControlState setting. I'm still investigating root cause here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions