Electronics > Microcontrollers

Defective USB Host hanging up your target

(1/7) > >>

I think this happens via an interrupt flood.

In the other direction, I've often seen PCs getting hanged up via some defective USB device being plugged in.

Is there any way to guard against this?

In my project the USB (CDC & MSC) is implemented entirely under interrupt, so is vulnerable to this kind of thing. One could perhaps detect an excessive IRQ frequency but what then? Block the interrupt for ever (until a power cycle)?

USB never generates interrupts.  "interrupts transfers" are a type of USB communication, but not related to host interrupts.

The USB implementation in the 32F4 is wholly interrupt-driven.

A CDC ISR transfers 64 byte packets. A MSC ISR transfers 512 byte packets.

It perhaps could be run using polling, from an RTOS task, but that would be inefficient.

You are asking what can be done on the device side in the case of a defective host? IMO the clean thing would be to initiate a soft disconnect on your end (see SDIS bit). On the host side this appears as an unplug. The USB +5v will stay active but there might be implications for power otherwise (but probably not). From there I guess you could either try to re-connect or give up on the host.


--- Quote from: peter-h on February 02, 2023, 11:08:48 pm ---I think this happens via an interrupt flood.

--- End quote ---

I don't think there's a mechanism which would let a host flood your MCU with interrupts.


[0] Message Index

[#] Next page

There was an error while thanking
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod