cancel
Showing results for 
Search instead for 
Did you mean: 

Do the Virtual COM Port drivers work with Windows 7?

Harry McKee
Associate II

I have tried installing and running projects using the USB_Device/CDC_Standalone project for both the STM32L476G-EVAL and the STM32F779I-EVAL boards, but every time I connect the board using the USB FS port, I get a driver error "This device cannot start. (Code 10)"

After uninstalling and installing the VCP drivers multiple times (using STLinkUSBDriver.dll v4.4.0.0 and Virtual COM Port driver 1.3.1.0 from VCP_V1.5.0_Setup_W7_x64_64bits.exe) , it never works. I've searched through the ST forums but have had no luck finding any documentation for this issue.0690X000008Bg2FQAS.png

After a little more research, I found the stm32l4xx_ll_usb.c driver is hard faulting in USB_WritePacket.

0690X000008Bg6qQAC.png

The hard fault is occurring during the write of 0x200001BE USBD_StringSerial. See attached image:

0690X000008vtHeQAI.png

I also changed the heap size according to the information in the FAQ https://community.st.com/s/article/FAQ-USB-device-not-recognized

This had no effect on the hard fault.

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

Ah, the fault in USB_WritePacket.

This is simply because of unaligned 32-bit access. Already reported here earlier.

Try to change this way :

HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma)
{
  uint32_t USBx_BASE = (uint32_t)USBx;
  uint32_t *pSrc = (uint32_t *)src;
  uint32_t count32b, i;
 
  if (dma == 0U)
  {
    count32b = ((uint32_t)len + 3U) / 4U;
    for (i = 0U; i < count32b; i++)
    {
      if (((uint32_t)pSrc & 0x3) == 0) {
        USBx_DFIFO((uint32_t)ch_ep_num) = *((__packed uint32_t *)pSrc);
      } else {         //<<< UNALIGNED
        uint32_t v;
        memcpy(&v,pSrc,4);
        USBx_DFIFO((uint32_t)ch_ep_num) = v;
      }
      pSrc++;
    }
  }
 
  return HAL_OK;
}

(fast and dirty fix, not optimized, sorry)

-- pa

View solution in original post

7 REPLIES 7

Thank you for the reply. I should have said that I have already downloaded and installed (multiple times) both the VCP driver 1.5.0 in VCP_V1.5.0_Setup_W8_x64_64bits.exe and the ST-Link driver in STSW-LINK009.

I am already running the latest drivers from ST for both ST-Link and the Virtual COM Port.

Looks like my problem is similar to this thread: https://community.st.com/s/question/0D50X0000Amj7LqSQI/stm32f407vgtx-cdc-error-driver

After increasing both the stack and heap, the hard fault still persists.

Pavel A.
Evangelist III

Ah, the fault in USB_WritePacket.

This is simply because of unaligned 32-bit access. Already reported here earlier.

Try to change this way :

HAL_StatusTypeDef USB_WritePacket(USB_OTG_GlobalTypeDef *USBx, uint8_t *src, uint8_t ch_ep_num, uint16_t len, uint8_t dma)
{
  uint32_t USBx_BASE = (uint32_t)USBx;
  uint32_t *pSrc = (uint32_t *)src;
  uint32_t count32b, i;
 
  if (dma == 0U)
  {
    count32b = ((uint32_t)len + 3U) / 4U;
    for (i = 0U; i < count32b; i++)
    {
      if (((uint32_t)pSrc & 0x3) == 0) {
        USBx_DFIFO((uint32_t)ch_ep_num) = *((__packed uint32_t *)pSrc);
      } else {         //<<< UNALIGNED
        uint32_t v;
        memcpy(&v,pSrc,4);
        USBx_DFIFO((uint32_t)ch_ep_num) = v;
      }
      pSrc++;
    }
  }
 
  return HAL_OK;
}

(fast and dirty fix, not optimized, sorry)

-- pa

Thanks for info, I was going to try that next. I've looked for more details on the unaligned memory access, but only found a couple posts mentioning this:

https://community.st.com/s/question/0D50X00009XkgYUSAZ/stm32l4-usb-otg-host-driver-for-cdcncm

https://community.st.com/s/question/0D50X0000AiyCdYSQU/unaligned-memory-access-in-function-usbwritepacketusbreadpacket-stm32fcubefwf4v1240

The latest STM32L4 firmware doesn't contain USB_WritePacket with the DMA argument. I see the alternate version of USB_WritePacket with dma is in the F7 firmware.

Do you have any links to the previous error report?

Yes, it is the 2nd your link.

Unfortunately, the software team does not have a bug tracker visible for us, and isn't willing to make commitment for updates.

-- pa

KFite.1
Associate

Hi,

I want to add useful info about one more solution. 

You can emulate serial port in a system on several different Windows versions and interconnect them virtually. So if you have some problem or may be want alternative software, you can try Serial Port Emulator https://www.virtual-serial-port.org/

And i want to say that it is not free, but you have 14 day fully-functional trial.