7 posts / 0 new
Last post
craftwizard
Offline
Last seen:3 years 1 month ago
加入:2014-12-17 05:34
scanner error

Hi.
I am testing a ble scanner.
I implemented the scanner in a new project.
An error occurs in the scanner command. See code below

void app_start_scanning(void)
{
ke_state_set(TASK_APP, APP_CONNECTABLE);

arch_printf( "app_start_scanning \r\n");
struct gapm_start_scan_cmd *msg = KE_MSG_ALLOC(GAPM_START_SCAN_CMD, TASK_GAPM, TASK_APP, gapm_start_scan_cmd);
msg->mode = GAP_OBSERVER_MODE; //GAP_GEN_DISCOVERY;
msg->op.code = GAPM_SCAN_ACTIVE; //GAPM_SCAN_PASSIVE;
msg->op.addr_src = GAPM_PUBLIC_ADDR;
// msg->filt_policy = SCAN_ALLOW_ADV_ALL; //SCAN_ALLOW_ADV_WLST; //SCAN_ALLOW_ADV_ALL;
msg->filter_duplic = SCAN_FILT_DUPLIC_EN;
msg->interval = 10;
msg->window = 5;
ke_msg_send(msg);
return;
}

In the following code, the error code is returned.
gapm_cmp_evt_handler - operation:16, status:0x42
GAPM_SCAN_PASSIVE is not supported.
int gapm_cmp_evt_handler(ke_msg_id_t const msgid, struct gapm_cmp_evt const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
{
arch_printf( "gapm_cmp_evt_handler - operation:%d, status:0x%X \r\n", param->operation, param->status);
.......
}

It is a full log.
gapm_cmp_evt_handler - operation:1, status:0x0
gapm_cmp_evt_handler - operation:3, status:0x0
app_set_dev_config_complete_func
app_start_scanning
gapm_cmp_evt_handler - operation:16, status:0x42
app_scanning_completed_func

Do I need a predefined scanner to do it?
lease help me.

Device:
craftwizard
Offline
Last seen:3 years 1 month ago
加入:2014-12-17 05:34
It looks like the code below

It looks like the code below is modified and scanned.

void app_configuration_func(ke_task_id_t const task_id, struct gapm_set_dev_config_cmd *cmd)
{

// Operation select
cmd->operation = GAPM_SET_DEV_CONFIG;

// Device Role
cmd->role = GAP_CENTRAL_MST;

//Defined maximum transmission unit
cmd->max_mtu = APP_CFG_MAX_MTU;
}

It seems that the device being scanned is only a TV.
Other BLE devices do not seem to detect it.
我不能发现我DA14580祝福。
What is the reason?
If you change the option in app_start_scanning, it will not be searched.

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi Craftwizard,

Hi Craftwizard,

开始with in order to be able to scan the device needs to be configured either as a Central or as an Observer, having your device configured as a peripheral or as a broadcaster you wont be able to scan since those operations are not supported by the those roles.

Regarding the fact that you only can track your TV, the options that you fill in when you send a scan command determine what kind of devices you can scan, you will be able to check what those configuration do by checking the RW-BLE-GAP-IS.pdf (you can find the document on the support portal under the documents tab in the Profiles & API Documents section - GAP Interface Specification). Also be aware that the scanning command in General Discovery and Limited Discovery only lasts for 10 seconds after that the device will stop scan and you will have to re-issue the scan command. Also make sure that the devices that you have are actually advertising and you should catch the advertising devices in the .app_on_adv_report_ind callback.

Thanks MT_dialog

craftwizard
Offline
Last seen:3 years 1 month ago
加入:2014-12-17 05:34
Hi MT_dialog

Hi MT_dialog

Thank you for your reply.
What options do I have to change to scan all devices?
Changing the option does not search all devices.

As you can see in the code below, no search is done.
msg->mode = GAP_GEN_DISCOVERY;

Even if you look at the document, there is no special guide for scanning.

I tested again as the code below.
The TV is scanned as soon as it is scanned, but the rest of the devices are scanned after a very long time.
If you search for BLE on your smartphone, it will be search immediately.
what is the reason?
void app_start_scanning(void)
{
ke_state_set(TASK_APP, APP_CONNECTABLE);

arch_printf( "app_start_scanning \r\n");
struct gapm_start_scan_cmd *msg = KE_MSG_ALLOC(GAPM_START_SCAN_CMD, TASK_GAPM, TASK_APP, gapm_start_scan_cmd);
msg->mode = GAP_OBSERVER_MODE; //GAP_OBSERVER_MODE; //GAP_GEN_DISCOVERY;
msg->op.code = GAPM_SCAN_PASSIVE; //GAPM_SCAN_ACTIVE; //GAPM_SCAN_PASSIVE;
msg->op.addr_src = GAPM_PUBLIC_ADDR;
msg->filt_policy = SCAN_ALLOW_ADV_ALL; //SCAN_ALLOW_ADV_WLST; //SCAN_ALLOW_ADV_ALL;
msg->filter_duplic = SCAN_FILT_DUPLIC_EN; //SCAN_FILT_DUPLIC_DIS; //SCAN_FILT_DUPLIC_EN;
msg->interval = 500;
msg->window = 100;
ke_msg_send(msg);
return;
}

Please help me.

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi craftwizard,

Hi craftwizard,

In order to scan all types of advertising strings you will have to set your scan mode to GAP_OBSERVER_MODE, as indicated to the document this kind of scan will return any kind of advertising strings of the BLE devices that are advertising at the moment and the scanning procedure will never time out, you can only stop it via using the GAPM_CANCEL_CMD. The GAP_GEN_MODE will return devices that are advertising only in limited or general mode. As i ve mentioned make sure that the device is indeed advertising. There is no special guide in order how to operate the scanning procedure, just the specification of what each configuration does in the scan command, please have a look at the DSPS example in host side and check for the user_scan_start() function, you can take that as a reference.

Now if it takes time for the devices to be scanned you can try not to filter the duplicate advertising messages (if you are printing too much data though this can end up to a device reset), also you can try to reduce the values of your scanning interval and scanning window, the values that you currently have are scanning each channel for 62.5ms every 312.5ms and perhaps the devices that you are using dont advertise that often. Also the fact that you see the advertising devices on other phone scanners (android i assume) is perhaps because those devices are cached and the android doesn't show you the devices discovered at that scanning instance.

Thanks MT_dialog

craftwizard
Offline
Last seen:3 years 1 month ago
加入:2014-12-17 05:34
Hi MT_dialog

Hi MT_dialog
Thank you for your reply.

I tried the test again.
It seems that it is not possible to search because the sensitivity of sending and receiving the device is not good.

Is there an rssi value, meaning '100' is '-100dBm'?

MT_dialog
Offline
Last seen:2 months 2 weeks ago
Staff
加入:2015-06-08 11:34
Hi craftwizard,

Hi craftwizard,

An RSSI with a value of -100dBm doesn't have a meaning in BLE (its a very week reception), but i am not sure if i get your question. What is the 100 that you get ? Have you check in the FAQ's how to properly translate the values in dbm, inhttps://support.dialog-semiconductor.com/guide/faq-da1458x-software-peri...check the "How to read and convert the RSSI value to dBm".

Thanks MT_dialog