AnsweredAssumed Answered

How is pmaadress calculated in HAL_PCDEx_PMAConfig?

Question asked by fekete.danel on Nov 25, 2016
Latest reply on Dec 12, 2016 by brown.geoffrey.001
Generating USB CDC example in STM32CubeMX for STM32F103 it creates the following code inside USBD_LL_Init():

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 , 0x81 , PCD_SNG_BUF, 0xC0);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01 , PCD_SNG_BUF, 0x110);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x82 , PCD_SNG_BUF, 0x100);
How are 0x18, x058, x0C0... calculated? I get that they are endpoint positions inside PMA buffer, but could not find the exact calculation.

I read RM0008, "23.3 USB functional description" , the closest I get is "Figure 220. Packet buffer areas with examples of buffer description table locations"

Outcomes