KB 03: Keil Real-Board Debugging Issue

If the system is not working as expected, you must use real-board debugging to track the code. Keil supports hardware debugger by selecting hardware debug from Options for Target ➤ Debug as shown in Figure 1.

Keil HardwareDebug 01
Figure 1: Selecting Hardware Debug

Next, you have to build the code. If there are no error, then click the debug button b uv4 debug to start the debug and click it again to exit the debug.

When trying to enter hardware debugging mode on Keil μVision, the debugger immediately exits upon entering. Keil can still download object code, but will not run the debugger. Usually, this problem occurs after a while when the Keil debugger is working properly.

The following steps can fix the error:

  1. Open windows registry:
    Open Command Prompt window. On the screen type regedit.exe to open Registry Editor. The contents should look similar to the image below:
    RegistryEditor s
  2. In the Registry Editor, search for the directory:
    HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers
    RegistryEditor Layers 01 s
  3. If there is a similar entry to the following items below (the name will depend on the version and the folder you installed Keil), and select the entry
    C:\Keil_v5\UV4\UV4.exe REG_SZ $ IgnoreFreeLibrary <lmidk-agdi.dll>
    RegistryEditor Layers 02 s
    then remove it.
    RegistryEditor Layers 03 s
  4. Reboot the computer and then try again.