How to use HAL_PCDEx_SetTxFiFo on STM32F4 when porting from STM32F0
Hi,
I am migrating some USB code which was initially developed on STM32F0.
There are 6 end points in use (including control):
EP address:
0x0
0x80
0x87 -
0x81
0x01
0x82
So my code to config PMA in USB_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 , 0x87, PCD_SNG_BUF, 0x98);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x81, PCD_SNG_BUF, 0xD8);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x01, PCD_SNG_BUF, 0x13C);
HAL_PCDEx_PMAConfig((PCD_HandleTypeDef*)pdev->pData , 0x82, PCD_SNG_BUF, 0x1A0); and this works fine on STM32F0.
Now I am migrating this same code to STM32F4 and here is a bit different. Using HAL_PCDEx_SetRxFiFo and HAL_PCDEx_SetTxFifo. As below:
HAL_PCDEx_SetRxFiFo(&hpcd_USB_FS, 0x40);
HAL_PCDEx_SetTxFiFo(&hpcd_USB_FS, 0, 0x40); // EP0So my understanding is that my old code translates into something like this:
HAL_PCDEx_SetRxFiFo(&hpcd_USB_FS, 0x40); // 0x0
HAL_PCDEx_SetTxFiFo(&hpcd_USB_FS, 0, 0x40); // 0x80
HAL_PCDEx_SetTxFiFo(&hpcd_USB_FS, 7, 0x40); // 0x87
HAL_PCDEx_SetTxFiFo(&hpcd_USB_FS, 1, 0x40); // 0x81
HAL_PCDEx_SetTxFiFo(&hpcd_USB_FS, 2, 0x40); // 0x82
Is this correct or am I missing something?
