Skip to main content
samar
Visitor II
December 23, 2021
Question

How to setup PMA buffers for isochronous USB transactions

  • December 23, 2021
  • 0 replies
  • 786 views

Hello,

I've been trying to port the X-CUBE-USB-AUDIO library onto a STM32G0B1RE nucleo board.

Right now, I'm struggling with the configuration of PMA buffers.

My configuration right now :

 
 HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x00, PCD_SNG_BUF, 0x18);
 HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x80, PCD_SNG_BUF, 0x58);
 /* USER CODE END EndPoint_Configuration */
 /* USER CODE BEGIN EndPoint_Configuration_AUDIO */
 HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x01, PCD_DBL_BUF, 0x01580098);
 HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x82, PCD_DBL_BUF, 0x02d80218); 
// HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData, 0x81, PCD_DBL_BUF, 0x04580398);

I need 48KHz stereo 16-bits packets, the board is setup as a USB Device acting as a speaker and microphone. The library makes use of asynchronous synchronization for the speaker using a feedback endpoint.

Right know I think I have 3 endpoints :

  • Speaker : EP1 - 0x01 (max packet size = 196 bytes)
  • Speaker Feedback : EP1 - 0x81 (max packet size = 3 bytes)
  • Microphone : EP2 : 0x82 (max packet size = 192 bytes)

The X-CUBE-USB-AUDIO library gives examples with F4 and F7 boards, but those boards have dedicated FIFO buffers for USB transactions, which means the setup is different.

Can anyone help ?

Thanks

This topic has been closed for replies.