STMicroelectronics / STM32CubeG0

STM32Cube MCU Full Package for the STM32G0 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
164 stars 75 forks source link

USB - PMA Buffer 0 ignored in isochronous transfers #27

Closed marsam94 closed 2 years ago

marsam94 commented 2 years ago

Caution The Issues are strictly limited for the reporting of problem encountered with the software provided in this project. For any other problem related to the STM32 product, the performance, the hardware characteristics and boards, the tools the environment in general, please post a topic in the ST Community/STM32 MCUs forum.

Describe the set-up

Describe the bug When using USBD Audio class, only one PMA buffer is being used (buffer 1) for OUT transfers. Resulting in only half packets being received.

How To Reproduce

image

As per default in USBD_Audio_DataOut, USBD_LL_GetRxDataSize is called to check the packet size received but it returns 0 then the packet size then back to 0. I added a buffer "packet_buf" for debugging purposes which gets the value returned on every call : packet_buf

The PMA is configured this way :

  HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x00, PCD_SNG_BUF, 0x18);
  HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x80, PCD_SNG_BUF, 0x58);
  HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, AUDIO_OUT_EP, PCD_DBL_BUF, 0x01580098);

When looking directly inside the memory, we can see that only the values situated at the PMABuffer1 are changed : pmabuf1_0 pmabuf1_1

If changing the addresses in PMAConfig, we can also see that it's always the address at pmaaddr0 that's ignored.

Thanks

ALABSTM commented 2 years ago

Hi @marsam94,

Thank you for this report. We will get back to you with a feedback as soon as possible. Please excuse the delay it may take us sometimes to reply. Thank you for your comprehension.

With regards,

ALABSTM commented 2 years ago

Hi @marsam94,

Version 1.5.1 of STM32CubeG0 firmware has been released a couple of days ago with a fix at USB HAL level relative to the isochronous double buffer mode of IN transfers. Would you mind giving it a try to check whether it solves the issue you are facing?

With regards,

marsam94 commented 2 years ago

Hello, the new version resolved my issues. Thanks for looking into it.

Sam