.. _sec-config-debug-mode:

Configuring Debugger in Code Composer Studio
--------------------------------------------

If only one debug probe is attached, |CCS| will automatically select the
connected debug probe when a debug session is started. You can start a debug
session by clicking the debug icon |img_icon_debug_ccs| on the toolbar.

.. |img_icon_debug_ccs| image:: /debugging/resources/icon_debug_ccs.png

If more than one debug probe is attached when a debug session is started, CCS
will prompt you to select a debug probe as seen in
:numref:`fig_ccs_probe_select` CCS will save the selected debug probe in the
target configuration for the project.

.. _fig_ccs_probe_select:

.. figure:: /debugging/resources/ccs_probe_select.png
    :align: center

    CCS Probe Selection

To set or change the selected debug probe for a project, it is necessary to set
the serial number for the probe in the project's target configuration.

=======================================    ==========================================================================
1. Open the target configuration file.     .. image:: /debugging/resources/ccs_targetconfig_file_cc23xx.png
2. Open the Advanced pane.                 .. image:: /debugging/resources/ccs_targetconfig_advanced_pane_cc23xx.png
3. Choose the top-level debugger entry.    .. image:: /debugging/resources/ccs_targetconfig_probe_cc23xx.png
4. Enter the serial number.                .. image:: /debugging/resources/ccs_targetconfig_serial.png
=======================================    ==========================================================================

Find The Serial Number
----------------------

To find the serial number for XDS110 debug probe, open a command prompt and run
the ``xdsdfu.exe`` command for your |CCS| version, e.g.
``<CCS_INSTALL_DIR>\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -e``. For 
UniFlash, the command will be: 
``<UNIFLASH_INSTALL_DIR>\deskdb\content\TICloudAgent\win\ccs_base\common\uscif\xds110\xdsdfu.exe -e``.
This will enumerate all the attached XDS110 debug probes. This should result in
output like the following.

.. code-block:: doscon

    C:\>c:\ti\ccs1210\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -e

    USB Device Firmware Upgrade Utility
    Copyright (c) 2008-2019 Texas Instruments Incorporated.  All rights reserved.

    Scanning USB buses for supported XDS110 devices...


    <<<< Device 0 >>>>

    VID: 0x0451    PID: 0xbef3
    Device Name:   XDS110 Embed with CMSIS-DAP
    Version:       3.0.0.22
    Manufacturer:  Texas Instruments
    Serial Num:    LS420073
    Mode:          Runtime
    Configuration: Standard

    Found 1 devices.

    C:\>

.. note:: More information of the tool can be found in 
    ``<CCS_INSTALL_DIR>\ccs\ccs_base\common\uscif\xds110\XDS110SupportReadMe.pdf``

For XDS100 series debug probes, open a command prompt and run the
``xds100serial.exe`` command for your CCS version, e.g. 
``<CCS_INSTALL_DIR>\ccs\ccs_base\common\uscif\xds100serial.exe``. This should result 
in output like the following:

.. code-block:: doscon

    C:\>c:\ti\ccs1210\ccs\ccs_base\common\uscif\xds100serial.exe
    Scanning for XDS100 emulators...

    VID/PID    Type            Serial #    Description
    0403/a6d1  XDS100v3        06EB12213144  Texas Instruments XDS100v3

    C:\>

Configure the Serial Number
---------------------------
Open the ``xdsdfu.exe`` command for your |CCS| version, e.g.

* ``<CCS_INSTALL_DIR>\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -m``
* ``<CCS_INSTALL_DIR>\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -s LS470000 -r``

These will first switch XDS110 to DFU mode if it is already in runtime mode,
then set the serial number to the LS470000. The output should be like the following.

.. code-block:: doscon

    C:\>c:\ti\ccs1210\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -m

    USB Device Firmware Upgrade Utility
    Copyright (c) 2008-2019 Texas Instruments Incorporated.  All rights reserved.

    Scanning USB buses for supported XDS110 devices...


    <<<< Device 0 >>>>

    VID: 0x0451    PID: 0xbef3
    Device Name:   XDS110 Embed with CMSIS-DAP
    Version:       3.0.0.22
    Manufacturer:  Texas Instruments
    Serial Num:    L1100JU9
    Mode:          Runtime
    Configuration: Standard

    Switching device into DFU mode.

    C:\>c:\ti\ccs1210\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -s LS470000 -r

    USB Device Firmware Upgrade Utility
    Copyright (c) 2008-2019 Texas Instruments Incorporated.  All rights reserved.

    Scanning USB buses for supported XDS110 devices...

    Setting serial number to "LS470000"...

    C:\>

Program Board ID on LP-EM Boards
--------------------------------

It is possible that in some very rare circumstances different LP-EM Boards are with the same Board ID or 
with empty Board ID. In this case:

 - UniFlash may not identify the device correctly
 - CCS may not identify the board correctly

Programming the different Board ID to each board should help. It can be done also 
by open a command prompt and run the ``xdsdfu.exe`` command. Plug only one LP-EM 
board to the host PC. Unplug all other boards. For |CCS| 
version, e.g. ``<CCS_INSTALL_DIR>\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -p``. 
For UniFlash, the command will be: 
``<UNIFLASH_INSTALL_DIR>\deskdb\content\TICloudAgent\win\ccs_base\common\uscif\xds110\xdsdfu.exe -p``. 
This should result in output like the following:

.. code-block:: doscon

    C:\>c:\ti\ccs1210\ccs\ccs_base\common\uscif\xds110\xdsdfu.exe -p LS47XXXX

    USB Device Firmware Upgrade Utility
    Copyright (c) 2008-2019 Texas Instruments Incorporated.  All rights reserved.

    Scanning USB buses for supported XDS110 devices...

    Setting serial number prefix to "LS47XXXX"...

    The serial prefix was set in EEPROM.
    Power cycle the XDS110 for the change to take effect.

After running the command, unplug and re-plug the LP-EM board to the host PC to 
acknowledge the new Board ID to the host PC. 