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: BLE Pairing and Secure Connection Issues

Part Number: CC2640R2F
Other Parts Discussed in Thread: CC2650

Hello,

I am developing a product that has a CC2640R2F. This product is a slave module to another device that has a Nordic Bluetooth chip for its wireless communication. I am struggling to get the CC2640R2F to make a secure connection with the master device. The two will pair, but after taking a few sniffer examples, it was determined they try to secure connect and always end up failing the secure and failing back on the legacy connection. There are other peripheral devices in our ecosystem that are also Nordic based and able to connect to the central device LESC with no issue, which leads me to believe there is something on the TI side that is not configured or working as intended. Below is a copy of my initialization of the BLE connection on the TI application. 

Any advice and help is greatly appreciated. 

I am using cc2640r2_sdk_1_30_00_25. The application is based off of the simple peripheral example. 

 // Setup the GAP Bond Manager for "just works" with LESC
  {
    uint32_t passkey = 0; // passkey "000000"
    uint8_t pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ;
    uint8_t mitm = FALSE;
    uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
    uint8_t bonding = TRUE;
    uint8_t gapbondSecure = GAPBOND_SECURE_CONNECTION_ONLY;

    GAPBondMgr_SetParameter(GAPBOND_DEFAULT_PASSCODE, sizeof(uint32_t), &passkey);
    GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode);
    GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm);
    GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap);
    GAPBondMgr_SetParameter(GAPBOND_SECURE_CONNECTION, sizeof(uint8_t), &gapbondSecure);
    GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding);     
  }

  • Hi,
    Could you share the sniffer captures you refer to?
  • Unfortunately, I do not have any saved sniffer files accessible. I will try to capture some again and share them. Are there any ideas that you can provide, until then? 

  • Hi KM,

    Would you be able to try the latest SDK and see if there is any difference in behavior with regards to just the pairing part? Without a sniffer trace it's hard to say what the problem is, but there have been fixes of various types since the 1.30 release.

    Best regards,
    Aslak
  • Hi Aslak,

    I can try updating the stack to the latest version. Do you know the easiest way to accomplish this task if using the simple_peripheral example for the base of my application? I assume I can just update the stack without having to touch my application code, but I am not sure where all of the hooks are in to the project, since that was all set up with the example. 

    Thanks.

  • Hi KM,

    I was thinking you could just test with Simple Peripheral without your own code, but with the same pairing settings.

    If you wish to upgrade your own project, the easiest in my mind is to start fresh with simple_peripheral from the newest stack and apply your own changes. But we also have migration guides: dev.ti.com/.../

    Best regards,
    Aslak
  • Hi Aslak,

    I tried your advice. I upgraded my IAR version to 8.20.2 and tried to run the simple_peripheral_oad_onchip project with simplelink_cc2640r2_sdk_2_40_00_32. With no changes to the project, I get the following error messages. Any ideas on why it struggles with the post_build command?

    Building configuration: cc2640r2lp_app - FlashROM
    Updating build tree...
    Performing Pre-Build Action
    board.c
    bim_util.c
    ble_user_config.c
    board_key.c
    devinfoservice.c
    ECCROMCC26XX.c
    find_stack_entry.c
    gatt_uuid.c
    hal_assert.c
    icall_api_lite.c
    gattservapp_util.c
    icall_cc2650.c
    icall_user_config.c
    icall.c
    oad_image_header_app.c
    main.c
    oad_reset_service.c
    simple_gatt_profile.c
    peripheral.c
    TRNGCC26XX.c
    simple_peripheral_oad_onchip.c
    util.c
    Linking
    sp_oad_onchip_cc2640r2lp_app_FlashROM.out
    Converting
    Performing Post-Build Action
    Error while running cmd /C "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\..\..\..\..\..\..\..\tools\blestack\oad\
    oad_image_tool.exe iar C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app 1 -hex1 C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_app_FlashROM.hex -bdf C:\
    ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\config\iar_boundary.xcl -hex2 C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\stack\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex -k "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\..\..\..\..\..\..\..\
    tools\blestack\oad\private.pem" -o C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_app_FlashROM_oad"

    Total number of errors: 1
    Total number of warnings: 0

  • Hi,

    You probably need to supply the "All" messages from the build log to see what the error is. Right click in the build output window and choose "All" either directly or through a submenu. You don't happen to have a 32-bit version of windows?

    Best regards,
    Aslak
  • Hi Aslak,

    Thank you for the quick response. I am running on a 64-bit OS machine with Windows 10. 

    I turned on all of the messages and tried to Make the application code again. I get the following messages. I do not see anything obvious in the messages. I checked the paths and they seem to be correct and the .exe files are present in the folders where they expect them. 

     
    Link time:   0.92 (CPU)   1.14 (elapsed)
     
    sp_oad_onchip_cc2640r2lp_app_FlashROM.out
    Converting
    ielftool.exe --ihex --verbose C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_app_FlashROM.out C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_app_FlashROM.hex
       IAR ELF Tool V10.2.3.197 [BUILT at IAR]
       Copyright 2007-2017 IAR Systems AB.
    Loading C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_app_FlashROM.out
    Saving ihex file to C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_app_FlashROM.hex
     
    Performing Post-Build Action
    cmd /C "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\..\..\..\..\..\..\..\tools\blestack\oad\oad_image_tool.exe iar 
    C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app 1 -hex1 C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\
    CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_app_FlashROM.hex -bdf C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\
    rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\config\iar_boundary.xcl -hex2 C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\
    blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\stack\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex -k "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\
    CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\..\..\..\..\..\..\..\tools\blestack\oad\private.pem" -o C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\
    CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_app_FlashROM_oad"
    Error while running cmd /C "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\..\..\..\..\..\..\..\tools\blestack\oad\
    oad_image_tool.exe iar C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app 1 -hex1 C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_app_FlashROM.hex -bdf C:\
    ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\config\iar_boundary.xcl -hex2 C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\stack\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex -k "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\..\..\..\..\..\..\..\..\
    tools\blestack\oad\private.pem" -o C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\app\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_app_FlashROM_oad"
     
    Total number of errors: 1
    Total number of warnings: 0

  • Update - I get the same result when I try to Make my stack now, as well. Any hints as to what could cause this?

    Link time: 0.38 (CPU) 0.58 (elapsed)

    sp_oad_onchip_cc2640r2lp_stack_FlashROM.out
    Converting
    ielftool.exe --ihex --verbose C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.out C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex
    IAR ELF Tool V10.2.3.197 [BUILT at IAR]
    Copyright 2007-2017 IAR Systems AB.
    Loading C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.out
    Saving ihex file to C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex

    Performing Post-Build Action
    cmd /C "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\..\..\..\..\..\..\..\tools\blestack\frontier\frontier.exe iar C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\List\sp_oad_onchip_cc2640r2lp_stack_FlashROM.map C:\
    ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\config\iar_boundary.bdef C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\config\iar_boundary.xcl & C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\
    examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\..\..\..\..\..\..\..\tools\blestack\oad\oad_image_tool.exe --verbose iar C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack 2 -hex1 C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\
    CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex -bdf C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\
    rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\config\iar_boundary.xcl -k "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\
    simple_peripheral_oad_onchip\tirtos\iar\stack\..\..\..\..\..\..\..\..\tools\blestack\oad\private.pem" -o C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\
    simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_stack_FlashROM_oad"
    Error while running cmd /C "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\..\..\..\..\..\..\..\tools\blestack\frontier\
    frontier.exe iar C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\List\
    sp_oad_onchip_cc2640r2lp_stack_FlashROM.map C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\config\
    iar_boundary.bdef C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\config\iar_boundary.xcl & C:\ti\
    simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\..\..\..\..\..\..\..\tools\blestack\oad\oad_image_tool.exe --verbose iar C:\
    ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack 2 -hex1 C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\
    CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_stack_FlashROM.hex -bdf C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\
    rtos\CC2640R2_LAUNCHXL\blestack\simple_peripheral_oad_onchip\tirtos\iar\stack\..\config\iar_boundary.xcl -k "C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\
    simple_peripheral_oad_onchip\tirtos\iar\stack\..\..\..\..\..\..\..\..\tools\blestack\oad\private.pem" -o C:\ti\simplelink_cc2640r2_sdk_2_40_00_32\examples\rtos\CC2640R2_LAUNCHXL\blestack\
    simple_peripheral_oad_onchip\tirtos\iar\stack\FlashROM\Exe\sp_oad_onchip_cc2640r2lp_stack_FlashROM_oad"

    Total number of errors: 1
    Total number of warnings: 0
  • So I ended up completely deleting the SDK from my computer and redownloading and installing. This seemed to fix whatever was broken from the previous messages. I am now able to download the application to my device. The code runs off in the weeds for some reason, but at least I am at a point where I can start debugging it. Hopefully I can get the example code up and running and eventually import the rest of my original project.

    Update - the project continually ends up in the HAL_ASSERT_CAUSE_ICALL_TIMEOUT forever loop. What reason would this project be getting stuck there? I would normally say a memory size issue would be the reason. I haven't touched any of these settings from the original project. 

  • Hi KM,

    FYI, updating a post doesn't seem to generate an alert on our side so please make a new reply in case you are looking for input.

    This assert is activated when the stack task doesn't respond to an API call within the timeout, which seems to be 5s by default. I can't really say that I've experienced this myself. How far does it get? Are any API calls successful? It's not impossible that it is caused by some malloc failure due to insufficient heap.

    Some more information would be helpful here, like what stack version, which project, which changes are done, what is the application doing when this happens? We've been going back and forth a bit in this thread.

    Best regards,
    Aslak
  • Hello Aslak,

    I apologize for the delay. I tried to respond a few days ago, but the E2E site was down. 

    Since these last postings, I have changed directions slightly. I was able to get the simplelink_cc2640r2_sdk_2_40_00_32 project simpleperipheral_oad_onchip example project to build in IAR (v8.20.2). From there, I took a few days to move all of our project specific code and changes over to the example project. I worked through quite a few compiler errors due to name changes and missing defines and such. Now I have reached a point where my errors are based upon lack of memory, see below. My original project was based on simplelink_cc2640r2_sdk_1_35_00_33 and whatever stack version was out during that project. Has the stack drastically grown in size since then? Are there project options/configurations that I might have improperly configured causing these errors? Any other suggestions? 

    Thanks for any help you can offer.

    Error[Lp011]: section placement failed 
                unable to allocate space for sections/blocks with a total estimated minimum size of 0xbd9d bytes (max align 0x4) in  
    <[0x00001330-0x0000afff]> (total uncommitted space 0x9cd0). 
    Error[Lp017]: the address of "primaryServiceUUID" was needed when computing compressed initializers for section .data  
    (devinfoservice.o #19), but that address hasn't been set yet, since the size of the compressed initializers are needed in order to  
    set it 
    Tool Internal Error: 
    Internal Error: [CoreUtil/General]: Access violation (0xc0000005) at 00460AD2 (reading from address 0x14) 
    Internal Error: [CoreUtil/General]: Access violation (0xc0000005) at 00460AD2 (reading from address 0x14) 
    Error while running Linker 
    

  • Hi KM,

    Apologies for holiday delays here.

    Yes, as far as I can see the various bugfixes and updates have added up to quite a bit over the last 2 years since the 1.35 release. simple_peripheral seems to use around 7k more (with CCS) between 3.10 and 1.35.

    Unfortunately some of those fixes could well be a fix you would need in your case. Were you able to test a newer SDK, on a TI LaunchPad or your own device, whether eg. example simple_peripheral with modifications to the pairing to match your setup showed the same problems that you reported originally?

    It could make sense to verify this first, if you are running out of space. I assume you have configured the project optimization level to be the highest for size?

    I don't know what your issue is, but reproducing the issue with a pairing config modification to the vanilla 1.35 simple_peripheral example, and then trying the latest version with similar modification to see if the issue persists or is fixed would be helpful. You might then also try older SDK versions to see whether one of them resolves your issue (at a lower flash usage cost).

    Best regards,
    Aslak
  • Hello Aslak,

    I apologize for the delay. I actually got to the point last week that the code set I have been working with (2_40 with my additional changes); I have now been working on clearing additional issues that have presented themselves now that I can compile the code. 

    My code is getting stuck at the findStackBoundaryAddr point in main. I never make it past the stackAddr = findSTackBoundaryAddr. In this function, it searches for the stack address until flashPageNum = MAX_ONCHIP_FLASH_PAGES. At this point, the code runs in to the weeds. When it is circling through this function, the imgType never changes from 0x01 (OAD App). I experience the same issue when I try to run the original 2_40 simple_peripheral_oad example that does not include any of my changes.

    Any hints of things I can try? Thanks.

    int main()
    {
      /* Register Application callback to trap asserts raised in the Stack */
      RegisterAssertCback(AssertHandler);
    
      PIN_init(BoardGpioInitTable);
    
    #ifdef CACHE_AS_RAM
      // retain cache during standby
      Power_setConstraint(PowerCC26XX_SB_VIMS_CACHE_RETAIN);
      Power_setConstraint(PowerCC26XX_NEED_FLASH_IN_IDLE);
    #else
      // Enable iCache prefetching
      VIMSConfigure(VIMS_BASE, TRUE, TRUE);
      // Enable cache
      VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);
    #endif //CACHE_AS_RAM
    
    #ifndef POWER_SAVING// !defined( POWER_SAVING )
      /* Set constraints for Standby, powerdown and idle mode */
      // PowerCC26XX_SB_DISALLOW may be redundant
      Power_setConstraint(PowerCC26XX_SB_DISALLOW);
      Power_setConstraint(PowerCC26XX_IDLE_PD_DISALLOW);
    #endif // POWER_SAVING
    
    #ifdef ICALL_JT
      /* Update User Configuration of the stack */
      user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
      user0Cfg.appServiceInfo->timerMaxMillisecond  = ICall_getMaxMSecs();
    #endif  /* ICALL_JT */
      /* Initialize ICall module */
      ICall_init();
    
      {
        /* Find stack entry page */
       uint32_t stackAddr = findStackBoundaryAddr();
    
        if(stackAddr == 0xFFFFFFFF)
        {
          // If we cannot find the stack start address, exit
          ICall_abort();
        }
    

    uint32_t findStackBoundaryAddr()
    {
        imgHdr_t *imgHdr;
        bool search = true;
        bool searchFromUsrApp = true;
    
        /*
         * To be efficient, start search at flash page starting at flash page before
         * the start of persistent image for on-chip OAD and for offchip from the
         * start of the flash.
         */
        uint8_t *addr = ((uint8_t *)&(_imageHdr.fixedHdr.imgID) + IMG_START_ADDR_OFFSET);
        int32_t flashPageNum = *((uint32_t *)(addr));
    
    
        if(_imageHdr.imgPayload.startAddr > 0)
        {
           flashPageNum =(FLASH_PAGE(_imageHdr.imgPayload.startAddr) - 1);
        }
    
        if(_imageHdr.fixedHdr.imgType == OAD_IMG_TYPE_PERSISTENT_APP)
        {
            searchFromUsrApp = false;
        }
    
        /* Search all flash pages for the stack header */
        do
        {
            /* Read image header */
            imgHdr = (imgHdr_t *)FLASH_ADDRESS(flashPageNum, 0);
    
            /* Check imageID bytes */
            if (imgIDCheck(&imgHdr->fixedHdr) == true)
            {
                /* Check that we found a stack */
                if((imgHdr->fixedHdr.imgType == OAD_IMG_TYPE_STACK) /* matching image type */
                   &&
                   (imgHdr->fixedHdr.crcStat != CRC_INVALID)) /* Valid CRC */
                {
                    return (flashPageNum * INTFLASH_PAGE_SIZE);
                }
            }
            if(!searchFromUsrApp)
            {
                search = (flashPageNum-- >= (0));
            }
            else
            {
                search = (flashPageNum++ < MAX_ONCHIP_FLASH_PAGES);
            }
    
        }while(search);
    
        return (0xFFFFFFFF);
    }

  • Hi,

    Is this in the persistent app, or the _oad_onchip_app? I assume you remembered to flash the stack image to the device so it could be found at all? :)

    1) Compile persistent app to generate boundary files
    2) Compile BIM
    3) Compile app and stack
    4) Flash in app's bin file
    5) Flash in stack's bin file
    6) Flash persistent app + bim

    At least I got it running out of the box with 2.40.

    Best regards,
    Aslak
  • Hi Aslak,

    I did remember to flash the stack image :) 

    I must've missed compiling the persistent app with this new program. Once I compiled that, I can now make it past the finding the stack address step. Thank you for the response.

    Do you have any suggestions on how to increase the uncommitted space available for application code? Is there anything I can do with the stack to reduce its size? I am missing a number of needed functions for my project mainly because they do not fit in the space allotted. 

    Thanks for any help you can offer.

  • Hi Aslak,
    On another note - I also have the original, out of box, 2.40 project available. When I try to compile the stack I get a post command execution error. I assume you are running on CCS; would there be a difference in the project if I am using IAR? This project has no changes from what I downloaded from TI.
  • Hi,

    1) There isn't really a lot you can do. It's perhaps doable to remove 'secure connections' pairing and/or pairing entirely. Really the move here would be to use off-chip OAD, no OAD or maybe the CC2642 which has much more space available.

    The RTOS configuration should already be pretty minimal. You can and should go though the board file and remove things you are not using. Also make sure you configure the Power section such that you disable calibration of the RCOSC, this should save you ~1.5kb. Also check how many sectors(pages) the persistent app is using. If it's slightly above a number (like 10.2 pages) then even the remaining 0.8 would be reserved I think. You could try to reduce the size of persistent app to right below a page boundary to free up space for your own app.

    2) Possibly you get an error because the script tries to place an output file in the working directory that IAR uses which is probably in Program Files somewhere. You could try running IAR as administrator. Please see e2e.ti.com/.../2888511

    Best regards,
    Aslak
  • Thank you for the feedback, Aslak. I will give your suggestions a try and see what I can do.