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.

CC2652R: Questions About Simple Peripheral Example

Part Number: CC2652R
Other Parts Discussed in Thread: SYSCONFIG

I am using CCS Version 10.1.0, XDCTools version 3.61.01.25, Simplelink SDK Version 4.20.00.35, and am compiling my project with TI v20.2.1.LTS.  My OS is 64-bit Windows 10.  My target device is CC2652R1F.  I am programming it via the JTAG interface on the Launchpad.

I am in the process of developing a Bluetooth application and I have a couple questions about the Simple Peripheral Example provided by the SDK.

I see the file osal_icall_ble.c located in the Startup folder of the project. According to the documentation located here (https://www.ti.com/lit/ug/swru271i/swru271i.pdf -- pages 15-16 and https://processors.wiki.ti.com/images/a/a9/06_-_OSAL_and_HAL.pdf), it seems like the OSAL is some legacy version of TI-RTOS.  Is this true? I thought the OSAL, or Operating System Abstraction Layer, was supposed to sit on top of TI-RTOS (or any other RTOS for that matter) and provide abstraction from the OS.

Further, I noticed that the function osal_InitTasks (defined in osal_icall_ble.c) is never actually called by any other function. This is particularly surprising as osal_InitTasks includes a call to ICall_enrollService, which according to the documentation located here (http://software-dl.ti.com/simplelink/esd/simplelink_cc13x0_sdk/2.20.00.38/exports/docs/blestack/software-developers-guide/ble-stack-2.x/index.html#icall-initialization-and-registration), is necessary to enroll the BLE stack service with ICall. If ICall_enrollService is only called in osal_InitTasks, but osal_InitTasks is never actually called, how does ICall function properly? Has ICall_enrollService been replaced by some other function or is it no longer necessary?

What is the advantage of using VIMs to enable the cache? Does this improve execution efficiency/speed? See the code below.

  // Enable iCache prefetching
  VIMSConfigure(VIMS_BASE, TRUE, TRUE);
  // Enable cache
  VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);

I also noticed that in the Board_init function called in main, the external flash on the Launchpad is shutdown. Is this simply for power savings?

What does the following code do? Does it set the tick period of the Bluetooth stack and the maximum timeout period for message processing via ICall?  The ICall.h file does not comment on the icall_userCfg_t data structure.

  • Hi Andrew, 

    Assigning an expert to comment. 

    Thanks, 
    Elin 

  • Hi Elin,

    Thank you for assigning an expert to answer my questions. I would appreciate a response asap.

    In the meantime, I was able to answer some of my own questions.

    It turns out that the code shown below repurposes cache memory as RAM, as documented here: http://software-dl.ti.com/simplelink/esd/simplelink_cc13x2_26x2_sdk/3.30.00.03/exports/docs/proprietary-rf/proprietary-rf-users-guide/proprietary-rf-guide/cache-as-ram.html.

    /* Header files required to enable instruction fetch cache */
    #include <inc/hw_memmap.h>
    #include <driverlib/vims.h>
    
      // Enable iCache prefetching
      VIMSConfigure(VIMS_BASE, TRUE, TRUE);
      // Enable cache
      VIMSModeSet(VIMS_BASE, VIMS_MODE_ENABLED);

    I have removed this code and will only add it to my BLE application if necessary i.e. if I run out of RAM.

    The Board_init function does indeed shut down the external flash on the Launchpad to save power consumption. I will not do this in my BLE application.

    However, I still have a couple other questions related to those I mentioned in my original post.

    I am still confused about how the BLE service becomes registered with ICall, as osal_InitTasks(), which contains the call to ICall_enrollService(), is never called by the application code. Is ICall_enrollService no longer necessary / is there some function call I am not seeing / am I missing something?

    I made some progress in understanding what the code below actually does.

    #ifndef USE_DEFAULT_USER_CFG
    #include "ble_user_config.h"
    // BLE user defined configuration
    icall_userCfg_t user0Cfg = BLE_USER_CFG;
    #endif // USE_DEFAULT_USER_CFG
    
      /* Update User Configuration of the stack */
      user0Cfg.appServiceInfo->timerTickPeriod = Clock_tickPeriod;
      user0Cfg.appServiceInfo->timerMaxMillisecond  = ICall_getMaxMSecs();

    It it interacts with the files icall_user_config.c/.h and ble_user_config.c/.h. In particular, it fulfills the requirement shown below (code located in icall_user_config.c):

    // this table needs to be field by the application , so it cannot be store in flash.
    applicationService_t bleAppServiceInfoTable =
    {
      .timerTickPeriod     = 0,               // timerTick_period, This need to be filled at runtime, or the stack will assert an error.
      .timerMaxMillisecond = 0,               // timerMaxMillisecond. This need to be filled at runtime, or the stack will assert an error.
      .assertCback         = ASSERT_CBACK,
      .icallServiceTbl     = icallServiceTable,
    };

    More generally, it seems like icall_user_config.c/.h and ble_user_config.c/.h are top-level icall files that allow the application to make modifications to the BLE controller/host configuration and the RF front end. However, the more I have been digging into the icall code, the more I am getting confused.  Could someone explain the general structure of icall and files included in the BLE5Stack icall folder? It seems like some of the files included in the BLE5Stack icall folder are general icall files, while others are meant to be used specifically for the interface between icall and the BLE stack.

    ******************

    Edit: One other thing. I noticed that ble_user_config.c has #include "ti_radio_config.h" in it. In the simple peripheral sample project, ti_radio_config.h/.c is generated by Sysconfig. Is it recommended to generate ti_radio_config.h/.c via the Sysconfig tool?

    ******************

    I also noticed that the BLE5Stack comes with two libraries (OneLib.a and StackWrapper.a, located in ble5stack > libraries > cc26x2r1). What is the distinction between these two libraries?  Are both necessary for BLE functionality?

    Thank you in advance for answering my questions.

  •  When will an expert be able to answer my questions?  Is there another forum I should be posting these questions in instead?

  • Hi,

    Andrew Larson said:
    Is ICall_enrollService no longer necessary / is there some function call I am not seeing / am I missing something?

    Don't forget that a significant part of the code is not public (i.e. provided as compiled libraries). As a result, the code might be called by an "hidden" function. If you want to verify if the code you are referring to is or is not linked (and used), look at the map file of your application.

    Andrew Larson said:
    Could someone explain the general structure of icall and files included in the BLE5Stack icall folder?

    This is not possible in a public forum as a significant part of the code is not public.

    Andrew Larson said:
    Is it recommended to generate ti_radio_config.h/.c via the Sysconfig tool?

    Yes, it is recommended to use SysConfig here.

    Andrew Larson said:
    I also noticed that the BLE5Stack comes with two libraries (OneLib.a and StackWrapper.a, located in ble5stack > libraries > cc26x2r1). What is the distinction between these two libraries?  Are both necessary for BLE functionality?

    Both libraries are required. I can't comment more on the role of each one.

    I hope this will help,

    Regards,

  • Thank you for answering my questions Clement.

    I understand you cannot explain the entire structure of iCall, as much of the code is not public.  Could you at least give an overview of the files included in the SDK, which are public, so I could better understand which I need for the Bluetooth application I am developing?  There is very little documentation about these files anywhere...and it is painstaking for me to go through each one and try to understand its functionality.