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.
Hi,
Did you change anything on the peripheral side? How does the code work for you without modification on either side?
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
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.
Or need to wait for a long time to scan out the advertising data,
how to faster scan out the advertising data ?
thanks.
I am not sure how to help you. I have asked a local representative to reach out to you directly.
I have similar question. When I use PASSIVE_SCAN there isn't any adv data. Would you please help me ?
There is a bug in my code, so the problem is resolved. Thanks.
嗨,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 .
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.
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.
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.
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.
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.
how do you solve this problem? I get the same issue now, thanks.
"not go in to gapm_adv_report_ind_handler"