Page 1 of 1

USB Initialization

Posted: Tue Oct 02, 2018 4:37 pm
by wdouglass
I've created a composite USB device using the "Interface Association" protocol. The device includes a single channel usb audio class device (which behaves like a microphone, and sends uLaw audio at 8000 hz), as well as a second interface which is vendor specific and sends data from an SPI sensor.

When i start everything up, it seems to work. If, however, the board gets re-enumerated by the host, problems arise. I'm using LIBUSB to read a bulk stream from that second interface, and it returns EPROTO. the audio interface still works.

This device uses a ULPI phy on the USB_HS interface

One of my target computers initializes USB devices several times when cold-booting, so I need to find a fix. Is there a general strategy to ensure this? can i re-initialize the USB peripheral when i get a USB_RESET event?

edit: i'll add the detail that i'm using an STM32F427, and chibios 18.2.1

Re: USB Initialization

Posted: Tue Oct 02, 2018 8:30 pm
by wdouglass
Update:
I tried re-initializing the whole USB peripheral on a USB_RESET event, that just caused more problems. It's so strange that most of my endpoints (the audio ones) seem to work fine, but the one bulk endpoint which relies on libusb fails under these conditions...

Re: USB Initialization

Posted: Wed Oct 03, 2018 5:30 am
by Giovanni
Hi,

The reset event does re-initialize the USB peripheral already, probably there is something else. The CDC demos can get reinitialized without problems.

Not sure how to help here.

Giovanni

Re: USB Initialization

Posted: Wed Oct 03, 2018 10:28 am
by electronic_eel
I'd take a look at what's going on on the usb bus by dumping the URBs going over the wire.

The easiest way to do this is usually to use the usbmon facility from the linux kernel. If you are using a windows program to communicate, run a linux host, start windows as a vm (qemu and kvm) inside it and attach the usb device to the vm. This way the linux kernel can still dump all URBs going in and out of the windows vm.

To understand the contents of the dumped URBs you unfortunately need to have a deeper understanding of usb and the protocols used with it.