cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F723 USB-HS DMA problem with EP0

Mehran Memarnejad
Associate III

Hello,

I am trying to use USB-HS DMA in my program... It works good with other endpoints except EP0

For EP0, the enumeration phase is done successfully, But when I start sending my USB class specific messages one after the other continuously on EP0, after some successful transmissions, it suddenly gets stuck and EP0 Nack status is set ... I also check that DMA address be 4byte-align

Note that there is no problem when DMA is disabled

What could be the probable mistake?

Thanks in advnace

11 REPLIES 11

Hi,

I guess DMA is used for both IN and OUT actions. Anyway, I was testing B2B for OUT actions

Mehran Memarnejad
Associate III

The problem was in USBD_LL_DataOutStage and USBD_LL_DataInStage that was fixed by removing these snippets from code:

In function USBD_LL_DataOutStage:

#if 0

     if (pdev->ep0_state == USBD_EP0_STATUS_OUT)

     {

       /*

        * STATUS PHASE completed, update ep0_state to idle

        */

       pdev->ep0_state = USBD_EP0_IDLE;

       USBD_LL_StallEP(pdev, 0U);

     }

#endif

In function USBD_LL_DataInStage:

#if 0

     if ((pdev->ep0_state == USBD_EP0_STATUS_IN) ||

         (pdev->ep0_state == USBD_EP0_IDLE))

     {

       USBD_LL_StallEP(pdev, 0x80U);

     }

#endif