AnsweredAssumed Answered

Aborting USB request in DMA mode 1

Question asked by Julien on Mar 11, 2011
Latest reply on Mar 21, 2011 by Julien

Hi Analog,

 

Under certain circumstances, I need to abord a USB bulk transmission (DMA mode 1 - large packets) while it is still in progress from the Blackfin (peripheral) point of view (in fact, the host has already stopped to send IN packets).

 

The problem is that I am not able to reset the TXCSR register in a proper state.

 

Initial state (transmission in progress) :

  - TXCSR = 0x9407 = AUTOSET_T | DMA_REQ_ENA | DMA_MODE_1 | UNDERRUN | FIFO_NOT_EMPTY | TXPCKRDY

  - TXCOUNT = some value

  - USB_DMAx_CONTROL(ep) = (ep << 4) | DMA_ENA | INT_ENA | (1 << 1) | (1 << 2);

 

What I do to abort transmission :

  - USB_INDEX = ep

  - ssync();

  - USB_DMAx_CONTROL(ep) = (ep << 4);  /* abort DMA */

  - ssync();

  - USB_TXCOUNT = 0; /* in case */

  - ssync();

  - /* Go back to DMA mode 0 - this line added just in case, but no effect */

  - USB_TXCSR &= ~((AUTOSET | DMA_REQ_ENA | DMA_MODE_1 | UNDERRUN);

  - ssync();

  - /* Flush fifo (first time) */

  - USB_TXCSR |= (1 << 3)

  - ssync();

  - /* Flush fifo (second time - double buffered transmissions)

  - USB_TXCSR |= (1 << 3);

  - ssync();

 

Final state :

     - TXCSR = 3 = TXPKTRDY | FIFO NOT EMPTY !!!!!!!!!!!!!!!

 

So TXPKTRDY is still set and the fifo is still not empty, even if I tried to flush it twice as said by the documentation. And then I cannot resume transmissions properly since there is always some old data in usb fifo.

 

Please help me ! How to properly reset the TXCSR register ?

 

Regards,

 

Julien

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Outcomes