Skip to main content

Scan with DSPS Project

4 years ago

Scan with DSPS Project

Posted byJonas Freitas0 points 3 replies
0 upvotes

Hello,

I'm working in a project with DSPS and I'm trying scanning in central mode but I can only see BL devices (DA14580). I cannot see devices from other manufactures, like Microchip RN4020.

Scanning configuration follows below:

空白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_OBSERVER_MODE;
msg->op.code = GAPM_SCAN_PASSIVE;
msg->op.addr_src = GAPM_PUBLIC_ADDR;
msg->filt_policy=SCAN_ALLOW_ADV_ALL;
msg->filter_duplic = SCAN_FILT_DUPLIC_DIS;
msg->interval = APP_SCAN_INTERVAL;
msg->window = APP_SCAN_WINDOW;

// Send the message
ke_msg_send(msg);
}

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)
{
char temp[150];
int8_t rssi;

if(!memcmp(¶m->report.data[3], APP_DFLT_ADV_DATA, APP_DFLT_ADV_DATA_LEN))
{
//Save found bd_addr to global variable
rssi = (int)(((浮动)param->report.rssi*0.474)-122);
memcpy(&connect_bdaddr, param->report.adv_addr.addr, sizeof(struct bd_addr));
sprintf(temp,"mac:%0.2x:%0.2x:%0.2x:%0.2x:%0.2x:%0.2x||rssi:%d\r\n",param->report.adv_addr.addr[5],param->report.adv_addr.addr[4],param->report.adv_addr.addr[3],param->report.adv_addr.addr[2],param->report.adv_addr.addr[1],param->report.adv_addr.addr[0],rssi);
sps_uart_sps_write((uint8_t*)temp, strlen(temp));

//app_cancel_scanning();
}
return (KE_MSG_CONSUMED);
}

Thanks,

4 years ago

Jonas Freitas 0 points

any suggestions, for what you may be going?

4 years ago

MT_dialog -30 points

Hi Jonas Freitas,

Are you able to catch the the advertising indications by using a break point at the if() ? are you sure that the other device is advertising ?

I can see that you are checking the devices advertising string for a specific pattern of advertising data, are you sure that the other devices are advertising the same advertising string as the dialog chip does ?

Thanks MT_dialog

4 years ago

MSun 0 points

By default, the DSPS application will only report devices that match the UUID used by the DSPS application.

If you want to see the other devices, you would need to comment out the code that filters the other non-DPSP devices.

See user_on_adv_report_ind()

if(!memcmp(¶m->report.data[3], USER_ADVERTISE_DATA, USER_ADVERTISE_DATA_LEN))
The above if statement is looking for only the DSPS UUID. You can modify this area to look at all UUIDs if you wish.

Thanks, Martin