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.

RTOS/LAUNCHXL-CC2650: Integrating I2C Sensor with Blutooth - BLE STACK 2.2

Part Number: LAUNCHXL-CC2650
Other Parts Discussed in Thread: CC2650, CC2650STK, TMP007, SYSBIOS

Tool/software: TI-RTOS

I would like to preface this with that I am relatively new to the TI MCU platform. Essentially, I would like to collect data from an external accelerometer through I2C and send that data to a mobile phone using BLE. I have found the drivers for I2C in the resource explorer under Empty Project for the CC2650. So I have successfully set up I2C communication between the board and accelerometer. I am not confused on how to add BLE functionality. I noticed there are no BLE drivers in the include folder. I currently have BLE Stack SDK 2.2 installed. However, I am confused on where to go from here. Where do I obtain the header/drivers files for BLE. And how do I go about adding that BLE functionality to send accelerometer data?

  • Hey Bharathi,

    Here are a few links that may have already answered your questions:
    https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/496210 

    http://processors.wiki.ti.com/index.php/CC2650_LaunchPad_User%27s_Guide_for_Bluetooth_Smart 

    https://e2e.ti.com/support/wireless-connectivity/bluetooth/f/538/t/600218 

    I would personally start with the Simple Central and Peripheral examples, which you can find in the BLE_SDK_2_02_02_25 install directory.

    For reference, you may also want to review the Simplelink Academy modules for Bluetooth 4.2 under the CC2640R2. Although the Simplelink SDK is not supported on the CC2650, the information in the module is a great introduction to BLE.

  • I suggest you to refer to sensortag example which show you usage to I2C driver to read differnt sensors' data including accelerometer in BLE Stack 2.2.2
  • Great. This will definitely help. To my understanding, starting a new project zero project should already have all drivers added correct, including I2C? That was my main concern. 

    Also with BLE SDK 2.2, CC2650 is now supported right? So I should be able to follow along with the SimpleLink Academy tutorials but just use it for my specific device?

    Thanks,

    Bharathi

  • Where exactly can I find this sensortag example? I wouldn't just be able to mimic this correct, since I am using a different board with different peripherals?
  • If you install BLE Stack 2.2.2, you can find sensortag example under C:\ti\simplelink\ble_sdk_2_02_02_25\examples\cc2650stk\sensortag
  • I will take a look at this. Thank you so much.
  • The CC2650 is supported with the latest BLE SDK. You'll find some overlap in SimpleLink Academy tutorials, however, some functionality may not be supported.

    In retrospect, I agree with YiKai, the sensortag example would be a better place to incorporate BLE (if you have a fundamental understanding of BLE). The sensortag example will work for the CC2650stk out of the box, so you can use this project to configure it for your accelerometer.
  • So do you suggest using the sensortag instead of the launchpad then for this project? If that is the case, how do I send specific sensor data through BLE? Do I have to write my own service? I have a general understanding of BLE, but I am not sure how this all ties together with TI libraries.

  • Let's backtrack for a second. If all you'd like to do is interface a 2650 with your external accelerometer, then the sensortag example (although it will have all the necessary drivers in the project setup from the get-go) may be more than you're looking for.

    I apologize for the confusion. You can use the simple peripheral and central examples to start, and from there, port over the I2C functionality to those projects (either central or peripheral, depending on target device config). You don't have to write your own service to use the BLE stack.

    I would use the sensortag example strictly as a reference when merging your I2C functionality, if that helps.

    The SimpleLink Academy modules will help you understand how to send data through BLE.

    Does that answer your question?
  • So you're suggesting, just start with simple peripheral example for the sensortag (or launchpad?). And then write my I2C implementation inside of that imported project. And then use the tutorials from SimpleLink to send data over? Are the I2C driver files included in these projects? I would assume so correct?
  • You'll have to first determine whether or not you want your device to behave as a peripheral or a central device (See the SimpleLink tutorial for explanation on the different GAP roles). To send data to your phone, for example, then you'll likely want the device to behave as a peripheral (your phone will be the central).

    The i2C drivers are not in the simple peripheral example. Just copy over the i2C support code from the 'CC2650_LAUNCHXL.c' file and call the Board_initI2C(); function to initialize (like you've already done in the empty project).

    In short, you can send data over to the central device using the advertData variable. The first few bytes of that variable are "reserved" (I use this term loosely), so be sure to fully understand the way data is transferred before altering advertData.

  • I am still really struggling to get started here. I am able to collect I2C data using another imported project (TI RTOS CC2650STK SensorTag tmp007 i2c project). I've looked over the SensorTag and SimplePeripheral examples, but I am still confused on how to merge over I2C with these projects. Again, my objective is really simple. I would like to collect I2C data and send that to a mobile device using BLE.

    I found that this SimpleLink Academy tutorial does exactly what I need (with the CC2640R2). Is there something similar with the CC2650? 

    http://dev.ti.com/tirex/content/simplelink_academy_cc2640r2sdk_2_20_03_05/modules/blestack/ble_02_thermostat/ble_02_thermostat.html 

  • There’s no similar example dedicated for CC2650 but it is basically the same while using I2C driver.
  • Great! In that case, I can just use the ProjectZero project for the CC2650 instead of using SensorTag correct? I am saying this because all the board configurations are appropriate, and I feel like it may be easier to get started.

    I do have a couple questions, if I were to go about this approach. I found that the I2C drivers were not included in the Drivers folder in the project directory. Where can I go about finding those relevant driver files? Can I just include from my other project where I got I2C working?

    What exactly is the ProjectZero.c task. I just need to send data from I2C, so would I add that implementation in that task, or would I need to write my own task? I just want to have it set up such that that is all I am doing. I don't need all the extra functionality associated with ProjectZero.

  • Yes, you can use ProjectZero and refer to SensorTag example to see how to include I2C driver into ProjectZero example. I think it’s OK to reuse the ProjectZero task to do I2C reading.
  • Fantastic. I'll give this a shot and see where this goes. Thanks for the help!
  • Let us know how it goes!

    I'm going to close this post. If you have any follow up questions, just post a reply here and the thread will reopen.

  • I think I managed to figure out how to do the integration. However, I am having a strange issue when building the Project Zero project. I am getting an error building appBLE_UartLog.cfg inside of TOOLS. Not sure what is going on here...

    This is what my console says:

    Error: Configuration failed!
    gmake.exe: *** [package/cfg/appBLE_UartLog_pem3.xdl] Error 1
    gmake.exe: *** Deleting file `package/cfg/appBLE_UartLog_pem3.xdl'
    gmake.exe: *** [package/cfg/appBLE_UartLog_pem3.xdl] Deleting file `package/cfg/appBLE_UartLog_pem3.h'
    gmake.exe: *** [package/cfg/appBLE_UartLog_pem3.xdl] Deleting file `package/cfg/appBLE_UartLog_pem3.c'
    js: "C:/ti/tirex-content/xdctools_3_31_01_33_core/packages/xdc/tools/Cmdr.xs", line 51: Error: xdc.tools.configuro: configuration failed due to earlier errors (status = 2); 'linker.cmd' deleted.
    gmake: *** [build-1577816961] Error 1
    gmake: Target 'all' not remade because of errors.


    And these are the listed errors:

    Description Resource Path Location Type
    gmake: *** [build-1577816961] Error 1 ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake: *** [C:/ti/tirex-content/simplelink/ble_cc26xx_2_01_00_44423_cloud/Projects/ble/ProjectZero/CC26xx/CCS/Config/src/sysbios/sysbios.aem3] Error 2 ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake: Target 'all' not remade because of errors. ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake.exe: *** [package/cfg/appBLE_UartLog_pem3.xdl] Deleting file `package/cfg/appBLE_UartLog_pem3.c' ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake.exe: *** [package/cfg/appBLE_UartLog_pem3.xdl] Deleting file `package/cfg/appBLE_UartLog_pem3.h' ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake.exe: *** [package/cfg/appBLE_UartLog_pem3.xdl] Error 1 ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake.exe: *** Deleting file `package/cfg/appBLE_UartLog_pem3.xdl' ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    gmake[1]: *** [mangled__BIOS_lib.obj] Error 1 ProjectZeroApp_CC2650LAUNCHXL C/C++ Problem
    symbol "xdc_runtime_System_aprintf_va__F" redeclared with incompatible symbol "xdc_runtime_System_aprintf_va__F" redeclared with incompatible appBLE_UartLog.cfg /ProjectZeroApp_CC2650LAUNCHXL/TOOLS C/C++ Problem
    symbol "xdc_runtime_System_asprintf_va__F" redeclared with incompatible symbol "xdc_runtime_System_asprintf_va__F" redeclared with incompatible appBLE_UartLog.cfg /ProjectZeroApp_CC2650LAUNCHXL/TOOLS C/C++ Problem
    symbol "xdc_runtime_System_printf_va__F" redeclared with incompatible symbol "xdc_runtime_System_printf_va__F" redeclared with incompatible appBLE_UartLog.cfg /ProjectZeroApp_CC2650LAUNCHXL/TOOLS C/C++ Problem
    symbol "xdc_runtime_System_snprintf_va__F" redeclared with incompatible symbol "xdc_runtime_System_snprintf_va__F" redeclared with incompatible appBLE_UartLog.cfg /ProjectZeroApp_CC2650LAUNCHXL/TOOLS C/C++ Problem
    symbol "xdc_runtime_System_sprintf_va__F" redeclared with incompatible symbol "xdc_runtime_System_sprintf_va__F" redeclared with incompatible appBLE_UartLog.cfg /ProjectZeroApp_CC2650LAUNCHXL/TOOLS C/C++ Problem
    xdc.cfg.SourceDir: "C:/ti/tirex-content/xdctools_3_31_01_33_core/packages/xdc/cfg/SourceDir.xs", line 209: xdc.cfg.SourceDir : Build of generated source libraries failed: exit status = 2: xdc.cfg.SourceDir: "C:/ti/tirex-content/xdctools_3_31_01_33_core/packages/xdc/cfg/SourceDir.xs", line 209: xdc.cfg.SourceDir : Build of generated source libraries failed: exit status = 2: appBLE_UartLog.cfg /ProjectZeroApp_CC2650LAUNCHXL/TOOLS C/C++ Problem
  • Bharathi,

    The Project Zero example will not run on the CC2650 without making some substantial changes. Project Zero, in your case, should only be used as a reference to incorporate I2C.

    I would still try using SimpleBLEPeripheral in BLE-STACK-2-1, which does not have the I2C drivers in the example project.

    To add the I2C driver, make sure to take your existing I2C project and copy over all necessary initializations, defines, includes, config structs, etc from your empty project to your new project. You can find this in the CC2650_LAUNCHXL.c file under the "I2C Begin" heading. Also, in CC2650_LAUNCHXL.h, you should also remember to copy over the Board_I2C define under "Generic I2C instance identifiers". Lastly, just like you've done in the empty project, be sure to call the I2C initialization and any tasks you've created to interface to your sensor.

  • I remember ProjectZero in SimpleLink Academy 1.11 need to build based on BLE Stack 2.2.1 not 2.2.2.
  • Great, I will try this next.
  • I am using the CC2650 right, that isn't supported on the 2.2.1 version, only on 2.2.2. Maybe I can stick with simple_peripheral as mentioned earlier.
  • Actually, BLE Stack 2.2.1 supports CC2650. I don’t know why you think it doesn’t.
  • Just wanted to check the location of the corresponding Board.h and CC2650_LAUNCHXL.h/c files. I see them under include->C:/ti/tirtos/_cc13xx_cc26xx_2_21_01_08/products/tidrivers_cc13xx_cc26xx_2_21_01_01/packages -> ti -> boards ->CC2650_LAUNCHXL. These are the files I will be updating right? Just want to make sure before I update anything.

  • Yes, that’s it.