cancel
Showing results for 
Search instead for 
Did you mean: 

unable to wakeup bluenrg by virtual timer

aahme.4
Associate II

hello,

i am using bluenrg 1,and i write code for remote control application.

Issues- I called a function to sleep bluenrg1 in main.c , and i used gpio12 and virtual timer to wake-up the device.But device is not wake-up when i put gpio12 at low unless resetting the device.Also virtual timer unable to wake-up the device at definite timeout .

so help me out how to do whenever gpio12 at low and without resetting the device. System should wake-up as well as by virtual timer to wake up the system whenever the 2 sec. timeout occurs.

Here i am sharing how i configure the sleep mode.

In main.c

/* Enable the Sleep - SLEEPMODE_WAKETIMER */

void sleep_timer(void)

{

 uint8_t ret;

 wakeup_source = WAKEUP_IO12;

 wakeup_level = (WAKEUP_IOx_LOW << WAKEUP_IO12_SHIFT_MASK);

 printf("\r\nEnter to Sleep - SLEEPMODE_WAKETIMER\r\n");

 ret = HAL_VTimerStart_ms(0,2000);

 if (ret != BLE_STATUS_SUCCESS) {

  printf("HAL_VTimerStart_ms() error 0x%02x\r\n", ret);

  while(1);

 }

 BTLE_StackTick();

 ret = BlueNRG_Sleep(SLEEPMODE_WAKETIMER, wakeup_source, wakeup_level);

 if (ret != BLE_STATUS_SUCCESS) {

  printf("BlueNRG_Sleep() error 0x%02x\r\n", ret);

  while(1);

 }

 /* Stop VTimer */

 HAL_VTimer_Stop(0);

}

 /* Infinite loop */ 

 while(1)

 {

  /* BlueNRG-1 stack tick */

  BTLE_StackTick();

  /* Application Tick */

  APP_Tick();

  /* Enable Power Save according the Advertising Interval */

    sleep_timer();

 }

And in BlueNrg1_it.c

void GPIO_Handler(void)

{

if((GPIO_GetITPendingBit(GPIO_Pin_12) == SET) || ((wakeupFromSleepFlag) && (BlueNRG_WakeupSource() == WAKEUP_IO12)))

{

GPIO_ClearITPendingBit(GPIO_Pin_12);

}

}

0 REPLIES 0