Part Number: CC2541
Hello,
My controller CC2541 is not bonding with Motog power phone. Below is the log:
nRF Connect, 2021-11-25
No name (B0:B1:13:85:DD:88)
V 23:21:19.615 Starting pairing...
D 23:21:19.615 device.createBond()
D 23:21:19.681 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_BONDING (11)
D 23:21:19.690 [Broadcast] Action received: android.bluetooth.device.action.BOND_STATE_CHANGED, bond state changed to: BOND_NONE (10)
I 23:21:19.690 Bonding failed
D 23:21:21.583 [Callback] Connection state changed with status: 0 and new state: CONNECTED (2)
I 23:21:21.583 Connected to B0:B1:13:85:DD:88
I 23:21:21.599 Notification received from 0000fd02-0000-1000-8000-00805f9b34fb, value: (0x) 81-FF-00-42-00-02-19-5E-0E
A 23:21:21.599 "(0x) 81-FF-00-42-00-02-19-5E-0E" received
V 23:21:21.646 Discovering services...
D 23:21:21.646 gatt.discoverServices()
I 23:21:22.042 Connection parameters updated (interval: 7.5ms, latency: 0, timeout: 5000ms)
D 23:21:22.747 [Callback] Services discovered with status: 0
I 23:21:22.747 Services discovered
V 23:21:22.796 Generic Access (0x1800)
- Device Name [R] (0x2A00)
- Appearance [R] (0x2A01)
- Peripheral Privacy Flag [R] (0x2A02)
- Reconnection Address [W] (0x2A03)
- Peripheral Preferred Connection Parameters [R] (0x2A04)
Generic Attribute (0x1801)
- Service Changed [I] (0x2A05)
Client Characteristic Configuration (0x2902)
Device Information (0x180A)
- System ID [R] (0x2A23)
- Model Number String [R] (0x2A24)
- Serial Number String [R] (0x2A25)
- Firmware Revision String [R] (0x2A26)
- Hardware Revision String [R] (0x2A27)
- Software Revision String [R] (0x2A28)
- Manufacturer Name String [R] (0x2A29)
- IEEE 11073-20601 Regulatory Certification Data List [R] (0x2A2A)
- PnP ID [R] (0x2A50)
Unknown Service (0000fa00-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [R W] (0000fa01-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N WNR] (0000fa02-0000-1000-8000-00805f9b34fb)
Client Characteristic Configuration (0x2902)
Unknown Service (0000fb00-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N R] (0000fb01-0000-1000-8000-00805f9b34fb)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [R W] (0000fb02-0000-1000-8000-00805f9b34fb)
- Unknown Characteristic [N W] (0000fb03-0000-1000-8000-00805f9b34fb)
Client Characteristic Configuration (0x2902)
- Unknown Characteristic [N R] (0000fb04-0000-1000-8000-00805f9b34fb)
Client Characteristic Configuration (0x2902)
Controller is getting bonded in other phone Sometimes loses the bond there too and goes undiscoverable. A powercycle rest is required then.
My init code is here:
uint16 scanduration = 6000U;
uint16 advertOffTime = 2000U;
uint16 advertisingduration = 2000U;
uint8 enable_update_request = FALSE;//TRUE;
uint16 desired_min_interval = 20U;
uint16 desired_max_interval = 20U;
uint16 desired_slave_latency = 0U;
uint16 desired_conn_timeout = 1000U;
uint16 rssi_read_rate = 500U;
uint8 initial_advertising_enable = TRUE;
// Set the GAP Role Parameters
GAPRole_SetParameter( GAPROLE_ADVERT_ENABLED, sizeof( uint8 ), &initial_advertising_enable );
GAPRole_SetParameter( GAPROLE_ADVERT_OFF_TIME, sizeof( uint16 ), &advertOffTime );
GAPRole_SetParameter( GAPROLE_SCAN_RSP_DATA, scanResponseLength, scanRspData );
GAPRole_SetParameter( GAPROLE_ADVERT_DATA, sizeof( advertData ), advertData );
GAPRole_SetParameter( GAPROLE_PARAM_UPDATE_ENABLE, sizeof( uint8 ), &enable_update_request );
GAPRole_SetParameter( GAPROLE_MIN_CONN_INTERVAL, sizeof( uint16 ), &desired_min_interval );
GAPRole_SetParameter( GAPROLE_MAX_CONN_INTERVAL, sizeof( uint16 ), &desired_max_interval );
GAPRole_SetParameter( GAPROLE_SLAVE_LATENCY, sizeof( uint16 ), &desired_slave_latency );
GAPRole_SetParameter( GAPROLE_TIMEOUT_MULTIPLIER, sizeof( uint16 ), &desired_conn_timeout );
GAPRole_SetParameter( GAPROLE_RSSI_READ_RATE, sizeof( uint16 ), &rssi_read_rate );
GAPRole_SetParameter( TGAP_LIM_DISC_SCAN, sizeof( uint16 ), &scanduration );
GAPRole_SetParameter( TGAP_GEN_DISC_ADV_MIN, sizeof( uint16 ), &advertisingduration );
// Set the GAP Characteristics
GGS_SetParameter( GGS_DEVICE_NAME_ATT, GAP_DEVICE_NAME_LEN, attDeviceName );
//GAP_SetParamValue( TGAP_GEN_DISC_ADV_MIN, advertisingduration );
// Set up the advertising interval
static const uint16 advInt = 500U; //500before
GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MIN, advInt );
GAP_SetParamValue( TGAP_LIM_DISC_ADV_INT_MAX, advInt );
GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MIN, advInt );
GAP_SetParamValue( TGAP_GEN_DISC_ADV_INT_MAX, advInt );
// Initialise the observer
{
uint8 scanRes = 60;
GAPRole_SetParameter ( GAPOBSERVERROLE_MAX_SCAN_RES, sizeof( uint8 ), &scanRes );
}
// Setuo Scanning interval
GAP_SetParamValue( TGAP_LIM_DISC_SCAN_INT, 160 ); //Interval between the start of two consecutive scan windows (100ms)
GAP_SetParamValue( TGAP_LIM_DISC_SCAN_WIND, 128 ); //The duration in which the Link Layer scans on one channel, (80 ms)
// Setup the GAP Bond Manager
uint32 passkey = 0;
uint8 pairMode = GAPBOND_PAIRING_MODE_INITIATE;
uint8 mitm = FALSE;
uint8 ioCap = GAPBOND_IO_CAP_NO_INPUT_NO_OUTPUT;
uint8 bonding = TRUE;
//uint8 bondAction = GAPBOND_FAIL_TERMINATE_ERASE_BONDS;//GAPBOND_FAIL_TERMINATE_LINK;
GAPBondMgr_SetParameter( GAPBOND_DEFAULT_PASSCODE, sizeof ( uint32 ), &passkey );
GAPBondMgr_SetParameter( GAPBOND_PAIRING_MODE, sizeof ( uint8 ), &pairMode );
GAPBondMgr_SetParameter( GAPBOND_MITM_PROTECTION, sizeof ( uint8 ), &mitm );
GAPBondMgr_SetParameter( GAPBOND_IO_CAPABILITIES, sizeof ( uint8 ), &ioCap );
GAPBondMgr_SetParameter( GAPBOND_BONDING_ENABLED, sizeof ( uint8 ), &bonding );
//GAPBondMgr_SetParameter( GAPBOND_BOND_FAIL_ACTION, sizeof ( uint8 ), &bondAction );
//GAPBondMgr_SetParameter(GAPBOND_ERASE_ALLBONDS, 0U, NULL);
// Initialize required GATT services
GGS_AddService( GATT_ALL_SERVICES );
Do I need periodically invoke advertising when device is not connected (like below) or BLE stack will automatically take care of it?
if(gapRole_state != GAPROLE_CONNECTED && gapRole_state != GAPROLE_CONNECTED_ADV)
{
periph_mode = osal_start_timerEx( gapRole_TaskID, START_ADVERTISING_EVT, 1 );
}
And when I check bonds[index].publicAddr , I see motog's bluetooth device address still present in the register.
I cannot find any reason why this is happening? My ram memory is almost consumed. Does it have any dependency here?
Looking forward to your advice. Thank you.
Best,
Varun