I maintain the firmware und update software of a device that integrates a ST microcontroller (STM32L475VET6). The update software is implemented in javascript and c++. In windows 7/8/10 the update software sometimes fails to find the device utilizing c++ windows API functions while the device is in STM DfuSe-mode. The details are described below:
The update program process is as follows:
1.) The device integrating the STM32L475VET6 microcontroller is connected to the PC via USB cable.
2.) A javascript-program is used to establishes a serial connection to the device. If triggered by the user the java-script program sends a json-command via serial connection to the device that restarts the device with starting the bootloader. After reset, the device will be in STM DfuSe-mode.
3.) The javascript program calls a C++ program that shall find the device and transfer a new firmware binary to the device.
The failure occurs in step 3 where the device on some windows PCs can’t be found. In detail:
3.1) A device info set „info“ of connected devices is created by calling the windows API function: SetupDiGetClassDevs(&Guid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE)
.
This function call returns a valid device information set handle (see https://learn.microsoft.com/en-us/windows-hardware/drivers/install/device-information-sets).
3.2) In a for-loop the interfaces of the device info set are enumerated by calling the windows API function SetupDiEnumDeviceInterfaces(info, NULL, &Guid, devIndex, &ifData)
, starting with devIndex = 0
.
On those windows machines where the device is not found the function SetupDiEnumDeviceInterfaces(info, NULL, &Guid, devIndex, &ifData)
returns false
for devIndex = 0
and the program terminates.
A workaround for that failure on some windows 7/8 systems has been to install the STM32 Virtual COM Port Driver 1.5.0 (https://www.st.com/en/development-tools/stsw-stm32102.html). However, this driver cannot be installed on all windows 7/8 PCs as the stm32 virtual com port drivers are not signed and on some machines installing unsigned drivers cannot be enabled.
With windows 10 this workaround is not an option as the drivers STM32 Virtual COM Port Driver 1.5.0 are explicitly not for Windows 10. Moreover, it was observed that the described failure occurred on one windows 10 machine while it did not occur on another windows 10 machine utilizing the same serial port driver (SERIAL.SYS (10.0.19041.1, 88,50 KB (90.624 Bytes), 07.12.2019 10:07)). Both systems had the same windows built installed (Windows 10 Pro, Version 10.0.19041 Build 19041).
I would be thankful for information of any one that has experienced fails in attempts to find stm-devices in dfu-mode under windows and any hints pointing to the cause of the failure?
Thanks in advance
A.