cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-F746ZG USB_OTG_FS stucks at cdc_transmit_fs() function.

GunkutA
Senior

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.

1 ACCEPTED SOLUTION

Accepted Solutions
GunkutA
Senior

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

View solution in original post

1 REPLY 1
GunkutA
Senior

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