4K Monochrome USB 3.1 Gen 1 Camera

How to get USB Camera Driver Working in WEC7

Published on November 3, 2011

As we know Microsoft has released the USB camera driver source code for Windows Embedded CE 6.0. Using this driver we can directly plug in the USB webcam to the WinCE 6.0 device and we can test the same. Check out my other post about “How to Get USB Camera Working in WinCE 6.0 ARM Kit.

With our new product e-CAM51_USB (https://www.e-consystems.com/5mp-usb-camera-module.asp ), we planned to test that in Windows Embedded Compact 7 as well. We did that with a few tweaks.

So now in this post I am going to show how to port the WinCE 6.0 USB Camera driver to the Windows Embedded Compact 7 OS. In the new Windows Embedded Compact 7 release Microsoft had updated few things in MDD layer of DirectShow Camera Driver. But in the MSDN I don’t find any documentation update about that.


First I had just compiled the WinCE 6.0 USB source as is without any change and it came up with few header files missing issue. After looking into the PUBLIC directory, the names for these header files has been changed in WEC7.Following are the header file changes needed

  • Dbgsettings.h –>cameradebug.h
  • Pindriver.h –>camerapindriver.h

After doing the above changes ,it compiles without error and the usbcam.dll is generated. After adding the bib and reg entries I created the final OS binary image (NK.bin).

I plugged in the USB Camera into the WinCE device and got the following error message from the USB camera driver.

“ERROR: copying the function table. Insufficient memory”

In thiscase, running the DShow camera application will fail to retrieve the loaded Driver name list.

So I just looked for this message in the code of USB driver and found it on the usbpdd.cpp file. It is failing in PDDInit() function where the PDD will pass the function list table to the MDD. This is the code which is failing

// Pass the function table to MDD
  if( pPDDFuncTbl->dwSize>sizeof(PDDFUNCTBL))
    DEBUGMSG(ZONE_ERROR, (DTAG TEXT(“ERROR: copying the function table. Insufficient memory\r\n”)));
  memcpy( pPDDFuncTbl, &FuncTbl, sizeof( PDDFUNCTBL ) );

As this USB camera driver uses the MDD layer from the WinCE PUBLIC source tree in the following location.


By looking into the MDD code it had few additions and update for few cases like handling the AutoFocus feature etc.

They have added three new functions to the original function table in this link.Following are the three function which are added to the PDDFUNCTBL structure and they had named it as PDDFUNCTBL2.

  • PDD_Open()
  • PDD_Close()
  • PDD_GetMetaData()

Now I just looked in to the NULLPDD driver to check how these MDD changes are handled in the PDD, which is in the following location is really a good starting point when you develop your own PDD for your camera.


Looking into the nullpdd.cpp this change had been handled in the following way

  if (pPDDFuncTbl->dwSize<sizeof(PDDFUNCTBL))
  else if (pPDDFuncTbl->dwSize<sizeof(PDDFUNCTBL2))
    memcpy(pPDDFuncTbl, &FuncTbl, sizeof(PDDFUNCTBL));
    pPDDFuncTbl->dwSize = sizeof(PDDFUNCTBL);
  else if (pPDDFuncTbl->dwSize>= sizeof(PDDFUNCTBL2))
    memcpy(pPDDFuncTbl, &FuncTbl, sizeof(PDDFUNCTBL2));

In this case they  had handled both the cases if PDD supports either  PDDFUNCTBL or PDDFUNCTBL2 .

After replacing the above code snippet in the usbpdd.cpp ,proceeded with the building and loading the binaries.

As expected the above error gone and USB camera driver loaded successfully and application works in WEC7.

I hope this helps in getting the USB camera working in Windows Embedded Compact 7 OS.

CTO at | Website | + posts

Prabu is the Chief Technology Officer and Head of Camera Products at e-con Systems, and comes with a rich experience of more than 15 years in the embedded vision space. He brings to the table a deep knowledge in USB cameras, embedded vision cameras, vision algorithms and FPGAs. He has built 50+ camera solutions spanning various domains such as medical, industrial, agriculture, retail, biometrics, and more. He also comes with expertise in device driver development and BSP development. Currently, Prabu’s focus is to build smart camera solutions that power new age AI based applications.

Recently Published