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

How can I shorten the length of the passkey?

Hello

I'm using sdk v17 and trying to shorten PASSKEY.

Currently, my PASSKEY is 6 letters long. I want to shorten it to 4 letters, is this possible?

Or how do I get rid of the password I enter the first time connect to the BLE? The password for this is '0000' or '1234', but I failed both. (I removed the codes about the 'static passkey' and ran them.)
There must be a setup part for this password, but I can't found.

Can you help me with this problem?
Thank you.

Parents
  • Hi

    According to the Bluetooth specification (Bluetooth core specification v.5, vol. 3, part H, section 2.3) the passkey must be 6 digits (0-9), so you can't shorten or elongate this.

    What example project in the SDK are you testing when you're seeing this four digit password you mention?

    Best regards,

    Simon

  • Hello, Simonr.

    I am testing the example of BLE_GLUCOSE.  
    I will need to enter PIN number if I want to connect in the app. But I don't know what to type in here. (I tried to enter '0000' and '1234' but failed.)

    The following code is the log output from the app and terminal.

    nRF Connect, 2020-11-05
    Nordic_Glucose (FE:D8:4A:E1:BC:19)
    V	11:28:40.636	Connecting to FE:D8:4A:E1:BC:19...
    D	11:28:40.636	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	11:28:40.860	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	11:28:40.872	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	11:28:40.872	Connected to FE:D8:4A:E1:BC:19
    V	11:28:40.885	Discovering services...
    D	11:28:40.885	gatt.discoverServices()
    D	11:28:41.127	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    I	11:28:41.161	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	11:28:41.253	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3)
    D	11:28:41.402	[Callback] Services discovered with status: 0
    I	11:28:41.402	Services discovered
    V	11:28:41.421	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Glucose (0x1808)
    - Glucose Measurement [N] (0x2A18)
       Client Characteristic Configuration (0x2902)
    - Glucose Feature [R] (0x2A51)
    - Record Access Control Point [I W] (0x2A52)
       Client Characteristic Configuration (0x2902)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    - Serial Number String [R] (0x2A25)
    - System ID [R] (0x2A23)
    D	11:28:41.421	gatt.setCharacteristicNotification(00002a18-0000-1000-8000-00805f9b34fb, true)
    D	11:28:41.423	gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
    D	11:28:41.424	gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    I	11:28:41.479	Connection parameters updated (interval: 43.75ms, latency: 0, timeout: 5000ms)
    D	11:28:43.508	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_PIN (0)
    I	11:28:46.511	Connection parameters updated (interval: 96.25ms, latency: 0, timeout: 4000ms)
    D	11:29:13.414	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
    I	11:29:13.414	Bonding failed
    D	11:29:13.831	[Callback] Connection state changed with status: 19 and new state: DISCONNECTED (0)
    W	11:29:13.831	Connection terminated by peer (status 19)
    I	11:29:13.831	Disconnected
    D	11:29:13.872	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	11:29:14.057	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	11:29:14.057	gatt.close()
    D	11:29:14.073	wait(200)
    V	11:29:14.274	Connecting to FE:D8:4A:E1:BC:19...
    D	11:29:14.274	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	11:29:14.284	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	11:29:14.284	Connected to FE:D8:4A:E1:BC:19
    V	11:29:14.295	Discovering services...
    D	11:29:14.295	gatt.discoverServices()
    D	11:29:14.334	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    I	11:29:14.379	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	11:29:14.393	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3)
    D	11:29:14.627	[Callback] Services discovered with status: 0
    I	11:29:14.627	Services discovered
    V	11:29:14.636	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Glucose (0x1808)
    - Glucose Measurement [N] (0x2A18)
       Client Characteristic Configuration (0x2902)
    - Glucose Feature [R] (0x2A51)
    - Record Access Control Point [I W] (0x2A52)
       Client Characteristic Configuration (0x2902)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    - Serial Number String [R] (0x2A25)
    - System ID [R] (0x2A23)
    D	11:29:14.637	gatt.setCharacteristicNotification(00002a18-0000-1000-8000-00805f9b34fb, true)
    D	11:29:14.639	gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
    D	11:29:14.641	gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    I	11:29:14.694	Connection parameters updated (interval: 43.75ms, latency: 0, timeout: 5000ms)
    D	11:29:18.972	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
    I	11:29:18.972	Bonding failed
    I	11:29:19.700	Connection parameters updated (interval: 96.25ms, latency: 0, timeout: 4000ms)
    D	11:29:22.306	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
    E	11:29:22.306	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
    I	11:29:22.306	Disconnected
    D	11:29:22.417	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	11:29:22.685	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	11:29:22.685	gatt.close()
    D	11:29:22.704	wait(200)
    V	11:29:22.905	Connecting to FE:D8:4A:E1:BC:19...
    D	11:29:22.905	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	11:29:22.927	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    D	11:29:22.929	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	11:29:22.929	Connected to FE:D8:4A:E1:BC:19
    D	11:29:22.951	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3)
    I	11:29:23.199	Connection parameters updated (interval: 43.75ms, latency: 0, timeout: 5000ms)
    D	11:29:23.797	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
    I	11:29:23.797	Bonding failed
    V	11:29:23.830	Discovering services...
    D	11:29:23.830	gatt.discoverServices()
    D	11:29:23.890	[Callback] Services discovered with status: 0
    I	11:29:23.890	Services discovered
    V	11:29:23.936	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Glucose (0x1808)
    - Glucose Measurement [N] (0x2A18)
       Client Characteristic Configuration (0x2902)
    - Glucose Feature [R] (0x2A51)
    - Record Access Control Point [I W] (0x2A52)
       Client Characteristic Configuration (0x2902)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    - Serial Number String [R] (0x2A25)
    - System ID [R] (0x2A23)
    D	11:29:23.936	gatt.setCharacteristicNotification(00002a18-0000-1000-8000-00805f9b34fb, true)
    D	11:29:23.939	gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
    D	11:29:23.942	gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    D	11:29:27.117	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
    E	11:29:27.117	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
    I	11:29:27.117	Disconnected
    D	11:29:27.182	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    

    <info> app_timer: RTC: initialized.
    
    <info> app: Glucose example started.
    
    <info> app: Fast advertising
    
    <info> app: Connected
    
    <info> app: BLE_GAP_EVT_LESC_DHKEY_REQUEST
    
    <info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
    
    <info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 129
    
    <warning> peer_manager_handler: Disconnecting conn_handle 0.
    
    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x81 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0
    
    <info> app: Fast advertising
    
    <info> app: Disconnected
    
    <info> app: Connected
    
    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x89 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0
    
    <info> app: Fast advertising
    
    <info> app: Disconnected
    
    <info> app: Connected
    
    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x1 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0
    
    <info> app: Fast advertising
    
    <info> app: Disconnected
    
    <info> app: Connected

    Can I see the problem in this log?


    Thank you.

