This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Enable to create a wakeup button on central multilink example

I'm trying to implement a wake-up button on central multilink example. I.e, i need to implement the app_button in order to wake up from sd_evt_wat() function. The problem is when I add this characteristic on buttons_init,

uint32_t err_code;

// @note: Array must be static because a pointer to it will be saved in the Button handler
//        module.
static app_button_cfg_t buttons[] =
{
    {SEND_NOTIFICATION_BUTTON_PIN, false, NRF_GPIO_PIN_PULLUP, button_event_handler},
    {BOND_DELETE_ALL_BUTTON_PIN  , false, NRF_GPIO_PIN_PULLUP, NULL},
};

APP_BUTTON_INIT(buttons, sizeof(buttons) / sizeof(buttons[0]), BUTTON_DETECTION_DELAY, false);

err_code = app_button_enable();
APP_ERROR_CHECK(err_code);

the project simple crash until reach the main function. Can anyone hellp me? I'm using S120 1.0.1 and SDK_v6.1.0_b2ece6.

Thansk in advance and i'm sorry about my english.

Parents
  • main.c

    The debugger stop on operation 0xFFFFFFFE , that means MOVS R0,R0 .

    I know, but I already see many of this posts, but the problem is the implementation on central device. Usually the central device is a smartphone, and in my case, i want nrf51822 works as central. Thank in advance.

  • Hi Pedro

    I think there should be no difference in code for the app_button if you use it for a Central or Peripheral application. Try to move the initialization of the libraries before you initialize the softdevice with ble_stack_init(), i.e. something like

    int main(void)
    {
    			leds_init();
                APP_TIMER_INIT();
    			gpiote_init();
    			buttons_init();
    			ble_stack_init();
    			client_handling_init();
    			device_manager_init();
    
    			// Star scanning
    			scan_start();
    				
    			for (;;)
    			{
    					power_manage();
    			}
    }
    

    By the way, the main.c file you have attached is apparently from another project, as it does not reflect the code you have previously posted for your main function.

Reply
  • Hi Pedro

    I think there should be no difference in code for the app_button if you use it for a Central or Peripheral application. Try to move the initialization of the libraries before you initialize the softdevice with ble_stack_init(), i.e. something like

    int main(void)
    {
    			leds_init();
                APP_TIMER_INIT();
    			gpiote_init();
    			buttons_init();
    			ble_stack_init();
    			client_handling_init();
    			device_manager_init();
    
    			// Star scanning
    			scan_start();
    				
    			for (;;)
    			{
    					power_manage();
    			}
    }
    

    By the way, the main.c file you have attached is apparently from another project, as it does not reflect the code you have previously posted for your main function.

Children
No Data
Related