标题:安卓手机与CC2640连接失败,因为没有发出“Connection establishment”的数据包
内容:使用安卓手机(小米6、Android8.0)与CC2640连接,会连接失败。平均连接10次,失败4次。通过packet sniffer抓包工具发现,手机与cc2640之间发射了多个“Scan request / response”数据包,但是没有发出“Connection establishment”的数据包。
通过UART的串口信息显示,CC2640连接失败之后,就一直停留在“GAPROLE_WAITING”状态。
如果使用iphone5与CC2640连接,则成功率为100%
请问如何调整CC2640的GAP层的参数,以提高连接的成功率?
问题详细描述:
(1)更改配对模式,代码如下:
[ // Don't send a pairing request after connecting; the peer device must // initiate pairing //uint8_t pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ; uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE; // Use authenticated pairing: require passcode. uint8_t mitm = TRUE; // This device only has display capabilities. Therefore, it will display the // passcode during pairing. However, since the default passcode is being // used, there is no need to display anything. uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY; //手机不显示密码,只有这个可用 // Request bonding (storing long-term keys for re-encryption upon subsequent // connections without repairing) uint8_t bonding = TRUE; //uint8_t scMode = GAPBOND_SECURE_CONNECTION_ALLOW; GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode); GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm); GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap); GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding); //GAPBondMgr_SetParameter(GAPBOND_SECURE_CONNECTION, sizeof(uint8_t), &scMode); ]
(2)利用小米6与CC2640连接,利用packet sniffer抓包,抓到了多个“Scan request / response”数据包,如图1所示。
(3)没有抓到“Connection establishment”的数据包。抓到了许多“FCS = “ERROR”的包,如图2所示
(4)参照官方的参考文档(链接见附件),如果连接成功,会收到“Connection establishment”的数据包,如图3所示。
(5)我抓到的数据包的文件在附件中。
(6)通过UART的串口信息显示,CC2640连接失败之后,就一直停留在“GAPROLE_WAITING”状态。UART信息打印的代码如下所示. 该代码在“simple_peripheral.c”文件中:
static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)[ ....... case GAPROLE_WAITING: Util_stopClock(&periodicClock); SimpleBLEPeripheral_freeAttRsp(bleNotConnected); Display_print0(dispHandle, 2, 0, "Disconnected"); UART_write(uart, "GAPROLE_WAITINGrn", sizeof("GAPROLE_WAITINGrn")); // Clear remaining lines Display_clearLines(dispHandle, 3, 5); break;......]
附件:
(1)官方的参考文档
http://processors.wiki.ti.com/index.php/BLE_sniffer_guide
(2)我抓到的数据包的文件
02_fail_pairing.psd
标题:安卓手机与CC2640连接失败,因为没有发出“Connection establishment”的数据包
内容:使用安卓手机(小米6、Android8.0)与CC2640连接,会连接失败。平均连接10次,失败4次。通过packet sniffer抓包工具发现,手机与cc2640之间发射了多个“Scan request / response”数据包,但是没有发出“Connection establishment”的数据包。
通过UART的串口信息显示,CC2640连接失败之后,就一直停留在“GAPROLE_WAITING”状态。
如果使用iphone5与CC2640连接,则成功率为100%
请问如何调整CC2640的GAP层的参数,以提高连接的成功率?
问题详细描述:
(1)更改配对模式,代码如下:
[ // Don't send a pairing request after connecting; the peer device must // initiate pairing //uint8_t pairMode = GAPBOND_PAIRING_MODE_WAIT_FOR_REQ; uint8_t pairMode = GAPBOND_PAIRING_MODE_INITIATE; // Use authenticated pairing: require passcode. uint8_t mitm = TRUE; // This device only has display capabilities. Therefore, it will display the // passcode during pairing. However, since the default passcode is being // used, there is no need to display anything. uint8_t ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY; //手机不显示密码,只有这个可用 // Request bonding (storing long-term keys for re-encryption upon subsequent // connections without repairing) uint8_t bonding = TRUE; //uint8_t scMode = GAPBOND_SECURE_CONNECTION_ALLOW; GAPBondMgr_SetParameter(GAPBOND_PAIRING_MODE, sizeof(uint8_t), &pairMode); GAPBondMgr_SetParameter(GAPBOND_MITM_PROTECTION, sizeof(uint8_t), &mitm); GAPBondMgr_SetParameter(GAPBOND_IO_CAPABILITIES, sizeof(uint8_t), &ioCap); GAPBondMgr_SetParameter(GAPBOND_BONDING_ENABLED, sizeof(uint8_t), &bonding); //GAPBondMgr_SetParameter(GAPBOND_SECURE_CONNECTION, sizeof(uint8_t), &scMode); ]
(2)利用小米6与CC2640连接,利用packet sniffer抓包,抓到了多个“Scan request / response”数据包,如图1所示。
(3)没有抓到“Connection establishment”的数据包。抓到了许多“FCS = “ERROR”的包,如图2所示
(4)参照官方的参考文档(链接见附件),如果连接成功,会收到“Connection establishment”的数据包,如图3所示。
(5)我抓到的数据包的文件在附件中。
(6)通过UART的串口信息显示,CC2640连接失败之后,就一直停留在“GAPROLE_WAITING”状态。UART信息打印的代码如下所示. 该代码在“simple_peripheral.c”文件中:
static void SimpleBLEPeripheral_processStateChangeEvt(gaprole_States_t newState)[ ....... case GAPROLE_WAITING: Util_stopClock(&periodicClock); SimpleBLEPeripheral_freeAttRsp(bleNotConnected); Display_print0(dispHandle, 2, 0, "Disconnected"); UART_write(uart, "GAPROLE_WAITINGrn", sizeof("GAPROLE_WAITINGrn")); // Clear remaining lines Display_clearLines(dispHandle, 3, 5); break;......]
附件:
(1)官方的参考文档
http://processors.wiki.ti.com/index.php/BLE_sniffer_guide
(2)我抓到的数据包的文件
02_fail_pairing.psd
举报