USB Initialization

Discussions and support about ChibiOS/HAL, the MCU Hardware Abstraction Layer.
wdouglass
Posts: 9
Joined: Wed Oct 29, 2014 8:00 pm

USB Initialization

Postby wdouglass » Tue Oct 02, 2018 4:37 pm

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

wdouglass
Posts: 9
Joined: Wed Oct 29, 2014 8:00 pm

Re: USB Initialization

Postby wdouglass » Tue Oct 02, 2018 8:30 pm

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...

User avatar
Giovanni
Site Admin
Posts: 11224
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 401 times
Been thanked: 333 times
Contact:

Re: USB Initialization

Postby Giovanni » Wed Oct 03, 2018 5:30 am

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

electronic_eel
Posts: 22
Joined: Sat Mar 19, 2016 8:07 pm
Been thanked: 5 times

Re: USB Initialization

Postby electronic_eel » Wed Oct 03, 2018 10:28 am

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.


Return to “ChibiOS/HAL”

Who is online

Users browsing this forum: No registered users and 2 guests