Reply
  • Hello, Simonr.

    I am testing the example of BLE_GLUCOSE.  
    I will need to enter PIN number if I want to connect in the app. But I don't know what to type in here. (I tried to enter '0000' and '1234' but failed.)

    The following code is the log output from the app and terminal.

    nRF Connect, 2020-11-05
    Nordic_Glucose (FE:D8:4A:E1:BC:19)
    V	11:28:40.636	Connecting to FE:D8:4A:E1:BC:19...
    D	11:28:40.636	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	11:28:40.860	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	11:28:40.872	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	11:28:40.872	Connected to FE:D8:4A:E1:BC:19
    V	11:28:40.885	Discovering services...
    D	11:28:40.885	gatt.discoverServices()
    D	11:28:41.127	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    I	11:28:41.161	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	11:28:41.253	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3)
    D	11:28:41.402	[Callback] Services discovered with status: 0
    I	11:28:41.402	Services discovered
    V	11:28:41.421	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Glucose (0x1808)
    - Glucose Measurement [N] (0x2A18)
       Client Characteristic Configuration (0x2902)
    - Glucose Feature [R] (0x2A51)
    - Record Access Control Point [I W] (0x2A52)
       Client Characteristic Configuration (0x2902)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    - Serial Number String [R] (0x2A25)
    - System ID [R] (0x2A23)
    D	11:28:41.421	gatt.setCharacteristicNotification(00002a18-0000-1000-8000-00805f9b34fb, true)
    D	11:28:41.423	gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
    D	11:28:41.424	gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    I	11:28:41.479	Connection parameters updated (interval: 43.75ms, latency: 0, timeout: 5000ms)
    D	11:28:43.508	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_PIN (0)
    I	11:28:46.511	Connection parameters updated (interval: 96.25ms, latency: 0, timeout: 4000ms)
    D	11:29:13.414	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
    I	11:29:13.414	Bonding failed
    D	11:29:13.831	[Callback] Connection state changed with status: 19 and new state: DISCONNECTED (0)
    W	11:29:13.831	Connection terminated by peer (status 19)
    I	11:29:13.831	Disconnected
    D	11:29:13.872	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	11:29:14.057	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	11:29:14.057	gatt.close()
    D	11:29:14.073	wait(200)
    V	11:29:14.274	Connecting to FE:D8:4A:E1:BC:19...
    D	11:29:14.274	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	11:29:14.284	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	11:29:14.284	Connected to FE:D8:4A:E1:BC:19
    V	11:29:14.295	Discovering services...
    D	11:29:14.295	gatt.discoverServices()
    D	11:29:14.334	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    I	11:29:14.379	Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
    D	11:29:14.393	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3)
    D	11:29:14.627	[Callback] Services discovered with status: 0
    I	11:29:14.627	Services discovered
    V	11:29:14.636	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Glucose (0x1808)
    - Glucose Measurement [N] (0x2A18)
       Client Characteristic Configuration (0x2902)
    - Glucose Feature [R] (0x2A51)
    - Record Access Control Point [I W] (0x2A52)
       Client Characteristic Configuration (0x2902)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    - Serial Number String [R] (0x2A25)
    - System ID [R] (0x2A23)
    D	11:29:14.637	gatt.setCharacteristicNotification(00002a18-0000-1000-8000-00805f9b34fb, true)
    D	11:29:14.639	gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
    D	11:29:14.641	gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    I	11:29:14.694	Connection parameters updated (interval: 43.75ms, latency: 0, timeout: 5000ms)
    D	11:29:18.972	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
    I	11:29:18.972	Bonding failed
    I	11:29:19.700	Connection parameters updated (interval: 96.25ms, latency: 0, timeout: 4000ms)
    D	11:29:22.306	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
    E	11:29:22.306	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
    I	11:29:22.306	Disconnected
    D	11:29:22.417	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    D	11:29:22.685	[Broadcast] Action received: android.bluetooth.device.action.ACL_CONNECTED
    D	11:29:22.685	gatt.close()
    D	11:29:22.704	wait(200)
    V	11:29:22.905	Connecting to FE:D8:4A:E1:BC:19...
    D	11:29:22.905	gatt = device.connectGatt(autoConnect = false, TRANSPORT_LE, preferred PHY = LE 1M)
    D	11:29:22.927	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
    D	11:29:22.929	[Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
    I	11:29:22.929	Connected to FE:D8:4A:E1:BC:19
    D	11:29:22.951	[Broadcast] Action received: android.bluetooth.device.action.PAIRING_REQUEST, pairing variant: PAIRING_VARIANT_CONSENT (3)
    I	11:29:23.199	Connection parameters updated (interval: 43.75ms, latency: 0, timeout: 5000ms)
    D	11:29:23.797	[Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
    I	11:29:23.797	Bonding failed
    V	11:29:23.830	Discovering services...
    D	11:29:23.830	gatt.discoverServices()
    D	11:29:23.890	[Callback] Services discovered with status: 0
    I	11:29:23.890	Services discovered
    V	11:29:23.936	Generic Access (0x1800)
    - Device Name [R W] (0x2A00)
    - Appearance [R] (0x2A01)
    - Peripheral Preferred Connection Parameters [R] (0x2A04)
    - Central Address Resolution [R] (0x2AA6)
    Generic Attribute (0x1801)
    Glucose (0x1808)
    - Glucose Measurement [N] (0x2A18)
       Client Characteristic Configuration (0x2902)
    - Glucose Feature [R] (0x2A51)
    - Record Access Control Point [I W] (0x2A52)
       Client Characteristic Configuration (0x2902)
    Battery Service (0x180F)
    - Battery Level [N R] (0x2A19)
       Client Characteristic Configuration (0x2902)
    Device Information (0x180A)
    - Manufacturer Name String [R] (0x2A29)
    - Serial Number String [R] (0x2A25)
    - System ID [R] (0x2A23)
    D	11:29:23.936	gatt.setCharacteristicNotification(00002a18-0000-1000-8000-00805f9b34fb, true)
    D	11:29:23.939	gatt.setCharacteristicNotification(00002a52-0000-1000-8000-00805f9b34fb, true)
    D	11:29:23.942	gatt.setCharacteristicNotification(00002a19-0000-1000-8000-00805f9b34fb, true)
    D	11:29:27.117	[Callback] Connection state changed with status: 22 and new state: DISCONNECTED (0)
    E	11:29:27.117	Error 22 (0x16): GATT CONN TERMINATE LOCAL HOST
    I	11:29:27.117	Disconnected
    D	11:29:27.182	[Broadcast] Action received: android.bluetooth.device.action.ACL_DISCONNECTED
    

    <info> app_timer: RTC: initialized.
    
    <info> app: Glucose example started.
    
    <info> app: Fast advertising
    
    <info> app: Connected
    
    <info> app: BLE_GAP_EVT_LESC_DHKEY_REQUEST
    
    <info> nrf_ble_lesc: Calling sd_ble_gap_lesc_dhkey_reply on conn_handle: 0
    
    <info> peer_manager_handler: Connection security failed: role: Peripheral, conn_handle: 0x0, procedure: Bonding, error: 129
    
    <warning> peer_manager_handler: Disconnecting conn_handle 0.
    
    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x81 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0
    
    <info> app: Fast advertising
    
    <info> app: Disconnected
    
    <info> app: Connected
    
    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x89 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0
    
    <info> app: Fast advertising
    
    <info> app: Disconnected
    
    <info> app: Connected
    
    <info> app: BLE_GAP_EVT_AUTH_STATUS: status=0x1 bond=0x0 lv4: 0 kdist_own:0x0 kdist_peer:0x0
    
    <info> app: Fast advertising
    
    <info> app: Disconnected
    
    <info> app: Connected

    Can I see the problem in this log?


    Thank you.

Children
No Data
Related