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!!