Hello Team,
I am working with the SimpleBLEPeripheral Example Project;
Modified Code for a Switch and a LED .
Here is my code
//--------------------------------------------------------------- //file: simpleBLEPeripheral.c ... #include <ti\sysbios\family\arm\cc26xx/Power.h> ... //------------------------------------------------------------ PIN_State sbpPins; PIN_Handle hSbpPins; // Pin handle for interrupt configuration volatile uint8_t sbp_Counter_u8=0; uint8_t sbp_GotoShutdown_u8=0; //------------------------------------------------------------ static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1) { // Initialize application SimpleBLEPeripheral_init(); GPIOPinWrite(GPIO_PIN_2, 0);// Turn off LED hSbpPins = PIN_open(&sbpPins, BoardGpioInitTable); // Register ISRs PIN_registerIntCb(hSbpPins, switch_HwiFxn_isr); // Configure interrupt PIN_setConfig(hSbpPins, PIN_BM_IRQ, Board_KEY_INPUT | PIN_IRQ_NEGEDGE); // Enable wakeup PIN_setConfig(hSbpPins, PINCC26XX_BM_WAKEUP, Board_KEY_INPUT | PINCC26XX_WAKEUP_NEGEDGE); //MCU Wakeupsetup AONEventMcuWakeUpSet(AON_EVENT_MCU_WU2,SWITCH_AON_EVENT_IO14); for (;;) { ... if(sbp_GotoShutdown_u8 ==1) { sbp_GotoShutdown_u8=0; GPIOPinWrite(GPIO_PIN_2, 1);//Turn on LED Power_shutdown(NULL); } } } //----------------------------------------------------------------- void switch_HwiFxn_isr(PIN_Handle hPin, PIN_Id pinId)// { if(pinId == Board_KEY_INPUT) // Switch isr section { sbp_Counter_u8++; if(sbp_Counter_u8 > 5) { sbp_GotoShutdown_u8=1; sbp_Counter_u8=0; Semaphore_post(sem); } IOCIntClear(Board_KEY_INPUT);// Clear int flag } } //-------------------------------------------------------------------
Test Procedure:
- Switch working fine
- LED Working fine
- I am able to connect to BLE Monitor tool-OK
If i press switch for 6 times then its executing the "Power_shutdown()" function.LED Comes on permanently;
Now BLuetooth is not terminating,no response to switch if press again(As i am clearing the LED on Power-On , LED is not turning Off).
I am using BLE Stack Ver : ble_cc26xx_setupwin32_2_01_00_44423 (Latest One)
IDE : IAR Embedded Workbench ; Ver 7.40.3 (Latest One)
When Bluetooth is connected, if i execute "Power_shutdown(NULL)" Function then expected behaviour would be to Terminate all tasks,Stop BLE Link(Bluetooth link should get disconnected from BLE Monitor Tool)
and got to shutdown mode.
-This is not happening.
After this, As per the Switch configuration, if the device is in shutdown then,it has to wakeup on switch-Press (Monitored via LED,i.e LED Put off on Power-On)
-This is not happening
Please guide me to resolve the issue.