SAMV7 USBDEVHS: A problem occurred if the USB cable is unplugged while a large amount of data is send over an IN endpoint using DMA. If the USB cable is plugged in again after a few seconds it is not possible to send data over this IN endpoint again, all other endpoints work as expected.

The problem occurs because if the USB cable is unplugged while an DMA transfer is in flight the transfer is canceled but the register SAM_USBHS_DEVDMACTRL is left in an undefined state.  The problem was fixed the problem by resetting the register SAM_USBHS_DEVDMACTRL to a known state. Additionally all pending interrupts are cleared.
This commit is contained in:
Kolb, Stefan 2016-11-14 10:32:49 -06:00 committed by Gregory Nutt
parent efbb622ab8
commit bf096873a1
1 changed files with 11 additions and 0 deletions

View File

@ -3333,6 +3333,17 @@ static void sam_ep_reset(struct sam_usbdev_s *priv, uint8_t epno)
sam_putreg(USBHS_DEVINT_PEP(epno), SAM_USBHS_DEVIDR);
/* Clear all pending interrupts */
sam_putreg(USBHS_DEVEPTICR_ALLINTS, SAM_USBHS_DEVEPTICR(epno));
/* Set DMA control register to a defined state */
if ((SAM_EPSET_DMA & SAM_EP_BIT(epno)) != 0)
{
sam_putreg(0, SAM_USBHS_DEVDMACTRL(epno));
}
/* Cancel any queued requests. Since they are cancelled with status
* -ESHUTDOWN, then will not be requeued until the configuration is reset.
* NOTE: This should not be necessary... the CLASS_DISCONNECT above