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

Connecting to nRF Connect app in iPad

Hello,

 

I am using nRF52840, SDK_16.0.0, SoftDevice S140 V7.0.1 and Segger for flashing the image. I am using ‘ble_app_blinky’.

 

Till now we were using nRF Connect app in Android and its working fine. Now we want to do the same with Apple iOS. But we are facing issues. We are refereeing to Apple document “Accessory Design Guidelines.pdf” from below link

https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf

 

1) Initially with below settings it did not work. After changing to the values mentioned in “Accessory Design Guidelines” I am able to connect and able to Read / Write Characteristics.

a) Connection settings.

 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#if APPLE_iOS_COMPATIBLE
//#define APP_ADV_INTERVAL 64 /**< The advertising interval (in units of 0.625 ms; this value corresponds to 40 ms). */
#define APP_ADV_INTERVAL 1636 // 1022.5ms (1639 * 0.625 micoSec)
#define MIN_CONN_INTERVAL MSEC_TO_UNITS(990, UNIT_1_25_MS) // 990ms : (990 % 15 == 0) : "Interval Min modulo 15 ms == 0"
// 990ms : "Interval Min =15 ms"
#define MAX_CONN_INTERVAL MSEC_TO_UNITS(1020, UNIT_1_25_MS) // 1020ms : (990ms + 15ms <= 1020ms) : "Interval Min + 15 ms = Interval Max"
// 1020ms : (1020ms * (0 + 1)) = 1020ms = 2 seconds : "Interval Max * (Slave Latency + 1) = 2 seconds"
// 1020ms : (1020ms * (0 + 1) * 3 = 3060ms < 5000ms : "Interval Max * (Slave Latency + 1) * 3 < connSupervisionTimeout"
#define SLAVE_LATENCY 0 // "Slave Latency =30"
#define CONN_SUP_TIMEOUT MSEC_TO_UNITS(5000, UNIT_10_MS) // 5 sec : "2 seconds = connSupervisionTimeout = 6 seconds"
/* As per standards, “The connSupervisionTimeout shall be a multiple of 10 ms in the range of 100 ms to 32.0 s and it
shall be larger than (1 + connSlaveLatency) * connInterval * 2.” */
#else
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

 

b) Security settings.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#if BLE_SECURITY_ENABLED
#define SEC_PARAM_BOND 0 /**< Perform Pairing (non-bonding). */
#define SEC_PARAM_LESC 0 /**< LE Secure Connections not enabled. */
#define SEC_PARAM_KEYPRESS 0 /**< Keypress notifications not enabled. */
#define SEC_PARAM_OOB 0 /**< Out Of Band data not available. */
#define SEC_PARAM_MIN_KEY_SIZE 7 /**< Minimum encryption key size. */
#define SEC_PARAM_MAX_KEY_SIZE 16 /**< Maximum encryption key size. */
// Static Passkey
//#define SEC_PARAM_IO_CAPABILITIES BLE_GAP_IO_CAPS_DISPLAY_ONLY /**< Display Only. (Static Passkey) */
//#define SEC_PARAM_MITM 1 /**< Man In The Middle protection required. */
//#define STATIC_PASSKEY "654321" // 6 digit Passkey
static ble_opt_t m_static_pin_option;
//uint8_t passkey[] = STATIC_PASSKEY;
#endif // BLE_SECURITY_ENABLED
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
0>
0> printf_Blinky
0> <info> app_timer: RTC: initialized.
0> <info> app: FDSInit
0> <info> app: R1 found 10 0
0> <info> app: R2 found 8
0> <info> app: MAC UICR: 0xFFFFFF FFFFFF
0> <info> app: No HON MAC addr
0> <info> app: Serial UICR: 0xFFFF FFFFFF
0> <info> app: No HON Serial Num
0> <info> app: Model UICR:
0> <info> app: No HON Model Num
0> <info> app: Blinky example started.
0>
0> printf_Blinky
0> <info> app_timer: RTC: initialized.
0> <info> app: FDSInit
0> <info> app: R1 found 10 0
0> <info> app: R2 found 8
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

2) But later I enabled security “Just Works”. Here also I am able to connect. But whenever I am trying to read/write secure Characteristic, connection getting lost. Attached sniffer log for reference.

a) I am able to connect with nRF Connect app in Android both with “Just Works” and “Static Passkey” with just pairing without Bonding. Also able to Read / Write Characteristics.

b) How to connect with nRF Connect app in iPhone even with "Just Works" and "Static Passkey".

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
0>
0> printf_Blinky
0> <info> app_timer: RTC: initialized.
0> <info> app: FDSInit
0> <info> app: R1 found 10 0
0> <info> app: R2 found 8
0> <info> app: MAC UICR: 0xFFFFFF FFFFFF
0> <info> app: No HON MAC addr
0> <info> app: Serial UICR: 0xFFFF FFFFFF
0> <info> app: No HON Serial Num
0> <info> app: Model UICR:
0> <info> app: No HON Model Num
0> <info> app: FDSInit
0> <info> app: Blinky example started.
0> <info> app: Default 16
0> <info> app: Connected
0> <debug> nrf_ble_gatt: Peer on connection 0x0 requested an ATT MTU of 185 bytes.
0> <debug> nrf_ble_gatt: Updating ATT MTU to 23 bytes (desired: 23) on connection 0x0.
0> <info> app: Default 85
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Connect_with_iPhone_With Security.psd

3) nRF app iPhone version is 2.1.2. Build number 2.1.2. iOS version is 12.1.4.

Thanks & Regards

Vishnu Beema