
.. _proprf-cc26x2-cc23xx-migration-guide:

CC26x2 to CC23xx Porting Guide
******************************

This section will describe, in general terms, how to port
a project developed for the CC26X2 device on the 
**SimpleLink CC13xx and CC26xx SDK** to a |DEVICE| device running 
the |SDK|.

The best way to migrate is to open a new example project 
with similar functionality in the new SDK and transfer 
your changes and application code over to the new example. 

The following sections discuss the major changes between the
CC26x2 devices and the |DEVICE| devices.


* :ref:`sec-general-considerations-cc26x2-to-cc23xx`

   * :ref:`sec-general-considerations-freertos-cc26x2-to-cc23xx`

   * :ref:`sec-general-considerations-launchpad-support-cc26x2-to-cc23xx`

   * :ref:`sec-general-sensor-controller-cc26x2-to-cc23xx`

* :ref:`sec-migration-guides-cc26x2-to-cc23xx`

   * :ref:`sec-migration-guides-freertos-cc26x2-to-cc23xx`

   * :ref:`sec-migration-guides-RF-stack-cc26x2-to-cc23xx`

   * :ref:`sec-migration-guides-ti-drivers-cc26x2-to-cc23xx`

* :ref:`sec-example-cc26x2-to-cc23xx`

   * :ref:`sec-example-simple-peripheral-port-cc26x2-to-cc23xx`

.. _sec-general-considerations-cc26x2-to-cc23xx:

General Considerations
======================

.. _sec-general-considerations-freertos-cc26x2-to-cc23xx:

FreeRTOS
--------

The |DEVICE| devices exclusively support FreeRTOS. If a project
needs to be migrated from the **SimpleLink CC13xx and CC26xx SDK**
and uses TI-RTOS or TI-RTOS7, it will need to be converted to FreeRTOS during
the migration process.

.. _sec-general-considerations-launchpad-support-cc26x2-to-cc23xx:

CC23xx LaunchPad support
------------------------
All example applications are compatible with the CC23xx LaunchPad development
kit. These features allow for a unified development experience and empowers
developers to rapidly release to market.

.. _sec-general-sensor-controller-cc26x2-to-cc23xx:

Sensor Controller
-----------------
The |DEVICE| does not support the Sensor Controller. Any applications being ported
from the **SimpleLink CC13xx and CC26xx SDK** that make use of the Sensor Controller will
need to be modified to not use the Sensor Controller in order to work with the |DEVICE|.

.. `CC23xx LaunchPad Development Kit Product Page <http://www.ti.com/tool/LP-EM-CC2340R5>`_

.. _sec-migration-guides-cc26x2-to-cc23xx:

Migration Guides
================

.. _sec-migration-guides-freertos-cc26x2-to-cc23xx:

Migrate to FreeRTOS
-------------------

An important step that must be taken in order to port an example from the
**SimpleLink CC13xx and CC26xx SDK** to the |SDK| is to ensure that
the project is implemented in FreeRTOS. The |SDK| only supports
FreeRTOS, so any projects running on TI-RTOS or TI-RTOS7 will not work unless they
are converted to FreeRTOS.  The best way to migrate is to use a new example 
project with similar functionality in the new SDK which already uses FreeRTOS. 
|STACK| also supports No-RTOS projects.

.. _sec-migration-guides-RF-stack-cc26x2-to-cc23xx:

Migrate the RF stack
--------------------

The |SDK| RF stack uses RCL instead of rflib to control RF features.  For 
more information, see :ref:`rflib-rcl-migration-guide` and 
`Radio Control Layer (RCL)`_ 

.. _sec-migration-guides-ti-drivers-cc26x2-to-cc23xx:

Migrate the TI drivers
----------------------

It is important to ensure that projects that are being ported are
not using deprecated libraries. A few migration guides for libraries
that should be updated as part of the **SimpleLink CC13xx and CC26xx SDK**
to |SDK| migration are shown below:

*  :ref:`uart_to_uart2-porting-guide`
*  :ref:`sec-cc23xx-gpio++-porting-guide`

.. _sec-example-cc26x2-to-cc23xx:

Example
=======

The following section provides an example of how to port a project
from the **SimpleLink CC13xx and CC26xx SDK** to the |SDK|. All of
the steps shown below are essentially putting into practice the
theory discussed earlier in this document.

.. _sec-example-rfPacketTx-port-cc26x2-to-cc23xx:

Porting RF Packet TX
--------------------

For this porting guide, RF Packet TX will be ported from the 
**SimpleLink CC13xx and CC26xx SDK** using a CC26X2R1 device to the 
|SDK| using a |DEVICE_LOW_PLUS| device. To minimize project 
configuration differences, start with an example project in the |DEVICE|.
The recommended approach is to start with a |SDK| project that 
contains the same base functionality as the porting target project 
and merge in any custom functionality. 

.. warning::
   As the |SDK| is still under active development, there is still
   some functionality missing that will be added as development
   continues. If you have any questions about what is currently
   supported or not supported in the latest version of the |SDK|,
   please reach out to your TI representative.

#. Choose a |SDK| FreeRTOS or No-RTOS example project that contains your target
   project's base functionality.

#. Transfer all modified application files from **SimpleLink CC13xx and CC26xx SDK**
   project into the |SDK| example project.  In this example, the ``rfPacketTx.c`` 
   file from **SimpleLink CC13xx and CC26xx SDK** project were moved into RF Packet 
   TX |SDK| example.

#. Move any other custom files and services that the application is using to the 
   |SDK| project.

#. Perform all necessary conversions from rflib to RCL by leveraging 
   :ref:`sec-migration-guides-RF-stack-cc26x2-to-cc23xx`.

#. Transfer the SysConfig settings visually through the GUI.  Custom RF Stacks 
   are not included in the |SDK| SysConfig version and thus the radio PHY must be 
   selected through pre-definitions.

   +-----------------------+---------------------------------------------------+
   | **Predefined Symbol** | **PHY setting**                                   |
   +=======================+===================================================+
   | *None*                | Bluetooth LE 5.0 1Mbps                            |
   +-----------------------+---------------------------------------------------+
   | USE_250KBPS_MSK       | 250kbps MSK                                       |
   +-----------------------+---------------------------------------------------+
   | USE_250KBPS_MSK_FEC   | 250kbps MSK with Forward Error Correction (FEC)   |
   +-----------------------+---------------------------------------------------+

   .. note:: Several other PHYs are supported as shown inside the ``setup`` folder
        which will require including the correct ``.h`` file inside ``rfPacketx.c``
        along with other relevant RF setting changes in the application file.

#. If necessary, update the project to use the newer TI drivers that are
   supplied with the |SDK|.

   The UART library has been deprecated and replaced by the UART2 library.
   Please follow the  :ref:`uart_to_uart2-porting-guide`

   The Pin and GPIO libraries are deprecated and have been replaced by the
   GPIO++ library. To update Pin or GPIO code, please reference the following
   porting guide :ref:`sec-cc23xx-gpio++-porting-guide`

#. Refer to the Core SDK release notes for additional information and the 
   FreeRTOS examples included with |SDK|.

   For additional information on how |SDK| uses FreeRTOS see
   :ref:`sec-freertos-overview`.

#. At this stage, most, if not all, of the modifications required have been completed.
   It is possible that some additional modifications may be required for the project
   to function as intended, but these changes can be relatively minor compared to the
   modifications already made by following this porting guide.

