scan and advertising

Hello,

I'm using nRF52833, pca10100..

My project combines the functions of scan and advertising.
Each UUID is different and they pair with a different device.

I initialize to use scan and advertising,

For advertising, I initialize under function, and then
gap_params_init();
services_init();
advertising_init();
conn_params_init();

I initialize under function for scan.
db_discovery_init();
lbs_c_init();
scan_init();

When scanning, it was not paired with other peripheral devices..

But I change the order
After initializing the scan function, I initialize the advertising function.
And then it was connected with peripheral.

For what reason did it connected?
At first, before changing the order, I do comment 'service_init' function and it connected, so what part of the function is the problem?
BR,
lyrics
Related