cancel
Showing results for 
Search instead for 
Did you mean: 

USB HS CDC stop working if Internal IP DMA is enabled on STM32F469NI

kiran_g
Associate

Hi,

I am working on STM32F469NI using the USB OTG HS peripheral in CDC (VCOM) mode.

  • When using USB CDC without DMA, the VCOM works fine.

  • However, when I enable Internal IP DMA (from CubeMX → USB_OTG_HS → Parameter Settings → Enable internal IP DMA), the USB CDC communication stops working after some time.

Setup details:

  • MCU: STM32F469NI

  • USB mode: Device (CDC VCOM)

  • PHY: Internal FS PHY

  • DMA Mode: Internal IP DMA enabled for USB_OTG_HS

  • Running on custom board

Observed behavior:

  • On PC, the VCOM port is detected correctly.

  • Initially, data transfer works fine.

  • After some time (or after repeated Tx/Rx), the communication hangs completely. No data transfer occurs until reset.

  • If I disable Internal IP DMA, the issue goes away.

What I tried:

  • Checked buffer alignment (made Tx buffers 4-byte aligned).

  • Verified HAL callbacks (CDC_Transmit_FS etc.) are still being called.

Questions:

  1. Is Internal IP DMA for USB HS CDC fully supported on STM32F469NI?

  2. Are there known limitations / errata related to this?

  3. Any additional configuration needed for DMA mode (buffer alignment, cache maintenance, etc.)?

  4. Could this be an issue in Cube/HAL implementation?

Any guidance or reference examples would be helpful.

1 REPLY 1
davidclark
Visitor

This is a known limitation with the STM32 OTG HS internal DMA option.

  • When you enable Internal IP DMA (via USB_OTG_HS → Parameter Settings → Enable internal IP DMA), the USB peripheral expects strict buffer alignment and memory access rules that the current Cube/HAL implementation for CDC class does not fully handle.

  • Known issues:

    • ST’s own USB Device Library (UM1734) states that enabling internal DMA can cause unpredictable behavior in CDC.

    • The errata for several STM32F4/F7 MCUs mention that DMA mode is not fully supported for all classes, especially CDC.

  • Why it hangs: The USB core uses DMA for endpoint transfers, but the HAL CDC code sometimes passes non-aligned or cached buffers, causing stalls.

  • Workarounds:

    1. Keep Internal IP DMA disabled (this is ST’s official recommendation for CDC mode).

    2. If you must use DMA:

      • Ensure all Tx/Rx buffers are 4-byte aligned and in non-cacheable memory.

      • On MCUs with D-Cache (F7/H7), perform SCB_CleanInvalidateDCache_by_Addr() around buffers.

      • Modify HAL to allocate buffers in a dedicated section (or use MPU to mark them as non-cacheable).

  • Bottom line: There is no complete HAL fix as of today; ST usually suggests disabling internal DMA for CDC device mode unless you rewrite parts of the USB stack.

References: