cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2xx USB Library - Default COM Port Configuration

terryhansen
Associate II
Posted on February 15, 2012 at 18:12

I am trying to use the VCP example project in the STM32F2xx USB library on an IAR STM32F207 dev board.

The device enumerates correctly when I plug in a laptop and it is recognized by the ST VCP USB driver as COM4.  But it looks like the USB library's default configuration for the UART in the VCP project (in file usbd_cdc_vcp.c) is 8O1, ie odd parity.  Also, when the VCP enumerates on the laptop, it sends a SET_LINE_CODING message back to the library that configures the UART as 8O1.  (The HyperTerminal on the laptop attached to the VCP is set to 8N1.)  None of my existing comms will work with 8O1.  Is there a way to make the VCP driver on the laptop switch to 8N1?

Also, I am reluctant to modify the USB library code from a default of 8O1 to 8N1 without understanding why it is set to 8O1.  From my experience, 8O1 is kind of unusual and 8N1 is more normal.  Is there a reason for choosing 8O1?  And if so, am I going to mess something up by modifying the code to do 8N1?

Thanks in advance!
1 REPLY 1
terryhansen
Associate II
Posted on February 15, 2012 at 19:32

Correction: the library applies the default configuration to its attached UART not in response to a 

SET_LINE_CODING message from the VCP but as part of the hardware initialization.  But still, it applies 8O1 configuration.  When I change it to 8N1, the example project works.  But that means the USB library has been changed.  Was the library wrong to begin with?  Am I messing up the library by changing to 8N1?

Any wisdom about the STM322xx USB library much appreciated!