CC2541配对成功后,第二次连接时提示bonding fail 错误码 0x06 看了下是 L_STATUS_ERROR_PIN_OR_KEY_MISSING 是怎么回事?
Viki Shi:
可能是设备没有正确初始化,是否有绑定?
tyty:
回复 Viki Shi:
从机配置// Setup the GAP Bond Manager{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 );}
主机配置
// Default passcode
#define DEFAULT_PASSCODE254876// Default GAP pairing mode
#define DEFAULT_PAIRING_MODEGAPBOND_PAIRING_MODE_WAIT_FOR_REQ// Default MITM mode (TRUE to require passcode or OOB when pairing)
#define DEFAULT_MITM_MODETRUE// Default bonding mode, TRUE to bond
#define DEFAULT_BONDING_MODETRUE// Default GAP bonding I/O capabilities
#define DEFAULT_IO_CAPABILITIESGAPBOND_IO_CAP_KEYBOARD_ONLY
{uint32 passkey = DEFAULT_PASSCODE;uint8 pairMode = DEFAULT_PAIRING_MODE;uint8 mitm = DEFAULT_MITM_MODE;uint8 ioCap = DEFAULT_IO_CAPABILITIES;uint8 bonding = DEFAULT_BONDING_MODE;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 );}一开始是一直能够成功的,大概过了10分钟后再次连接就会提示上面的错误。