2016-11-25 01:03 AM
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, ''3 USB functional description'' , the closest I get is ''Figure Packet buffer areas with examples of buffer description table locations''
2016-11-29 06:04 AM
Hello,
Refer to this : STM32 USB-FS-Device development kit, maybe this helps you.Regards2016-12-11 06:05 PM
I'm surprised nobody seems to have an answer. This is definitely not documented either in the Cube HAL or (at least for the stm32f3) reference manual. Without this key bit of information, it is virtually impossible to build a USB device that doesn't simply used the (rather limited) standard examples.