Skip to content

USB initialisation unreliable [fix included] #520

@ryankurte

Description

@ryankurte

Using an STM32H735 with USB the application runs correctly immediately after flashing or while a debugger is attached, however, without the debugger attached / on power cycling after a flash USB_OTG often fails to initialise, locking up the processor.

stm32-rs/synopsys-usb-otg#37 proposes configuring interrupts prior to initialising the OTG peripheral, which appears to have resolved the issue for me.

// GAHBCFG.GINT = 1
cx.device.OTG_HS_GLOBAL.gahbcfg.modify(|_,w| w.gint().set_bit());
// GINTMSK.OTGINT = 1; GINTMSK.MMISM = 1;
cx.device.OTG_HS_GLOBAL.gintmsk.modify(|_,w| w.otgint().set_bit().mmism().set_bit());

let usb = USB1::new( ... )

Opening this issue to hopefully make it easier for others experiencing this to find the fix, and I think it would make sense to just fix this in Usb::new_unchecked?

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