cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

Anonymous
Not applicable

I am running a simple code to just print the address of nearby peripheral devices. But, while trying so I figured out that for the same peripheral device the SCAN_PROGRESS_RESULT event was being called twice and hence the routine inside it was being executed twice. Is there any way I can stop this from happening?

   

I have made a simple project which just prints a character once the event is executed to verify my observation. That character was printed twice on the terminal.[Project file is attached below.]

   

Kindly provide solution/suggestion on how can I solve this problem.

   

PS:The advertising peripheral device is PRoC dongle running a Find Me profile.

   

In the future I wish to use the Service Data in the advertising packet.

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator

Hi,

   

CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT will get trigger when the Central will receive adv data from any BLE peripheral. So what you were seeing may not be the same device, it will be different devices.

   

Please refer our Central projects for reference: https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days

   

Refer Day 10, 11

   

Thanks & Regards,

   

Anjana

View solution in original post

0 Likes
2 Replies
AnjanaM_61
Moderator
Moderator

Hi,

   

CYBLE_EVT_GAPC_SCAN_PROGRESS_RESULT will get trigger when the Central will receive adv data from any BLE peripheral. So what you were seeing may not be the same device, it will be different devices.

   

Please refer our Central projects for reference: https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days

   

Refer Day 10, 11

   

Thanks & Regards,

   

Anjana

View solution in original post

0 Likes
Anonymous
Not applicable

It is also possible that you are performing an active scan, which will cause the peripheral to send an additional packet (called a scan response) immediately after the primary advertisement packet. The scan response usually contains less important information like a partial or complete device name, which your application rarely needs to process. You can perform a passive scan instead by setting the correct value before calling the CyBle_GapcStartScan() function:

   

cyBle_discoveryInfo.scanType = CYBLE_GAPC_PASSIVE_SCANNING;

   

If you don't need or want to switch between active and passive mode in code, you can also set this as the default scan mode in the BLE component configurator: