CYW20706 Pairing mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
jojoc_3988076
Level 1
Level 1

Hi Cypress:

How to set the pairing mode of CYW20706 to require PIN CODE?

set p_event_data->pairing_io_capabilities_br_edr_request.auth_req.

But it didn't work

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi ,

Could you please set the IO capabilities as well.

When the Master attempts to Pair with you, it sends its I/O capabilities.

When you get the event asking for your I/O Capabilities, you need to respond by changing the event data.    You need to add the local IO capabilities. For example, if your device has a display and you want to use numeric comparison, you could use BTM_IO_CAPABILITIES_DISPLAY_AND_YES_NO_INPUT  (you may refer other IO capabilities in wiced_bt_dev.h file) as  shown here:

case BTM_PAIRING_IO_CAPABILITIES_BR_EDR_REQUEST_EVT:

        /* This application supports only Just Works pairing */

        WICED_BT_TRACE("BTM_PAIRING_IO_CAPABILITIES_REQUEST_EVT bda %B\n", p_event_data->pairing_io_capabilities_br_edr_request.bd_addr);

        p_event_data->pairing_io_capabilities_br_edr_request.local_io_cap   = BTM_IO_CAPABILITIES_DISPLAY_AND_YES_NO_INPUT;

        p_event_data->pairing_io_capabilities_br_edr_request.auth_req       =  BTM_AUTH_SINGLE_PROFILE_GENERAL_BONDING_YES;

        p_event_data->pairing_io_capabilities_br_edr_request.is_orig = WICED_FALSE;

        p_event_data->pairing_io_capabilities_br_edr_request.oob_data = BTM_OOB_NONE;

        break;

Depending on the IO capabilities of both devices, a pairing method is negotiated. If the devices have sufficient IO capabilities, you will either get a confirmation request event (for Numeric Comparison) or a passkey notification event (for Passkey Entry).

For numeric comparison, you need to display the value so that the user can confirm the value is the same on both devices. At that point, you can wait for user input to confirm the value, or you can just automatically confirm. If you do the latter, then you are depending on the other side of the connection to confirm the value. If the other side also automatically confirms, then the numeric comparison method doesn't protect you against MIM. By default, WICED Bluetooth Designer includes the following code to print the numeric value and confirm it automatically:

case BTM_USER_CONFIRMATION_REQUEST_EVT:

        WICED_BT_TRACE("BTM_USER_CONFIRMATION_REQUEST_EVT\n");

        /* This application always confirms peer's attempt to pair */

        WICED_BT_TRACE("numeric_value: %d\n", p_event_data->user_confirmation_request.numeric_value);

        wiced_bt_dev_confirm_req_reply (WICED_BT_SUCCESS, p_event_data->user_confirmation_request.bd_addr);

        break;

For passkey entry, you just need to display the Passkey on your device so that the user can enter it on the other device. WICED Bluetooth Designer does NOT include this state so you must include it if you are using Passkey Entry.

case BTM_PASSKEY_NOTIFICATION_EVT:

        WICED_BT_TRACE( "Passkey Notification\n\r");

        WICED_BT_TRACE(">>>>>>>>>>>>>>>>>>>>>>>> PassKey Required for BDA %B, Enter Key: %06d \n\r",

        p_event_data->user_passkey_notification.bd_addr, p_event_data->user_passkey_notification.passkey );

        break;

This is just an example , you may use as per your requirement.

Thanks,
Anjana

View solution in original post

1 Reply
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi ,

Could you please set the IO capabilities as well.

When the Master attempts to Pair with you, it sends its I/O capabilities.

When you get the event asking for your I/O Capabilities, you need to respond by changing the event data.    You need to add the local IO capabilities. For example, if your device has a display and you want to use numeric comparison, you could use BTM_IO_CAPABILITIES_DISPLAY_AND_YES_NO_INPUT  (you may refer other IO capabilities in wiced_bt_dev.h file) as  shown here:

case BTM_PAIRING_IO_CAPABILITIES_BR_EDR_REQUEST_EVT:

        /* This application supports only Just Works pairing */

        WICED_BT_TRACE("BTM_PAIRING_IO_CAPABILITIES_REQUEST_EVT bda %B\n", p_event_data->pairing_io_capabilities_br_edr_request.bd_addr);

        p_event_data->pairing_io_capabilities_br_edr_request.local_io_cap   = BTM_IO_CAPABILITIES_DISPLAY_AND_YES_NO_INPUT;

        p_event_data->pairing_io_capabilities_br_edr_request.auth_req       =  BTM_AUTH_SINGLE_PROFILE_GENERAL_BONDING_YES;

        p_event_data->pairing_io_capabilities_br_edr_request.is_orig = WICED_FALSE;

        p_event_data->pairing_io_capabilities_br_edr_request.oob_data = BTM_OOB_NONE;

        break;

Depending on the IO capabilities of both devices, a pairing method is negotiated. If the devices have sufficient IO capabilities, you will either get a confirmation request event (for Numeric Comparison) or a passkey notification event (for Passkey Entry).

For numeric comparison, you need to display the value so that the user can confirm the value is the same on both devices. At that point, you can wait for user input to confirm the value, or you can just automatically confirm. If you do the latter, then you are depending on the other side of the connection to confirm the value. If the other side also automatically confirms, then the numeric comparison method doesn't protect you against MIM. By default, WICED Bluetooth Designer includes the following code to print the numeric value and confirm it automatically:

case BTM_USER_CONFIRMATION_REQUEST_EVT:

        WICED_BT_TRACE("BTM_USER_CONFIRMATION_REQUEST_EVT\n");

        /* This application always confirms peer's attempt to pair */

        WICED_BT_TRACE("numeric_value: %d\n", p_event_data->user_confirmation_request.numeric_value);

        wiced_bt_dev_confirm_req_reply (WICED_BT_SUCCESS, p_event_data->user_confirmation_request.bd_addr);

        break;

For passkey entry, you just need to display the Passkey on your device so that the user can enter it on the other device. WICED Bluetooth Designer does NOT include this state so you must include it if you are using Passkey Entry.

case BTM_PASSKEY_NOTIFICATION_EVT:

        WICED_BT_TRACE( "Passkey Notification\n\r");

        WICED_BT_TRACE(">>>>>>>>>>>>>>>>>>>>>>>> PassKey Required for BDA %B, Enter Key: %06d \n\r",

        p_event_data->user_passkey_notification.bd_addr, p_event_data->user_passkey_notification.passkey );

        break;

This is just an example , you may use as per your requirement.

Thanks,
Anjana