AnsweredAssumed Answered

How to define USB PMA Buffers size and addresses ?

Question asked by Zirconium on May 22, 2015
Latest reply on Jul 24, 2015 by iTXS
Hello

I am designing an USB device on the STM32L151CB micro-controller. I use the STM32Cube_FW_L1_V1.2.0 USB library.
My device enumerates correctly. I reach the point of sending an receiving data. So I need to define PMA buffers. I looked at a CDC generated project to try to understand how buffers must be declared in the PMA. I have difficulties to understand how PMA works. So, here are my questions:
- In the USBD_LL_Init function, the code is as follows
    HAL_PCDEx_PMAConfig(pdev->pData , 0x00 , PCD_SNG_BUF, 0x18);
    HAL_PCDEx_PMAConfig(pdev->pData , 0x80 , PCD_SNG_BUF, 0x58);
    HAL_PCDEx_PMAConfig(pdev->pData , 0x81 , PCD_SNG_BUF, 0xC0);  
    HAL_PCDEx_PMAConfig(pdev->pData , 0x01 , PCD_SNG_BUF, 0x110);
    HAL_PCDEx_PMAConfig(pdev->pData , 0x82 , PCD_SNG_BUF, 0x100);  
-I don't understand the relatioship between the pmaadress (hardcoded as 0x18, 0x58...) and the necessary size of the tx/rx buffer ?
-Is the size calculated by difference of successive addresses ?
-Is there another place in the code where I shall declare the buffers and then calculate addresses ?
Thanks a lot
Zirco

Outcomes