This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2340R5: How to configure the Flash Protection Settings in BLE_examples?

Part Number: CC2340R5
Other Parts Discussed in Thread: UNIFLASH, SYSCONFIG

Tool/software:

Hi TI,

I have a question regarding the flash protection settings for the CC2340R5. I want to set a secure block in the flash to store a key, and this flash block needs to have write/erase protection. For example, I hard-code the key in the firmware and store this key in a specific address in the flash. Afterwards, even using OTA should not be able to update the data in this secure block.

Currently, I am using the SDK: "simplelink_lowpower_f3_sdk_8_10_01_02\examples\rtos\LP_EM_CC2340R5\ble5stack\basic_ble"

How should I configure the parameters in the Flash Protection Settings in the syscfg file?


Currently, I know that the flash has a total of 512kB, and each sector is 2kB, so there are a total of 0~255 sectors that can be configured.

I have tried filling in various values, but whenever I use Uniflash to erase the chip, the originally set flash block seems to be erased. Is there a way to prevent Uniflash from erasing the specified secure block? How should I set it correctly? Or do I need to call any function in the code, such as SACI commands? Thank you.

  • Hi Aki,

    Have you tried setting Chip Erase (Retain sectors specified in CCFG) under Program Load in the Settings & Utilities tab of SysConfig?

    Regards,
    Tanguy

  • Hi Tanguy:

    No, I use "Chip Erase", and this look like forcing a flash erase? 
     In CC23xx SimpleLink Wireless MCU P.423 said,

               

    After reading the three highlighted sentences in the image above, I have some questions,
    The three options in Program Load, "Chip Erase, Chip Erase (Retain sectors specified in CCFG), Do not erase sectors (program load only)" are controlled by ROM bootloader? and SACI also send by ROM bootloader? So "ROM bootloader use SACI to execute the flash Erase", does my understanding correct?


    And others questions, the Flash Protection Settings in syscfg file,

    How to set the hex value I should fill in Sectors 0-31? It said "1 sector/bit", does it means 1 hex number equal to 4 sectors?
    For example, if I want to protect sector 4~sector 7, the binary value will be "0000 0000 0000 0000 0000 0000 1111 0000", then transfer the binary number to hex number, it will be "0x000000F0", so the value I should fill in is "0x000000F0". Does my calculation is correct?


    Regards,

    Aki

  • Hi Aki,

    As described in the section 8.2 Flash Programming, there are 3 ways to program the flash forCC23xx:

    •  Using SWD Device Management Command Interface, this is the interface presenting the SACI commands.
    •  Using the Serial Bootloader, this interface will use "SACI like" commands.
    •  Using a user defined bootloader present in flash

    When you are flashing a device with Uniflash or CCS, the SWD interface is used.

    Your calculation is correct, to protect sector 4 ~ sector 7 the binary value 0x000000F0 should be written.

    Regards,
    Tanguy