Directed Adverising - custom nrf52832 board

Hello!

I am working on a project that uses nrf52832 microcontroller with softdevice s132 6.1.1. for BLE capabilities. One of requirements is to implement directed advertising after bonding for the first time with a central device, in our case is iPhone and Android devices. The issue is the directed advertising with peer address doesn't seem to be working properly. Here is my advertising parameters

void startAdv() {
  // Advertising packet
  Bluefruit.Advertising.addFlags(BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE);
  Bluefruit.Advertising.addTxPower();
  Bluefruit.Advertising.setType(BLE_GAP_ADV_TYPE_CONNECTABLE_NONSCANNABLE_DIRECTED);


  // Include bleuart 128-bit uuid
  Bluefruit.Advertising.addService(bleuart);

  // Secondary Scan Response packet (optional)
  // Since there is no room for 'Name' in Advertising packet
  Bluefruit.ScanResponse.addName();
  
  /* Start Advertising
   * - Enable auto advertising if disconnected
   * - Interval:  fast mode = 20 ms, slow mode = 152.5 ms
   * - Timeout for fast mode is 30 seconds
   * - Start(timeout) with timeout = 0 will advertise forever (until connected)
   * 
   * For recommended advertising interval
   * https://developer.apple.com/library/content/qa/qa1931/_index.html   
   */
  Bluefruit.Advertising.restartOnDisconnect(false);
  Bluefruit.Advertising.setInterval(32, 244);    // in unit of 0.625 ms
  Bluefruit.Advertising.setFastTimeout(30);      // number of seconds in fast mode
  Bluefruit.Advertising.start(0);                // 0 = Don't stop advertising after n seconds  
}
bool BLEAdvertising::_start(uint16_t interval, uint16_t timeout)
{
  // ADV Params
  ble_gap_addr_t central_add = {.addr_id_peer = 1, .addr_type = 0x00, .addr = {0x31, 0xC0, 0x95, 0xE7, 0x1E, 0xC8}};
  ble_gap_adv_params_t adv_para =
  {
    .properties    = { .type = _type, .anonymous  = 0 },
    .p_peer_addr   = &central_add, // Undirected advertisement
    .interval      = interval                 , // advertising interval (in units of 0.625 ms)
    .duration      = (uint16_t) (timeout*100) , // in 10-ms unit

    .max_adv_evts  = 0                        , // TODO can be used for fast/slow mode
    .channel_mask  = { 0, 0, 0, 0, 0 }        , // 40 channel, set 1 to disable
    .filter_policy = BLE_GAP_ADV_FP_ANY       ,

    .primary_phy   = BLE_GAP_PHY_AUTO         , // 1 Mbps will be used
    .secondary_phy = BLE_GAP_PHY_AUTO         , // 1 Mbps will be used
      // , .set_id, .scan_req_notification
  };

  // gap_adv long-live is required by SD v6
  static ble_gap_adv_data_t gap_adv =
  {
      .adv_data      = { .p_data = _data, .len = _count },
      .scan_rsp_data = { .p_data = Bluefruit.ScanResponse.getData(), .len = Bluefruit.ScanResponse.count() }
  };
  VERIFY_STATUS( sd_ble_gap_adv_set_configure(&_hdl, &gap_adv, &adv_para), false );
  VERIFY_STATUS( sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, _hdl, Bluefruit.getTxPower() ), false );
  VERIFY_STATUS( sd_ble_gap_adv_start(_hdl, CONN_CFG_PERIPHERAL), false );

  Bluefruit._startConnLed(); // start blinking
  _runnning        = true;
  _active_interval = interval;

  _left_timeout -= min16(_left_timeout, timeout);

  return true;
}
The first code snippet basically sets the direct advertising parameters and passed to the second code snippet. As you can see in the second code snippet, the BLE MAC address for my test iPhone is hardcoded. When I try to look for my device on my iPhone, the device doesn't show up. I am wondering what the issue behind this could be.
Maybe I'm misunderstanding how non-scannable directed advertising works.
Any help is appreciated, thanks!
Related