Skip to main content
Visitor II
April 7, 2020
Solved

NUCLEO-F746ZG USB_OTG_FS stucks at cdc_transmit_fs() function.

  • April 7, 2020
  • 1 reply
  • 608 views

Hello, I am having problem sendind data to PC with USB. I set the USB_OTG_FS to device only mode and activated the VBUS. I selected Class for FS IP to Communication Device Class (Virtual COM Port). When I try to send data with the simple code below, no data is transmitted to PC:

	while(1)
	{
		//TSA_input_voltage = readVoltageValue(ADC_CHANNEL_5);
		memset(USB_String,0x00,255);
		StringLength = sprintf(USB_String," USB Voltage in: %d", 5);
		CDC_Transmit_FS(USB_String,StringLength);
		//	HAL_Delay(1000);
	}

In the debugging window I can see that it gets stuck at :

if (hcdc->TxState != 0){
 return USBD_BUSY;
 }

So USBD is busy all the time. As a side note: I try to debug it by using an oscilloscope and it is clear that USB is initialized correctly. D+ line is high and D- side is low all the time. But that's all. No transmission occurs..

So my question is, what might cause this problem? I believe I am missing some obvious point so I wanted to take opinions. Thanks beforehand.

    This topic has been closed for replies.
    Best answer by GunkutA

    Okay the USB connector was broken. Changed the board and now it works fine.

    1 reply

    GunkutAAuthorAnswer
    Visitor II
    April 7, 2020

    Okay the USB connector was broken. Changed the board and now it works fine.