CC33XX
======

The CC33XX devices have One Time Programming (OTP) bits that a user can program
to store certain information permanently to the device. The OTP bits, or fuses, can be programmed
by the Programmer Tool. These OTP bits can be used to store the following information:

* Custom Base MAC Address
* Configuration Key
* Country Code
* Disable Wi-Fi 6
* Enable Rollback Protection
* Vendor Key
* OTP Lock

To begin using the Programming Tool, connect a XDS110 to the BP-CC33x1 board and to the PC with a USB-C cable.

Then, launch the simplelink_wifi_toolbox.exe. When a browser opens, select the "Programmer" box.
Select 'XDS110' for the Device Connection Interface and 'CC33XX' for the Device Part Number, as in the image below.
Press the 'Refresh Device List' and select the XDS110 from within the 'XDS110 Serial Number' drop-down.
Finally, click on 'Start'.

.. figure:: resources/cc33xx-programmer.png
    :align: center
    :scale: 50

The Programmer tool will now download a specific firmware to enable fuse programming on the CC33XX device.
Once successful, the user will be greeted with the following screen:

.. figure:: resources/cc33xx-programmer-main.png
    :align: center
    :scale: 50

.. note::
    Fuse programming can only be successfully completed if the user has obtained the Programming Token from a TI representative.
    This token should not be shared publicly.

User can now select a Field and enter in a new value. Once all fields and values and Programming Token have been entered,
pressing 'Program' will begin the fuse programming process.

The 'Lock' button will permanently lock the device so that future fuse programming will not occur.

**CC33XX CLI**
--------------

The programmer tool can also be used with a CLI interface.

The `download_programmer` command downloads the radio tool firmware to the device. This is a *prerequisite* for all other fuse operations.

.. code-block:: bash
    
    # Download with default firmware files (from binaries/CC33XX_Fuse_Programmer/)
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto download_programmer

Setting each of the fuse values can be done with the following example commands:

.. code-block:: bash
    
    # Program MAC address
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --mac_addr 10:20:30:40:50:60 --token <TOKEN>

    # Program Wi-Fi 6 disable
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --wifi6_disable 1 --token <TOKEN>

    # Program configuration key (hex format with 0x prefix)
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --conf_key 0xC6789456 --token <TOKEN>

    # Program configuration key (hex format without 0x prefix)
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --conf_key C6789456 --token <TOKEN>

    # Program country code (automatically enables country code restriction)
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --country_code IL --token <TOKEN>

    # Program multiple values at once
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --mac_addr 10:20:30:40:50:60 --wifi6_disable 1 --country_code US --token <TOKEN>

    # Program vendor key
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --vendor_key 0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF0123456789ABCDEF --vendor_key_usage 0 --token <TOKEN>

    # Enable rollback protection
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto set --rollback_protection_enable 1 --token <TOKEN>

Finally, the device can be locked, preventing any further programming. This operation is irreversible.

.. code-block:: bash
    
    # Lock Fuse (token is required)
    simplelink-wifi-toolbox.exe cc33xx-fuse-programmer -i XDS110 -param1 auto lock --token <TOKEN>
