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

Wakeup the nrf51422 with UART pins.

Hello All,

Currently i am working on nrf51422 DK board(PCA10028). I am using SDK 12.3.0 ,from this i have referred the ble_app_uart  example for implementing the UART and it is working fine.

As per our application i want to the wakeup the BLE from system off using RX or TX pin. I referred the example for waking up the BLE using the GPIO pins and test it ,the ble will wakeup by driving the pin low. 
So for configuring the wakeup for BLE i approach with below steps.

1. Configuring the rx or tx as gpio input  and configuring the gpio as wakeup pin with sense low during the startup of ble.

2 Read the  GPIO status, if it is low than  deint the gpio using nrf_gpio_cfg_default API than  init that pin as uart tx or else go to system off mode if the status is high.

The problem is occurring that when it wakes up from the system off mode and when it try to configure the wakeup pin as uart the system reset occur.

But if i change the pins it works fine. Can anyone help me out for what approach should i use to wake up the BLE using UART ? I have code snippet as below.

/********************************************************************************************************************/

int main(void)
{

    uint32_t err_code;

    // Initialize.
   APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
  ble_stack_init();

  nrf_gpio_cfg_input(13,NRF_GPIO_PIN_PULLUP);
  nrf_gpio_cfg_sense_input(13, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);


  if(nrf_gpio_pin_read(13))
 {

   sd_power_system_off();

  }
else
{

  nrf_gpio_cfg_default(13);
  uart_init();

}
gap_params_init();
services_init();
advertising_init();
conn_params_init();

sd_ble_gap_adv_data_set((const uint8_t*)data,sizeof(data),NULL,NULL);


err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
// Enter main loop.

  for (;;)
  {
     power_manage();
  }
}

/*******************************************************************************************************************/

Any help will be greatly appreciated.

Regards,

Amit 

Related