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.

Getting started with CC2650 and CCS Cloud

Other Parts Discussed in Thread: CC2650

Hi everyone and thank you in advance for helping me!

I'm new here, and I need to program a CC2650 MCU to acquire data from built-in accelerometer and temperature sensors, and from external Ultrasonic and Flame detector sensors. The Ultrasonic sensor must be programmed through an I2C interface, and the flame detector can be used both using Digital or Analog interfaces.

This is quite difficult for me right now, but I wanted to start for something simpler. I have a Debugger DevPack and a CC2650, I use CCS Cloud , and the first thing I did was to import the SensorTagApp from the TI Resource Explorer to my CCS Cloud. I built the Stack and then the App and it worked fine connecting with an iOS device with the SensorTag App (I also changed the DeviceInfoName successfully as in the example).

After reading the developer's guide (www.ti.com/.../swru393b.pdf) now I am trying to run a simple example having a main.c which initializes ICall and BIOS, and creates a task with the aim of toggle a LED of the CC2650 on pressing one of the buttons. My first try was creating a blank project in CCS Cloud, creating the main from scratch, and trying to set up the task. However, I had a lot of problems with undefined variables and functions, and a lot of includes missing, so I aborted.

In my second try, I started from the SensorTag App (I also tried with SimpleBLEPeripheral but it doesn't run in CC2650 Debugger DevPack), and I made the changes reflected in section 6.3.1 of the Developer's Guide. I had to modify them in order to adapt to the SensorTag (because they are explained to be done in SimpleBLEPeripheral). This is the code I added to the SensorTag App (everything in SensorTag.c):

// After static PIN_Config SensortagAppPinTable[] definition

static PIN_State sbpPins;
static PIN_Handle hSbpPins;

// Within the definition of local functions

#define SBP_BTN_EVT 0x0010

static void buttonHwiFxn(PIN_Handle hPin, PIN_Id pinId){
    
    events |= SBP_BTN_EVT;
    Semaphore_post(sem);
    
}


// Inside SensorTag_taskFxn()

    if(events & SBP_BTN_EVT){
        events &= ~SBP_BTN_EVT;
        int LED_value = PIN_getOutputValue(Board_LED1);
        if(LED_value){
            PIN_setOutputValue(hSbpPins, Board_LED1, LED_value--);
        } else{
            PIN_setOutputValue(hSbpPins, Board_LED1, LED_value++);
        }
    }

// Inside SensorTag_Init()

hSbpPins = PIN_open(&sbpPins, SBP_configTable);

PIN_registerIntCb(hSbpPins, buttonHwiFxn);

PIN_setConfig(hSbpPins, PIN_BM_IRQ, Board_KEY_UP | PIN_IRQ_NEGEDGE);

PIN_setConfig(hSbpPins, PINCC26XX_BM_WAKEUP, Board_KEY_UP | PINCC26XX_WAKEUP_NEGEDGE);

I was not able to include the <ti/drivers/PINCC26XX.h>, because the project was not successfully built (I got a lot of errors of the type "PIN_init has already been defined"), but I defined in SensorTag.c two constants that are defined in this file:

#define PINCC26XX_WAKEUP_NEGEDGE (2<<27) ///< Wakeup from shutdown on negative edge
#define PINCC26XX_BM_WAKEUP (3<<27) ///< Bitmask for pin wakeup from shutdown option

Finally, I was able to build it, but on running, it works exactly as the original SensorTag App. When I try to debug it, I see that it never passes through "ButtonHwiFxn", and even if I force the event through setting it in "SensorTag_taskFxn()" in this way "events |= SBP_BTN_EVT;", the LED does never toggle.

My Questions

First, I would like to know it there is an easy way to start programming from a simple example (not so hard as the SensorTag App), and it is right to use CCS Cloud for doing so (I use Mac OS Yosemite, and I think there is no support for CC2650 in CCS for Mac).

Secondly, It would be fine if someone knows what did I make wrong in my try of toggling the LED!!

Thank you very much!!

  • Hi there,

    The SensorTag is a very feature rich IoT development platform, which explains its complexity, and thus it is likely not the simplest starting point. If you are set on using OS X (as opposed to BootCamp/VM running Windows) then yes, CCS cloud is the only supported platform. Simple BLE Peripheral and project0 should have less features and should be easier to get started.

    Can you post your SBP_configTable array? My thought is that the sensortag is already using LED1,2 and Btn 1,2 and your code is conflicting with the STK code. Can you verify hSbpPins is not NULL?
  • Thanks Sean!

    Right now I am installing a Windows VM with the BLE Stack and the CCS Cloud, so I will move to CCS IDE. I have not tried Project0 yet (I will do it), but I tried executing SimpleBLE Peripheral with no success, I think it may not be compatible with my DebuggerDevPack, since I get this error on running the Stack:

    IcePick_C: Error connecting to the target: (Error -151 @ 0x0) One of the FTDI driver functions used during the connect returned bad status or an error. The cause may be one or more of: no XDS100 is plugged in, invalid XDS100 serial number, blank XDS100 EEPROM, missing FTDI drivers, faulty USB cable. Use the xds100serial command-line utility in the 'common/uscif' folder to verify the XDS100 can be located. (Emulation package 6.0.83.1)

    Regarding the SBP_configTable array, I think you are right: the SensorTag uses the LEDs, and I didn't change it. This is the PIN_Config array defined in SensorTag.c:

    static PIN_Config SensortagAppPinTable[] =
    {
        Board_LED1       | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,     /* LED initially off             */
        Board_LED2       | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,     /* LED initially off             */
        Board_KEY_LEFT   | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,        /* Button is active low          */
        Board_KEY_RIGHT  | PIN_INPUT_EN | PIN_PULLUP | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,        /* Button is active low          */
        Board_RELAY      | PIN_INPUT_EN | PIN_PULLDOWN | PIN_IRQ_BOTHEDGES | PIN_HYSTERESIS,      /* Relay is active high          */
        Board_BUZZER     | PIN_GPIO_OUTPUT_EN | PIN_GPIO_LOW | PIN_PUSHPULL | PIN_DRVSTR_MAX,     /* Buzzer initially off          */
    
        PIN_TERMINATE
    };

    In fact, I didn't rename the original PIN_Config, and I use it with its original name. This is the code I use (the only change with the above post is in line 32, replacing SBP_configTable by SensorTagAppPinTable):

    // After static PIN_Config SensortagAppPinTable[] definition
    
    static PIN_State sbpPins;
    static PIN_Handle hSbpPins;
    
    // Within the definition of local functions
    
    #define SBP_BTN_EVT 0x0010
    
    static void buttonHwiFxn(PIN_Handle hPin, PIN_Id pinId){
        
        events |= SBP_BTN_EVT;
        Semaphore_post(sem);
        
    }
    
    
    // Inside SensorTag_taskFxn()
    
        if(events & SBP_BTN_EVT){
            events &= ~SBP_BTN_EVT;
            int LED_value = PIN_getOutputValue(Board_LED1);
            if(LED_value){
                PIN_setOutputValue(hSbpPins, Board_LED1, LED_value--);
            } else{
                PIN_setOutputValue(hSbpPins, Board_LED1, LED_value++);
            }
        }
    
    // Inside SensorTag_Init()
    
    hSbpPins = PIN_open(&sbpPins, SensortagAppPinTable);
    
    PIN_registerIntCb(hSbpPins, buttonHwiFxn);
    
    PIN_setConfig(hSbpPins, PIN_BM_IRQ, Board_KEY_UP | PIN_IRQ_NEGEDGE);
    
    PIN_setConfig(hSbpPins, PINCC26XX_BM_WAKEUP, Board_KEY_UP | PINCC26XX_WAKEUP_NEGEDGE);

    Thank you!

  • Hi,

    Yes, it sounds like your code is conflicting with the SensorTag code then. I am surprised you are not seeing an RTOS exception. In any case. I recommend starting with SimpleBLEPeripheral and adding the button and LED code as per the SoftwareDeveloper's guide (SDG). SBP doesn't use any LEDs or buttons by default so there should be no conflicts.

    Regarding the debugger error you are seeing. This is because you are using devpack debugger which is an XDS110. The default configuration for SBP uses the XDS100v3. You can change this in your project settings to be the XDS110 and change the board file to be the STK board file and you should be good to go. All of the info on how to do the above is contained in the SDG.
  • Thank you very much, so I will try running the SimpleBLEPeripheral as you said, and then modifying the code as I did before with SensorTag. First of all I'll have to finish setting up my environment, so it will take some time to me. I'll post if I have any problem!

    Regards!