STM32H753 UsbX MSC + SDMMC DMA
Hi all,
I'm currently working on a project using a STM32H753 in combination with the Azure RTOS UsbX to create a composite class USB device (CDC ACM + MSC).
As a starting point for the MSC support, I'm using this STM github example:
https://github.com/STMicroelectronics/x-cube-azrtos-h7/tree/main/Projects/STM32H735G-DK/Applications/USBX/Ux_Device_MSC
Unfortunately, my board only supports a 1-bit SD bus which is running at 48MHz.
The composite class is working along I'm using the HAL_SD_WriteBlocks_IT / HAL_SD_ReadBlocks_IT functions. By using the IT driven approach, Windows is able to mount the SD card and I can create, edit or delete files as expected.
Changing to the DMA driven functions, then the mount seems to fail, has corrupt disk naming or asks to insert a disk. I'm aware of cache coherency issues in the H7 and I setup the linker file and MPU accordingly (creating an 32kB area for the UsbX memory pool in the AXI SRAM):

Linker file:
/* Specify the memory areas */
MEMORY
{
...
USB_D1 (xrw) : ORIGIN = 0x24077000, LENGTH = 32K
...
}
/* USB RAM section */
.usb_sec (NOLOAD) : {
/* Place OTG PCD handle section at start of USB_D1 */
. = ORIGIN(USB_D1);
*(.UsbHpcdSection)
/* Place UsbX memory pool here - max 28kB */
. = ORIGIN(USB_D1) + 0x1000;
*(.UsbxPoolSection)
} > USB_D1 AT> FLASH
In the linked example above, the PCD handle was also placed in a non cacheable region. Is this actually needed?
As usual, the memory pool (16kB) is then placed in the defined section:
/* USER CODE BEGIN UX_Device_Pool_Buffer */
__attribute__((section(".UsbxPoolSection")))
/* USER CODE END UX_Device_Pool_Buffer */
__ALIGN_BEGIN static UCHAR ux_device_byte_pool_buffer[UX_DEVICE_APP_MEM_POOL_SIZE] __ALIGN_END;
static TX_BYTE_POOL ux_device_app_byte_pool;Furthermore, I'm using test point on PCB to monitor the activation of the USB interfaces (CDC and MSC) and use pins to track read write operations on the MSC interface.
The patterns look very similar for IT and DMA driven communication.
IT driven:

DMA driven:

In case of the IT driven approach, the reading activity completely stops once Windows has mounted the drive. In case of the DMA, the access continues indefinitely:

So, after a few days of searching, I was wondering if anyone can spot an issue with this setup or if there is any errata which I missed regarding the UsbX / SDMMC / DMA on the STM32H7.
Any additional insight where to dig deeper is greatly appreciated :)
Thanks and best regards
Daniel

