微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI蓝牙设计交流 > CC2540 和android BLE 调试助手配对不成功

CC2540 和android BLE 调试助手配对不成功

时间:10-02 整理:3721RD 点击:

CC2540做为BLEPeripheral, 配对设置如下:

uint32 passkey = 0; // passkey "000000"
uint8 pairMode = GAPBOND_PAIRING_MODE_INITIATE;
uint8 mitm = TRUE;
uint8 ioCap = GAPBOND_IO_CAP_DISPLAY_ONLY;
uint8 bonding = TRUE;
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 );

simpleBLEPeripheralPasscodeCB代码如下,密码为0

static void simpleBLEPeripheralPasscodeCB( uint8 *deviceAddr, uint16 connectionHandle,
uint8 uiInputs, uint8 uiOutputs )
{
// Send passcode response

uint32 passcode = 0;

GAPBondMgr_PasscodeRsp( connectionHandle, SUCCESS, passcode );
}

总是配对不成功,android BLE 调试助手要求输入4位密码,BLE可以提供6位密码,请问是4位还是6位?

请配对不成功可能是哪里有问题,多谢!

问题找到,是添加的程序中,自行关闭了连接。

请问配对密码是4位还是6位?

配对密码在代码里面可以看到

配对的例程可以参考GlucoseSensor和GlucoseCollector

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top