AnsweredAssumed Answered

STM32Cube, USB and double buffer

Question asked by zhu.baoshi on Oct 16, 2015
Latest reply on Oct 21, 2015 by zhu.baoshi
I have been trying STM32Cube software on STM32F072C8T6, specifically on the USB middleware.

My program is as simple as declare an OUT BULK endpoint. I'm toying around the idea of double buffering.

So in USBD_LL_Init I did
HAL_PCDEx_PMAConfig(pdev->pData, 0x01, PCD_DBL_BUF, 0x010000C0);

I'm missing half of the reception now. Here is some findings:
1. in stm32f0xx_hal_pcd.c, function HAL_PCD_EP_Receive, the PMA buffer count setting is PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, len);
I believe it should be PCD_SET_EP_DBUF_CNT(hpcd->Instance, ep->num, ep->is_in, len); as referenced from non-cube firmware.

2. In PCD_EP_ISR_Handler, PCD_GET_EP_DBUF1_CNT always give me 0, this can be confirmed by looking at registers in memory 0x4000600E/0x4000600F. Despite the counter problem, the package is actually received and appear at 0x40006100.

3. USB_EP1R always give same RTOG_RX and SW_BUF value (0,0 or 1,1) during toggling. Should this be (1,0) or (0, 1)

Having been trying for 2 days without any success. Any advise will be appreciated.

Baoshi

Outcomes