您好!
我的控制器 CC2541不能与 Motog 手机绑定。 以下是日志:
NRF Connect、2021-11-25
无名称(B0:B1:13:85:DD:88)
V 23:21:19.615正在开始配对...
D 23:21:19.615 device.createBond()
D 23:21:19.681 [广播]操作接收到:android.bluetooth.device.action.BOND_STATE_CHANGED、绑定状态更改为:bond_bonding (11)
D 23:21:19.690 [广播]操作接收到:android.bluetooth.device.action.BOND_STATE_CHANGED、键合状态更改为:BON_NONE (10)
I 23:21:19.690定色失败
D 23:21:21.583 [回调]连接状态已更改、状态为0、新状态为已连接(2)
I 23:21:21.583连接到 B0:B1:13:85:DD:88
I 23:21:21.599从0000fd02-0000-1000-8000-00805f9b34fb 接收的通知、值:(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"
v 23:21:21.646正在查找服务...
D 23:21:21.646 GATT.discoverServices()
已更新 I 23:21:22.042连接参数(间隔:7.5ms、延迟:0、超时:5000ms)
D 23:21:22.747 [Callback]服务发现状态为0
I 23:21:22.747已发现服务
V 23:21:22.796通用访问(0x1800)
-器件名称[R](0x2A00)
-外观[R](0x2A01)
-外设隐私标志[R](0x2A02)
-重新连接地址[W](0x2A03)
-外设首选连接参数[R](0x2A04)
通用属性(0x1801)
-服务已更改[i](0x2A05)
客户端特征配置(0x2902)
器件信息(0x180A)
-系统 ID [R](0x2A23)
-模型编号字符串[R](0x2A24)
-序列号字符串[R](0x2A25)
-固件版本字符串[R](0x2A26)
-硬件版本字符串[R](0x2A27)
-软件版本字符串[R](0x2A28)
-制造商名称字符串[R](0x2A29)
- IEEE 11073-20601法规认证数据列表[R](0x2A2A)
- PnP ID [R](0x2A50)
未知服务(0000fa00-0000-1000-8000-00805f9b34fb)
-未知特征[R W](0000fa01-0000-1000-8000-00805f9b34fb)
-未知特性[N WNR](0000fa02-0000-1000-8000-00805f9b34fb)
客户端特征配置(0x2902)
未知服务(0000fb00-0000-1000-8000-00805f9b34fb)
-未知特性[N R](0000fb01-0000-1000-8000-00805f9b34fb)
客户端特征配置(0x2902)
-未知特性[R W](0000fb02-0000-1000-8000-00805f9b34fb)
-未知特性[N W](0000fb03-0000-1000-8000-00805f9b34fb)
客户端特征配置(0x2902)
-未知特性[N R](0000fb04-0000-1000-8000-00805f9b34fb)
客户端特征配置(0x2902)
控制器在其他手机中被绑定、有时也会在那里失去绑定、因此无法发现。 然后需要进行粉末循环休息。
我的初始化代码位于此处:
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 );
当器件未连接时(如下所示)、我是否需要定期调用广播、或者 BLE 堆栈将自动处理广播?
if(gapRole_state != GAPROLE_CONNECTED && gapRole_state != GAPROLE_CONNECTED_ADV) { periph_mode = osal_start_timerEx( gapRole_TaskID, START_ADVERTISING_EVT, 1 ); }
当我检查 b债券[index].publicAddr 时,我看到 MOTOG 的蓝牙设备地址仍然存在于寄存器中。
我找不到发生这种情况的原因吗? 我的 RAM 存储器几乎被消耗了。 它在这里是否有任何依赖关系?
期待您的建议。 谢谢你。
最棒的
瓦伦