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.

CC2640R2F: Factory Reset Image?

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2650

Hi,

    Some questions below regarding Factory Reset Image.

  1. How do I generate a Factory Reset Image?
  2. How do I program the Factory Reset Image at External Flash Address 0x40000.
  3. How do invoke or execute a Factory Reset Image.
  4. Can I set my application to do a Factory Reset Image, if there is a failure in my main application, for example a device hang.

- kel

  • Hi Kel,

    I am not sure exactly what you are after here. From 4) it sounds like you want to use the internal Watchdog timer?

    Cheers,
    Fredrik
  • Hi Fredrik,

    I have read the Off-Chip OAD Guide. It says this below regarding the Factory Reset Image.

    EFL_OAD_IMG_TYPE_FACTORY - Describes the permanently resident production image that runs on the device before any OTA updates.

    Meaning that I should flash the factory reset image to External Flash before I do Off-Chip OAD. But, at the Off-Chip OAD Guide, there is no mention how to generate a Factory Reset Image or EFL_OAD_IMG_TYPE_FACTORY. That is why I ask how to generate the Factory Reset Image. Do I need to modify the Post Build Script below in order for the image to be Factory Reset Image?

    ${CG_TOOL_HEX} -order MS --memwidth=8 --romwidth=8 --intel -o ${ProjName}.hex ${ProjName}.out
    ${TOOLS_BLE_DIR}/oad/oad_image_tool ${ProjName}.hex -t offchip -i app --imgVer 0 -ob ${ProjName}.bin -m 0x0000 --r 0x0000

    I am asking this because I need to define the procedure for flashing firmware to our CC2640R2F Product, which will support Off-Chip OAD. After flashing BIM, App, and Stack, It seems I need to flash also the Factory Reset Image at External Flash. Do I flash the Reset Image at External Flash using SmartRF Flash Programmer 2 or through OAD. There is no mention about this at Off-Chip OAD Guide.

    - kel
  • Hi,

       I have answered my own questions 1 and 2 reviewing the Off-Chip OAD example program.

       For my question 3 "How to invoke or execute a Factory Reset Image? It seems that I can use the C function SensorTagFactoryReset_applyFactoryImage() from the CC2650 SensorTag project. But, I don't understand how the "Load and launch factory image" code works. Can anyone explain to me?

    void SensorTagFactoryReset_applyFactoryImage(void)
    {
        SensorTagDisplay_suspend();
    
        if (SensorTagFactoryReset_hasImage())
        {
            // Indicate that factory image is launched
    #ifdef IOID_GREEN_LED
            PIN_setOutputValue(hGpioPin, IOID_GREEN_LED, Board_LED_ON);
    #endif
            // Load and launch factory image; page 0 and 31 must be omitted
            ((void (*)(uint32_t, uint32_t, uint32_t))BL_OFFSET)
                (EFL_ADDR_RECOVERY + APP_START, // Location in external flash
                 EFL_SIZE_RECOVERY - 0x2000,    // Length
                 APP_START);                    // Location in internal flash
        }
        else
        {
            // Indicate that factory image launch failed
            PIN_setOutputValue(hGpioPin, IOID_RED_LED, Board_LED_ON);
        }
    
        SensorTagDisplay_resume();
    }

    - kel