Configuring BLE Central Device to work in a particular Scan and Connection Channel - KBA218992

Version: **

 

Question:

How to configure the BLE Central device to function in a particular Scan and Connection channel?

 

Answer:

There are APIs CyBle_GapGetChannelMap() and CyBle_GapcSetHostChannelClassification() for configuring Data Channel mapping, but no API is available to configure the Scan Channel mapping. However, Scan Channel mapping can be done by writing to the specific BLE_BLELL_SCAN_CONFIG register. To change the Scan Channel map configuration, change the 13-, 14- and 15-bits of BLE_BLELL_SCAN_CONFIG register.

Table 1. BLE_BLELL_SCAN_CONFIG Register Bit Mapping 

                                        
BitsNameDescription
15:13SCAN_CHANNEL_MAPAdvertising channels that are enabled for scanning operation.
    Bit 15: setting 1 - enables channel 39 for use.
    Bit 14: setting 1 - enables channel 38 for use.
    Bit 13: setting 1 - enables channel 37 for use.
    Default Value: 7 (All are ‘1’)

For more details on BLE_BLELL_SCAN_CONFIG register, refer to the CYBL10X6X Family: Programmable Radio-on-Chip With BLE (PRoC® BLE) Registers Technical Reference Manual (TRM) (Page 167). 

Example: 

Scan the 37th channel and use the below code in CYBLE_EVT_STACK_ON before CyBle_GapcStartScan() API: 

#define CYREG_BLE_BLELL_SCAN_CONFIG_USER (*(uint32*) BLE_BLELL_SCAN_CONFIG)

CYREG_BLE_BLELL_SCAN_CONFIG_USER=BLE_BLELL_SCAN_CONFIG_USER & 0xFFFF2FFF;