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.

CC2642R: OAD not Working, Not able to switch to presistant mode

Part Number: CC2642R
Other Parts Discussed in Thread: UNIFLASH

SDK using : simplelink_cc13x2_26x2_sdk_5_20_00_52

Hi Ammar,

As discussed I have created a new thread. As per your input we added the prints in SimplePeripheral_processConnEvt() right above the SystemReset() call and we got the pints also. From this we ensured that the reset occurs but not able to switch in to the presistant mode and we dont see any advertisement also even the SP OAD chip app device name ""SP OAD on-chip"" also not seen in the ble scan list. 

We tried to debug on bim but from the link you has shared is for bim off chip and we are using is bim on chip. 

As per the Ryans recomend we added the macro  SET_CCFG_MODE_CONF_SCLK_LF_OPTION (0x03 for LF RCOSC) in  BIM ccfg_app.c -> ccfg.c file

How we can debug on bim ?

  • Hey Mohan,

    Although the guide is based on offchip, I believe the general steps still apply to the on-chip BIM. Have you tried following the steps in the context of on-chip?

    From this we ensured that the reset occurs but not able to switch in to the presistant mode and we dont see any advertisement also even the SP OAD chip app device name ""SP OAD on-chip"" also not seen in the ble scan list.

    We can take a step back here. Try loading the persistent application and the bim ONLY. Then, perform a reset on the board and it should boot into the only image available (the persistent image). If this test fails, the issue is not related to the application but could be in the setup.

    Here's a screenshot of my Uniflash when flashing only the default persistent app and bim example projects.

    Edit: I've tried the steps above and was successfully able to load into the persistent application.

  • Hi Ammar

    Thanks for the response
    Like you have suggestes we flashed the bim app and persistant app alone . At this point we were able to find that device directly was in OAD persistant mode.

    "Mohan Said -> From this we ensured that the reset occurs but not able to switch in to the presistant mode and we dont see any advertisement also even the SP OAD chip app device name ""SP OAD on-chip"" also not seen in the ble scan list"

    For the above mentioned issue We are suspecting something and We have doubt whether this would be an issue or not ?

    Can you clarify this  -> We checked that while writing a value in characteristic It is storing in Config_NVSInternal1. Can you please tell us when the characteristic is written in Config_NVSInternal1 Here at which NVS Internal memory it is writing ? because In our EVK we unmounted the SPI flash so we ensured that it is not writing in SPI flash other than that where it is writing ?

    If you conformed that Same we will implement on our custom product also.


    Note: After writing the value in characteristic Device is resetting but there was no adv in the mobile app . Now we simply tried flashing the Bim alone , now it was advertising as OAD persisant mode.
    Because of this behaviour we guessed above mentioned doubt is a problem for us.

  • Hey Mohan,

    You are using an on-chip OAD project, so I don't think it should ever write in an off chip storage (i.e. the SPI flash).

    Can you please tell us when the characteristic is written in Config_NVSInternal1 Here at which NVS Internal memory it is writing ?

    On the application project, NVSINTERNAL1 points to the current application image. I assume the write to the characteristic is OK since you were able to verify the SystemReset(); function was called inside the SimplePeripheral_processConnEvt function. When you have flashed all 3 images (BIM, application, and persistent), does the device boot into the application image upon a reset (before even attempting the OAD)?

    Have you tried performing the OAD using BTOOL instead of the mobile app? Have you also tried using the SimpleLink Starter Mobile App to verify the reset into Persistent app?

  • Hi Ammar,

    Sorry for the late response we are deeply debugging on our probem, Now we found how exactly it is working and we has some querries on that.


    Step 1: In EVK we flashed bim, persistant, Simple peripheral OAD applications

    Step 2: From mobile app we are connecting to "SP OAD on-chip" and writng OAD request (i.e) 1 on unknown service(0xFFD0)

    Stp 3: While Writing for OAD request from mobile app "SystemReset();" function is calling.

    query 1: while calling "SystemReset();" function call, System is not rebooting.Why ? We observed, "OAD persistant" is not advertising and suystem is not resetting while calling "SystemReset();" funtion call. It is advertising only when we did the hard reset which is available on EVK.

    query 2: While Writing for OAD request from mobile app, To change the service on next reboot our applicatioin is writing in to some memory. Where it is writng? We suspected before calling "SystemReset()" function call we are calling "osal_snv_write(BLE_NVID_CUST_START, sizeof(sendSvcChngdOnNextBoot), (uint8 *)&sendSvcChngdOnNextBoot);" function Here only it is writing into the memory to change service from application to persistant mode on next reboot. but It is not happening what we suspected. How we confirmed is, We commented the function call "osal_snv_write(BLE_NVID_CUST_START, sizeof(sendSvcChngdOnNextBoot), (uint8 *)&sendSvcChngdOnNextBoot);" and we are writing the OAD request from mobile APP. To avoid it is booting in to persistant mode, we are commented the function call -> "osal_snv_write(BLE_NVID_CUST_START, sizeof(sendSvcChngdOnNextBoot), (uint8 *)&sendSvcChngdOnNextBoot);" but still It is switching in to the persistant app while hard resetting on EVK. Then where it is writing in to the memory to change the service from Application mode to persistant mode on next reboot ?

    Kindly please answer for these two querry we are stucked on this place.

  • Hey Mohan,

    query 1: while calling "SystemReset();" function call, System is not rebooting.Why ? We observed, "OAD persistant" is not advertising and suystem is not resetting while calling "SystemReset();" funtion call. It is advertising only when we did the hard reset which is available on EVK.

    I would try calling SystemReset() on your hardware using a different example as a debug step. Put simply, if the launchpad hardware resets, and the custom hardware fails to reset, perhaps there is an issue with the hardware. If you step into that function, you will find this is the line that resets the device by writing to the reset register.

       // Write reset register
       HWREGBITW( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL, AON_PMCTL_RESETCTL_SYSRESET_BITN ) = 1;

    Then where it is writing in to the memory to change the service from Application mode to persistant mode on next reboot ?

    Let me walk through the flow of what happens when the reset characteristic is written to, hopefully this will help.

    1. The oad_reset_service ResetWriteAttrCB is triggered when the characteristic is written to.
    2. Once written, the oadResetWriteCB is triggered in the simple_peripheral application. This brings us to SimplePeripheral_processOadResetWriteCB.
    3. Next, the simple peripheral application queues the SP_OAD_RESET_EVT, which will eventually trigger SimplePeripheral_processOadResetEvt.
    4. This is where the simple_peripheral application reads the OAD image header for current running application. When found successfully, it invalidates the current running image. This forces, upon the next boot, the persistent image to be booted into after a reset.

    In short, the line you are looking for is:

        if ( OAD_evenBitCount(imgHdr.fixedHdr.imgVld) )
        {
          imgHdr.fixedHdr.imgVld = imgHdr.fixedHdr.imgVld << 1;
          writeFlash((uint32_t)FLASH_ADDRESS(0, IMG_VALIDATION_OFFSET),
                     (uint8_t *)&(imgHdr.fixedHdr.imgVld), sizeof(imgHdr.fixedHdr.imgVld));
        }

    I would recommend to look at the BIM code in parallel. To validate what I said, you can look into the BIM code and find that it does not read a specific space in NVS upon reboot.

  • Hi Ammar,

    // Write reset register
    HWREGBITW( AON_PMCTL_BASE + AON_PMCTL_O_RESETCTL, AON_PMCTL_RESETCTL_SYSRESET_BITN ) = 1;

    Even we tried the above reset statement in main() function also that reset is not happening  we verified with debug LED also. It is not resetting. After the OAD request from the mobile app it is not resetting then If we loaded the bim app once again then it is switching to persistant mode means it is resetting. We have a doubt that while calling the above reset register statement, Is it stuck anywhere ?

  • Hey Mohan,

    What is the result of calling this statement using a launchpad kit?

  • Hi ammar, 

    In launchpad also same behaviour, this statement is not resetting. Manually hard reset only we are doing to switch into the persistant app.

  • Hey Mohan,

    Can you instead try calling the HCI_EXT_ResetSystemCmd() API to see if the system resets successfully?

    I will be out on vacation and will have my colleague continue to assist. I appreciate your patience.

  • Hi Ammar,

    Soft Reset Issue :

     In EVK while doing experiment for off-chip After OAD completes the download, Soft reset is not happening We are doing Hard reset by using EVK button. like this We don't have any reset buttom in our custom hardware and So we are depending on soft rest API only. we tried the following 3 API's but it is not working as expected,

    1) #define SystemReset() SysCtrlSystemReset();
    2) #define SystemResetSoft() Onboard_soft_reset();
    3) HCI_EXT_ResetSystemCmd();

  • Hi Mohan,

    To clarify, when using the HCI_EXT_ResetSystemCmd(), you are not seeing the device reset? Does the application continue executing after this?

    Best Regards,

    Jan

  • Hi Jan,

    After calling the reset API system went into the undefined state like got hanged. Once If we given Hard reset It is booting properly.

  • Hey Mohan,

    You might be experiencing what we define as Halt-in-Boot. Can you try with the debugger disconnected to see if the device resets?

    For more insight on this, please see the following related thread(s): https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/929932/cc1352r-system-reset-doesn-t-restart-the-device