Page 1 of 1

Issue stopping OTGv1 driver when active

Posted: Sun Jan 12, 2014 2:39 pm
by lilvinz
Hi,

when i try to usbStop an OTGv1 usb driver which is in state USB_ACTIVE,
it hangs here with i being 1:

Code: Select all

static void otg_disable_ep(USBDriver *usbp) {
      ...
      /* Wait for endpoint disable.*/
      while (!(otgp->ie[i].DIEPINT & DIEPINT_EPDISD))
        ;
      ...
}


This happens when having written to a serial over usb device without a host having consumed that data before usbStop().
I can "fix" it by calling _usb_reset() before usbStop() but that doesn't seem to be the intended way of doing it.
Is this a driver issue or misusage by myself?

Thanks in advance and with best regards,

Vinz

PS: The more i work with it, the more i like ChibiOS!

Re: Issue stopping OTGv1 driver when active

Posted: Sun Jan 12, 2014 2:46 pm
by Giovanni
Hi,

This is one of those hard-to-test corner cases. Probably the reset approach is correct considering we are enforcing a stop while the peripheral is active and there are filled FIFOs. Are you able to restart after enforcing the stop this way?

Also, are you running with assertions enabled?

Giovanni

Re: Issue stopping OTGv1 driver when active

Posted: Sun Jan 12, 2014 5:06 pm
by lilvinz
Giovanni wrote:Hi,

This is one of those hard-to-test corner cases. Probably the reset approach is correct considering we are enforcing a stop while the peripheral is active and there are filled FIFOs. Are you able to restart after enforcing the stop this way?

Also, are you running with assertions enabled?

Giovanni


Hi Giovanni,

i am able to restart - this code is inside a bootloader and the main application is using usb without issues.
Also all debug options are enabled so there seems to be no misusage.
If there is no negative side effect of executing this reset, i am fine with keeping it.

Cheers,

Vinz