Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, December 3, 2019 3:34 AM
I have an issue with opening an STMicro USB Virtual com port.
When I plug the device into my PC, the COM port appears as it should, and the Windows Device Manager indicates it is working properly.
I have a C# program on the PC which selects and opens this port.
However, in about 1 in 10 attempts, the PC program sticks on the port.open() command, and after about half a minute, returns with the error "The semaphore timeout period has expired".
I have written a tiny C# program that does nothing more than open the port. This still gives the behaviour noted.
public partial class Form1 : Form
{
SerialPort port = new SerialPort();
string portName = "COM1"; // give it a default to start with
public Form1()
{
InitializeComponent();
// Populate the com port selector combobox with available port names
cmbPortSelect.Items.Clear();
string[] activePorts = SerialPort.GetPortNames();
foreach (string availablePort in activePorts)
{
cmbPortSelect.Items.Add(availablePort);
}
//declare the serial port
port = new SerialPort(portName, 9600, Parity.None, 8, StopBits.One);
port.ReadTimeout = 100;
}
private void cmbPortSelect_SelectedIndexChanged(object sender, EventArgs e)
{
if (cmbPortSelect.SelectedIndex != -1)
{ // it will get set to -1 (ie no selection) in the catch below - we do't want this selected item change to do anything
if (port.IsOpen) port.Close();
port.PortName = (string)cmbPortSelect.SelectedItem;
System.Threading.Thread.Sleep(50);
try
{
port.Open();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
cmbPortSelect.SelectedIndex = -1; // clear the selected item box
}
}
}
}
If instead of using my C# program to open the port, I use the comms program PuTTY, it works every time.
In addition, if I plug in a device with an FDTI USB virtual com port, it also works every time.
I'm using Win7, with the STMicro VCP drivers ver 1.3.1, but the same behaviour occurs with Win10 and the generic Microsoft drivers, which STMicro recommend we use.
There is a version 1.5.1 drivers for Win7, but when I installed them, it reported that they had installed correctly, but the Device Manager still reported ver 1.3.1.
Has anyone noted any similar behaviour?
Thanks,
Steve
All replies (5)
Tuesday, December 3, 2019 7:17 AM
Hi Steve Krenek,
Welcome to MSDN forum.
According to your description, we recommend you need to check the SerialPort parameters from the STMicro USB instruction, then you could also uninstall all STMicro VCP drivers and then re-install version 1.5.1.
If it persists, we recommend you could redirect to STMicro support module for dedicated support.
Hope it could help you.
Best Regards,
Dylan
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected]
Wednesday, December 4, 2019 9:42 PM
Thanks, Dylan,
I fully uninstalled the existing drivers, including deleting the files from the computer.
I then installed from VCP_V1.5.0_Setup_W7_x64_64bits.exe. The installation was successful, but looking in Device Manager, it reports the driver as still being ver 1.3.1, April 2010.
Is this expected?
On the other fron, my apologies, I don't know what you mean by,or how to find "SerialPort parameters from the STMicro USB instruction". Please let me know how to follow this through.
Many thanks,
Steve
Thursday, December 5, 2019 10:24 AM
Hi Steve Krenek,
Thank you for reply.
About the driver installation, you could try to go to "C:\Program Files (x86)\STMicroelectronics\Software\Virtual comport driver\Win7, then run dpinst_amd64.exe, then check if it is V1.5.0.
--"SerialPort parameters from the STMicro USB instruction".
I means that you need to confirm if the port information you type matches official notes. Please check the portname is same with which is in Device Manager, and try other baud rate
port = new SerialPort(portName, 115200, Parity.None, 8, StopBits.One);
If it persists, since it is third product, we recommend you could ask the STMicro support for better help.
Thank you for understanding.
Best Regards,
Dylan
MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected]
Thursday, December 5, 2019 8:47 PM
Thanks again Dylan.
Just for your (and others') information, here is the results of installing the latest version of the drivers.
1. I fully uninstalled the existing drivers. The folder "C:\Program Files (x86)\STMicroelectronics" and all its subfolders disappeared.
2. I reinstalled the drivers from VCP_V1.5.0_Setup_W7_x64_64bits.exe. The above folders reappeared. In "C:\Program Files (x86)\STMicroelectronics\Software\Virtual; com port driver" there was a file version.txt. This stated that the version was 1.5.0
3. I connected my device, and looked with Device Manager for the driver details. They were reported as V1.3.1, April 2010. The file dpinst_amd64.exe that had appeared in the above folder tree was also dated Apr 2010
I conclude that the v1.5.0 distrubution package still has the v1.3.1 drivers inside it.
Many thanks for your help, Dylan. I will pursue this issue with STMicro as well.
Saturday, December 7, 2019 4:33 AM
Fix your STM32 firmware.
-- pa