The host is send scan cmd but not scan any perpheral device

15 posts / 0 new
Last post
YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
The host is send scan cmd but not scan any perpheral device

Hi,all.

在dsps project "DA14580_DSPS_3.150.2", The host is send scan cmd but not scan any perpheral device.
But in phone app can scan perpheral device.
why ?

please help me.

the code is not change but add some tips by uart.the place is follow:

空白app_scanning(空白)
{
ke_state_set(TASK_APP, APP_CONNECTABLE);

// create a kernel message to start the scanning
struct gapm_start_scan_cmd *msg = (struct gapm_start_scan_cmd *)KE_MSG_ALLOC(GAPM_START_SCAN_CMD, TASK_GAPM, TASK_APP, gapm_start_scan_cmd);
// Maximal peer connection
msg->mode = GAP_GEN_DISCOVERY;
msg->op.code = GAPM_SCAN_PASSIVE;
msg->op.addr_src = GAPM_PUBLIC_ADDR;
msg->filter_duplic = SCAN_FILT_DUPLIC_EN;
msg->interval = APP_SCAN_INTERVAL;
msg->window = APP_SCAN_WINDOW;

uart_write("\r\nS7\r\n", 6, NULL); //////add by me

// Send the message
ke_msg_send(msg);
}

in gapm_cmp_evt_handler function add tips:
case GAPM_SCAN_PASSIVE:
case GAPM_SCAN_ACTIVE:
{
if (param->status == GAP_ERR_CANCELED)
{
uart_write("\r\nS6\r\n", 6, NULL); //add by me
app_connect();
}
else
{
uart_write("\r\nS7\r\n", 6, NULL); //add by me
app_scanning();
}
}
break;

in app_set_dev_config_complete_func function:
void app_set_dev_config_complete_func(void)
{
// We are now in Initialization State
ke_state_set(TASK_APP, APP_DB_INIT);

// Add the first required service in the database
if (app_db_init())
{
// When the data base is already made start advertising
uart_write("\r\nS1\r\n", 6, NULL); //add by me
app_scanning();
}
}

In gapm_adv_report_ind_handler function :
int gapm_adv_report_ind_handler(ke_msg_id_t const msgid,
const struct gapm_adv_report_ind *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
/*
if(!memcmp(¶m->report.data[3], APP_DFLT_ADV_DATA, APP_DFLT_ADV_DATA_LEN))
{
//Save found bd_addr to global variable
memcpy(&connect_bdaddr, param->report.adv_addr.addr, sizeof(struct bd_addr));

uart_write("\r\nS5\r\n", 6, NULL); //add by me
app_cancel_scanning();
}
else
*/
uart_write("\r\nS6\r\n", 6, NULL); //add by me
return (KE_MSG_CONSUMED);
}

I close the sleep mode in da14580_config.h.
not change any thing.
the result is :
S1
S7
S7
S7
S7

every S7 tip is about 10 second gap.
I used "DA14580_DSPS_3.150.2", The sps_device and sps_host.
but not go in to gapm_adv_report_ind_handler function.
手机应用程序可以扫描14580's perpheral device. .
why not go into gapm_adv_report_ind_handler function?

wait for your help.

Keywords:
Device:
MHv_Dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2013-12-06 15:10
Hi,

Hi,

Did you change anything on the peripheral side? How does the code work for you without modification on either side?

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Hi,

Hi,

because there is no 32.768K,so

the peripheral change only this place:
#define CFG_LP_CLK 0x00 to 0xAA;

and the central also change this place:
#define CFG_LP_CLK 0x00 to 0xAA;
there is no change

no other place change any more.

YuanhangWu

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Hi,all.

Hi,all.
I used "DA14580_DSPS_3.150.2" sps_host.

when GAPM_START_SCAN_CMD send,

but not go in to gapm_adv_report_ind_handler function.

手机应用程序可以扫描14580's perpheral device. .
why ?
how to used sps_host project to get perpheral device advertising data?
in somewhere the get advertising data store?

thanks.

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Or need to wait for a long

Or need to wait for a long time to scan out the advertising data,
how to faster scan out the advertising data ?

thanks.

MHv_Dialog
Offline
Last seen:2 months 2 weeks ago
Staff
Joined:2013-12-06 15:10
I am not sure how to help you

I am not sure how to help you. I have asked a local representative to reach out to you directly.

summer20100514
Offline
Last seen:4 years 5 months ago
Guru
Joined:2014-12-30 05:01
I have similar question. When

I have similar question. When I use PASSIVE_SCAN there isn't any adv data. Would you please help me ?

summer20100514
Offline
Last seen:4 years 5 months ago
Guru
Joined:2014-12-30 05:01
There is a bug in my code, so

There is a bug in my code, so the problem is resolved. Thanks.

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
嗨,summer20100514,

嗨,summer20100514,

You problem have resolved.
So,I want you for help me.
Used host role in DA14580_DSPS_3.150.2,
how to make scan result faster and more effective?

thanks .

summer20100514
Offline
Last seen:4 years 5 months ago
Guru
Joined:2014-12-30 05:01
I didn't use DA14580_DSPS_3

I didn't use DA14580_DSPS_3.150.2, instead I use DA14580_SDK_3.0.4.0\host_apps\windows\proximity\monitor. Of course, I modified the project on PC to work on STM32 as one external host and DA14580 running the ble stack, which is DA14580_SDK_3.0.4.0\dk_apps\keil_projects\proximity\monitor_fe_usb. Due to some commercial reasons, I can not provide the project to you, but I think you can look into these projects to get inspired, and in fact, it's quite easy.

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Hi,MHv_dialog

Hi,MHv_dialog

I test many times used host to scan advertising data, just one time scan out the advertising data in gapm_adv_report_ind_handler function.
So I want to get the scan result faster and more effective.
How to do then?

thanks.

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Hi,MHv_dialog,

Hi,MHv_dialog,

I mean is that host device scan first time or second time,then scan out the perpheral's advertising data.
Yes ,with a short number scan time get the scan result.

how to do to make it?

thanks.

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Hi,MHv_dialog,

Hi,MHv_dialog,

I just debug in KEIL u4.
When I set like this:
/// Advertising minimum interval
#define APP_ADV_INT_MIN 0x30
/// Advertising maximum interval
#define APP_ADV_INT_MAX 0x30
I click dubug --run-(have scan out perpheral advertising data)--dubug.

When I set like this:
/// Advertising minimum interval
#define APP_ADV_INT_MIN 0xA0
/// Advertising maximum interval
#define APP_ADV_INT_MAX 0xA0
I click dubug --run---dubug.
I inset tip tell me that many time pass ,but also cannot scan out perpheral advertising data.

Wyh吗?
For low comsumption ,So the Advertising interval should set how long to be is the best?

Thanks.

YuanhangWu
Offline
Last seen:4 years 11 months ago
Expert
Joined:2015-03-25 08:19
Hi,MHv_dialog,

Hi,MHv_dialog,

I have get it.
Now the result is:
peripheral:
0.5 second advertsing gap.

central:
Host scan out every 7.5 second,but the consumption is 3.6MA average.

The speed of scan is not very fast,but the consumption is already high.
wyh and how to make scan result faster and more effective?
Or how to get the best balance.

achao1104
Offline
Last seen:5 years 3 months ago
Master
Joined:2015-12-24 10:56
how do you solve this problem

how do you solve this problem? I get the same issue now, thanks.
"not go in to gapm_adv_report_ind_handler"