2016-03-07 03:24 PM
The target is
a custom board based on the STM32F373VC. The project was created by STM32CubeMX with the USB Communications Device Class option enabled.
Windows 7's Device Manager shows the connection is working. This is evidenced by �STMicroelectronics Virtual COM Port (COM9)� appearing under �Ports (COM & LPT)�. When Properties is opened on this line the message �This device is working properly.� appears in the General tab's Device status field.
When I attempt to open a terminal emulator session with KiTTY (fork of PuTTY), KiTTY opens a pop up window with the error message:
Unable to open connection to
COM9 Unable to configure serial port.I did not know what to enter in KiTTY for a baud rate, number of bits, parity, and stop bits, so I left these port settings at default.
Why is Window's 7 unable to configure the serial port?
What should the terminal emulator's port settings be?
#cdc #cdc #usb #usbd-cdc-configure-error2016-03-08 09:12 AM
2016-03-08 10:30 AM
Hi Stephen,
install Virtual Com port driver from this .If problem still persists simply replace the VID and PID fields from inf files(generally available in C:\Program Files\STMicroelectronics\Software\Virtual COMPort Driver) with the VID and PID provided in your usb_desc.c file under devicedescriptor.-Hannibal-2016-03-08 03:07 PM
It is FS.
There was only one instance of KiTTY running.It works fine when I use it to communicate with the board using the boards UART interface. The UART interface IC is connected to the processor's USART2 pins.
I am unable to find a Line Coding descriptor. I did findthe
function:
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length) in file usbd_cdc_if.c. It does not do anything. There is only a switch case statement with a lot of cases in it none of which have any code in them. In case CDC_SET_LINE_CODING there is described in comments a line coding structure. I assume this would be the structure of pbuf if cmd were equal to CDC_SET_LINE_CODING. But even if I added code here I do not see it would do any good.
Bre
akpoints I set within
CDC_Control_FS() show it is
not called at all when the board starts up. If I cycle the USB cable connection at the PC it does get called twice, once with cmd equal to DC_GET_LINE_CODING and again with cmd equal to CDC_SET_CONTROL_LINE_STATE. It is seeking to read back something that was never set.
Where is this Line Coding Descriptor? I need to
try configuring KiTTY to match this. Would that I cannot find this explain why I cannot connect KiTTY to the USB driver? Is there something regarding this in STM32CubeMX that I missed?
2016-03-08 03:09 PM
This very driver is the one that is in use, and the one I have this problem with.
2016-03-09 09:47 AM
Hi Stephen,
If sill getting the same issue, this [DEAD LINK /public/STe2ecommunities/mcu/Lists/STM32Java/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/STM32Java/usb%20enumeration%20errors%2c%20new%20project%20from%20cubemx&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000F9A0E3A95BA69146A17C2E80209ADC21¤tviews=172]discussion may help you to solve your issue.-Hannibal-2016-03-11 06:15 AM
For most of ''serial'' terminal application on Windows, GET_LINE_CODING should return exactly the by SET_LINE_CODING.
If you would bind the CDC interface to a UART on STM32F, refer to CDC_Itf_Control() implementation (same as CDC_Control_FS()) in this example file. \STM32Cube_FW_F3_V1.4.0\Projects\STM32373C_EVAL\Applications\USB_Device\CDC_Standalone\Src\usbd_cdc_interface.c If you don't bind CDC interface to any UART, and just use bulk IN/OUT, this simple implementation is enough.static uint8_t lineCoding[7] // <------- add these three lines
// 115200bps, 1stop, no parity, 8bit
= {0x00, 0xC2, 0x01, 0x00, 0x00, 0x00, 0x08};
static int8_t CDC_Control_FS (uint8_t cmd, uint8_t* pbuf, uint16_t length)
{
/* USER CODE BEGIN 5 */
switch (cmd)
{
...
case CDC_SET_LINE_CODING:
memcpy( lineCoding, pbuf, sizeof(lineCoding) ); // <-- add this line
break;
case CDC_GET_LINE_CODING:
memcpy( pbuf, lineCoding, sizeof(lineCoding) ); // <-- add this line
break;
Tsuneo