# Debugging the Sample Code

## Preparing J-Link for Debugging

Before debugging with J-Link, go to C:\Keil_v5\ARM\Segger and make sure that the folder contains a JL2CM3.dll file. As well, make sure that you have installed a compatible version of J-Link.

## Debugging Applications

The IDE’s debug configurations are already set in the CMSIS-Pack. To debug an application:

1. Make sure the EVB is connected to the PC via a USB cable.
2. Select Debug > Start/Stop Debug Session or click the icon shown in the "Start/Stop Debug Session Icon" figure.

Figure: Start/Stop Debug Session Icon

3. The application runs up to the first breakpoint in main, as shown in the "Debug Session in the Keil μVision IDE" figure. You can press F11 multiple times to step through the code and observe that the LED changes its state when the application executes the line gpio->ToggleValue(TIMER0_STATES_GPIO).

   .

Figure: Debug Session in the Keil μVision IDE

NOTE: Debug configurations are preconfigured for the sample applications in the CMSIS-Pack. Flash downloading through the Download icon (as shown in the "Download Button Not Supported for J-Link" figure) or F8 is not supported for J-Link.

Figure: Download Button Not Supported for J-Link