How to correctly enable USB with DMA and DCache on NUCLEO-H723ZG?
I have enabled USB with the following settings:

Following USB middleware is enabled like so:
In the linker script I have moved everything from DTCMRAM to RAM.
Additional section is specified like so
.dma_buffer :
{
*(.dma_buffer)
} >RAM_D2And used like so:
/** Received data over USB are stored in this buffer */
__attribute__((section(".dma_buffer")))
uint8_t UserRxBufferHS[APP_RX_DATA_SIZE];
/** Data to send over USB CDC are stored in this buffer */
__attribute__((section(".dma_buffer")))
uint8_t UserTxBufferHS[APP_TX_DATA_SIZE]; At this point USB device enumerates but looks like no descriptors are transferred to the host.
I also tried to enable MPU like so:
But that did not do the trick.
However, when RAM region base address (0x24000000) is used instead of RAM_D2 (0x30000000) for MPU, device enumerates correctly:
and there is no need for:
__attribute__((section(".dma_buffer")))on rx and tx buffers anymore.
Now the question. How to correctly place only the USB related stuff to non-cacheable region so that rest of the application can work with cache enabled?
In summary, Currently I have disabled cache with MPU for entire region (RAM (xrw) : ORIGIN = 0x24000000, LENGTH = 128K). USB with DMA works, but it means that rest of the application also is experiencing disabled cache which is not what I want. I only want to disable cache for USB stuff. It is not enough just to place rx and tx buffers in non-cacheable region. From findings, it seems that also descriptors and potentially other stuff must ble placed in non-cacheable region as well.
