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.

Howto compile version info in the ble stack with CC26xx

Other Parts Discussed in Thread: CC2640

Hy there,

as I understand, every BLE firmware with BLE Stack 2.0 on CC26xx will consist of two packages:

- application

- stack

To acquire detail version info of the device I use my SVN revision as firmware revision in the devinfo service:

const uint8 devInfoFirmwareRev[] = "FW  $Rev: 1171 $ ";

Is there any recommended way to compile the SVN rev into the BLE stack as well? And how could I read this information from the communication client then?

There is a function called "Util_buildRevision", but this only contains integers and bit coded flags.

Is there a simple way of passing a string value /char array from stack to application?

Best regards

Harald

  • Hi Harald,

    The Util_buildRevision is for the BLE stack revision. Are you trying to embed your own build rev into our App code and subsequently make this available to the peer device (i.e. Central)? If so, then it would be best to define your own characteristic in your service/profile and just expose that data as a readable attribute. Alternatively, you could add the rev to the existing device info service.

    Best wishes
  • Hy,
    thanks for your hints!
    > it would be best to define your own characteristic in your service/profile
    Yes, this is what I am trying to do. But how!
    Do I want to create the new characteristic within the stack project? Or do I try to read out a value that is defined in the stack project from within the application project? The second alternative is probably what I want to do, right?
    So how can I access a variable, that is defined in the stack project from the application project?
    Best regards
    Harald
  • Hi Harald,

    Please see the Simple Profile example in the SimpleBLEPeripheral project. This service is also described in the CC2640 BLE SW Developer's Guide (SWRU393). You can also see an example for adding a profile on the BLE wiki: processors.wiki.ti.com/.../Tutorial:_How_to_Create_a_Custom_Bluetooth_Smart_Embedded_Application_with_the_CC2650DK

    Together, these docs & examples should serve as a foundation for adding a characteristic to your application.

    Best wishes
  • Hy there,
    thanks for your quick response. But actually, adding characteristics is not the issue. The question is how to access data from the stack project from within the application project.
    I'll try to make my question more clear:
    1) Within the stack project, in the source code file ROM_Init.c I define a new constant
    uint8 devInfoStackRev[] = "Stack $Rev: 1171 $ ";
    2) Within on of my custom profiles I create a new characteristic

    // Stack Revision Value
    {
    { ATT_BT_UUID_SIZE, devInfoStackRevUUID },
    GATT_PERMIT_READ,
    0,
    (uint8 *) devInfoStackRev
    },
    So how can I make the variable devInfoStackRev (defined in stack project) accessible from within the application project that I can use it as characteristic value?
    Best regards and thanks in advance
    Harald
  • Hi Harald,

    To exchange data between the stack & app, you must use the ICall dispatcher. On the App side, it's ICallBleAPI.c and on the stack, bleDispatch.c. We don't provide any examples for doing as you describe, but the entire ICall module is provided in source form, so you can use this as a guide.

    However, it's still advisable to declare this variable in your App project since the stack & app projects should be treated as a single executable.

    Best wishes
  • Thanks again for the quick response.
    JXS said:

    > However, it's still advisable to declare this variable in your App project

    Yes, but this does not bring to where I want to go.
    I hope you understand my question: How can I find out, if the device has the correct and latest version of the stack?
    I made one last try, but give up now:
    I tried to use the Util_buildRevision function to get some information from the stack. I call this function within DevInfo_AddService and fill the devInfoFirmwareRev variable, that can be read by the devinfo service. Later, I wanted to fill the .buildVersion element within the ICall_BuildRevision structure with the svn revision using subwcrev. But something is strange:
    char devInfoFirmwareRev[] = " ";
    bStatus_t DevInfo_AddService( void )
    {
    ICall_BuildRevision stackRev;
    if (Util_buildRevision(&stackRev) == ICALL_ERRNO_SUCCESS)
    {
    snprintf(devInfoFirmwareRev, sizeof(devInfoFirmwareRev),
    "Stack Rev: %5d", stackRev.buildVersion);
    }
    else
    {
    snprintf(devInfoFirmwareRev, sizeof(devInfoFirmwareRev),
    "can't read stack rev");
    } ....
    When I debug this function everything looks good. The correct information is read and the string is filled as expected. But I can't connect to the device any more. It advertises but when I try to connect it disconnects immediately:
    --------------------------------------------------------------------
    [63] : <Rx> - 11:54:35.067
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (Event)
    -Data Length : 0x13 (19) bytes(s)
    Event : 0x0605 (1541) (GAP_EstablishLink)
    Status : 0x00 (0) (Success)
    DevAddrType : 0x00 (0) (Public)
    DevAddr : 68:C9:0B:07:35:88
    ConnHandle : 0x0000 (0)
    ConnRole : 0x50 (80) ()
    ConnInterval : 0x0000 (0)
    ConnLatency : 0xD000 (53248)
    ConnTimeout : 0x0007 (7)
    Dump(Rx):
    0000:04 FF 13 05 06 00 00 88 35 07 0B C9 68 00 00 50 ........5...h..P
    0010:00 00 00 D0 07 00 ......
    --------------------------------------------------------------------
    [64] : <Info> - 11:54:35.629
    Device Disconnected
    Handle = 0x0000
    Addr Type = 0x00 (Public)
    BDAddr = 68:C9:0B:07:35:88
    --------------------------------------------------------------------
    [65] : <Rx> - 11:54:35.629
    -Type : 0x04 (Event)
    -EventCode : 0x00FF (Event)
    -Data Length : 0x06 (6) bytes(s)
    Event : 0x0606 (1542) (GAP_TerminateLink)
    Status : 0x00 (0) (Success)
    ConnHandle : 0x0000 (0)
    Reason : 0x3E (62) (Failed To Establish)
    Dump(Rx):
    0000:04 FF 06 06 06 00 00 00 3E ........>
    --------------------------------------------------------------------
    I don't plan to continue on this issue, for I spent way too much time on it already, but any help on how to find out which stack version I am working with would be highly appreciated.
    Best regards
    Harald