cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 USB HS DMA stuck

VSerb.1
Associate

Hello.

I try to setup CDC USB HS with DMA but it blocks after few samples sent.

Here is the minimal code that replicate the problem

int main(void)
{
  /* USER CODE BEGIN 1 */
 
  /* USER CODE END 1 */
 
  /* MCU Configuration--------------------------------------------------------*/
 
  /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  HAL_Init();
 
  /* USER CODE BEGIN Init */
 
  /* USER CODE END Init */
 
  /* Configure the system clock */
  SystemClock_Config();
 
  /* USER CODE BEGIN SysInit */
 
  /* USER CODE END SysInit */
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
  MX_USB_DEVICE_Init();
  /* USER CODE BEGIN 2 */
 
  /* USER CODE END 2 */
 
  /* Infinite loop */
  /* USER CODE BEGIN WHILE */
  int32_t ssss=0;
  char msg2[2048];
  while (1)
  {
    /* USER CODE END WHILE */
 
    /* USER CODE BEGIN 3 */
 
	  sprintf(msg2, "%d\r\n", ssss);
	  CDC_Transmit_HS((uint8_t *) msg2, strlen(msg2));
	  ssss++;
	  HAL_Delay(10);
  }
  /* USER CODE END 3 */
}

On the host side, I open CDC com port in putty, I begin to receive samples sents by stm32 but immediately after few sample no more lines appears.

0693W00000UnWheQAF.png...

0693W00000UnWhtQAF.pngIt blocks here with USBD_BUSY:

0693W00000UnWjpQAF.pngI use STM32F769I-DISCO board,

STM32CubeMX Version 6.6.1

STM32Cube FW_F7 V1.17.0

CPU ICache and DCache disabled

Log output file:   c:\users\victors\appdata\local\temp\stm32cubeprogrammer_a14036.log
ST-LINK SN  : 0671FF555071494867091122
ST-LINK FW  : V2J39M27
Board       : 32F769IDISCOVERY
Voltage     : 3.21V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x451
Revision ID : Rev Z
Device name : STM32F76x/STM32F77x
Flash size  : 2 MBytes
Device type : MCU
Device CPU  : Cortex-M7
BL Version  : --
 
 
 
Memory Programming ...
Opening and parsing file: st-link_gdb_server_a14036.srec
  File          : st-link_gdb_server_a14036.srec
  Size          : 33.41 KB 
  Address       : 0x08000000 
 
 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 1]
Download in Progress:

0693W00000UnWirQAF.png 

0693W00000UnWiwQAF.png0693W00000UnWj6QAF.png0693W00000UnWjBQAV.png 

If I set Enable internal IP DMA for USB_OTG_HS to disabled it works without stopping.

Could you please take a look?

Thanks

2 REPLIES 2
TianZhang
Associate

Hi

I'm using OTG HS on the STM32F746 mcu, in device mode, as a CDC VCP. It works when "Internal IP DMA" is disabled. If I enable DMA, the USB device enumerates but CDC_Transmit_HS() no longer works.

Please let me know the solution if you have solved already.

Best regards,

Tian.

bhaskarm
Associate II

Can you take a look at this issue and tell me if it solves your problem?

Problem with STM32H747 HS USB DMA.