Setting Up Kernel-Mode Debugging using Serial over USB in Visual Studio

Important

This feature is not available in Windows 10, version 1507 and later versions of the WDK.

The Sharks Cove development board supports serial debugging over a USB cable.

To use Microsoft Visual Studio for kernel-mode debugging, you must have the Windows Driver Kit (WDK) integrated with Visual Studio. For information about how to install the integrated environment, see Windows Driver Kit (WDK).

As an alternative to using Visual Studio to set up serial debugging over a USB cable, you can do the setup manually. For more information, see Setting Up Kernel-Mode Debugging using Serial over USB Manually.

The computer that runs the debugger is called the host computer, and the computer being debugged is called the target computer. In this topic, the Sharks Cove board is the target computer.

Setting up a Host Computer for debugging the Sharks Cove board

  1. On the host computer, open Device Manager. On the View menu, choose Devices by Type.

  2. On the Sharks Cove board, locate the debug connector. This is the micro USB connector shown in the following picture.

    picture that shows debug connector on sharks cove board

  3. Use a USB 2.0 cable to connect the host computer to the debug connector on the Sharks cove board.

  4. On the host computer, in Device Manager, two COM ports will get enumerated. Select the lowest numbered COM port. On the View menu, choose Devices by Connection. Verify that the COM port is listed under one of the USB host controllers.

    screen show that shows com ports in device manager

    Make a note of the COM port number. This is the lowest COM port number that shows under the USB host controller node. For example, in the preceding screen shot, the lowest COM port number under the USB host controller is COM3. You will need this COM port number later when you start a debugging session. If the driver is not already installed for the COM port, right click the COM port node, and choose Update Driver. Then select Search automatically for updated driver software. You will need an internet connection for this.

Configuring the host and target computers

In these steps, the Sharks Cove board is the target computer.

  1. Begin configuring your host and target computer as described in Provision a computer for driver deployment and testing (WDK 8.1).

  2. On the host computer, in Visual Studio, when you come to the Computer Configuration dialog box, select Provision computer and choose debugger settings.

  3. For Connection Type, choose Serial.

    screen shot showing an example of debugger settings with values for the following fields: connection type, target name, and bus parameters

    For Baud Rate, enter 115200. For Port, enter the name of the COM port that you noted previously in Device Manager (for example, com3). For Target Port, enter com1.

  4. The configuration process takes several minutes and might automatically reboot the target computer once or twice. When the process is complete, click Finish.

Starting the Debugging Session

  1. On the host computer, in Visual Studio, on the Tools menu, choose Attach to Process.
  2. For Transport, choose Windows Kernel Mode Debugger.
  3. For Qualifier, select the name of the target computer that you previously configured.
  4. Click Attach.

Troubleshooting Tips for Serial Debugging over a USB Cable

Specify correct COM port on both host and target

On the target computer (Sharks Cove board), verify that you are using COM1 for debugging. Open a Command Prompt window as Administrator, and enter bcdedit /dbgsettings. The output of bcdedit should show debugport 1.

On the host computer, verify that you are using the COM port that you noted earlier in Device Manager.

  1. On the host computer, in Visual Studio, on the Driver menu, choose Test > Configure Computers.
  2. Select the name of your test computer, and click Next.
  3. Select Provision computer and choose debugger settings. Click Next.
  4. Verify that the correct COM port number is listed for Port.

Baud rate must be the same on host and target

The baud rate must be 115200 on both the host and target computers.

On the target computer (Sharks Cove board), open a Command Prompt window as Administrator, and enter bcdedit /dbgsettings. The output of bcdedit should show baudrate 115200.

On the host computer, verify that you are using a baud rate of 115200.

  1. On the host computer, in Visual Studio, on the Driver menu, choose Test > Configure Computers.
  2. Select the name of your test computer, and click Next.
  3. Select Provision computer and choose debugger settings. Click Next.
  4. Verify that the Baud Rate is 115200.

Setting Up Kernel-Mode Debugging in Visual Studio