DA14585 Simultaneous Master/Slave

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
moiify
Offline
Last seen:4 weeks 1 day ago
Joined:2020-03-12 07:26
DA14585 Simultaneous Master/Slave

Can DA14585 scan or broadcast the Bluetooth information around without disconnecting the connection (active connection of the mobile phone). If there is a reference routine or related documents or interfaces to check it? Thank you! addtion:why the DA14580 cannot implement this function, is it the reason for the protocol stack version?

Device:
PM_Dialog
Offline
Last seen:7 hours 55 min ago
Staff
Joined:2018-02-08 11:03
Hi moiify,

Hi moiify,

According to your description, I assume that the DA14585 is acting as a Peripheral because it is connected with a Mobile phone (Central). Keep in mind that according to Bluetooth LE specifications, the device cannot act both as Peripheral and as Central at the same time. If my understanding is right and the DA14585 is configured as Peripheral, it is possible to advertise while it is in connected state. I am not sure which SDK example are you using or if you have a custom code, but when a connection is established with a peer device (the mobile phone in your case), the user_app_connection() callback is triggered. To do so, when this callback is triggered, you should restart advertising by calling user_app_adv_start().

Thanks, PM_Dialog

moiify
Offline
Last seen:4 weeks 1 day ago
Joined:2020-03-12 07:26
I am very appreciate for

I am very appreciate for your answer! I am using the 14858 SDK 6.0.10.I find the call and structure : cmd = app_gapm_configure_msg_create(); cmd->role = GAP_ROLE_ALL; I don't know if this works... Addition,Can I use 14585 to advertise while scanning?I am searching for the answer to the question,thank you!

PM_Dialog
Offline
Last seen:7 hours 55 min ago
Staff
Joined:2018-02-08 11:03
Hi moiify,

Hi moiify,

根据蓝牙LE规范体制m is not allowed to act both as a Central and as a Peripheral at the same time. Since you are using DA14585, you should perform role switching from Peripheral to Central GAP configuration and vice versa. By setting the role to GAP_ROLE_ALL, this means that you can either advertise (peripheral role) or scan (central role). It’s not possible to do both simultaneously

Please let me share a suggested implementation for this. You can start advertising and set up a timer. Upon timer’s expiration, you should stop advertising and as soon as it stops you can start scanning and either wait for the scan to complete (if you are scanning in GAP_GEN_DISCOVERY or set an additional timer and cancel the scanning procedure). When the scanning is completed, start the advertising again. Please check the steps below in order to perform role switching. The ble_app_peripheral example of the SDK is used in my side.

- Change in the user_config.h file the .role member of the user_gapm_conf to GAP_ROLE_ALL.

- Create a user_scan_start() function in order for the device to start scanning:

void user_scan_start(void) { struct gapm_start_scan_cmd* cmd = KE_MSG_ALLOC(GAPM_START_SCAN_CMD, TASK_GAPM, TASK_APP, gapm_start_scan_cmd); cmd->op.code = GAPM_SCAN_ACTIVE; cmd->op.addr_src = GAPM_STATIC_ADDR; cmd->interval = 16384; cmd->window = 16384; cmd->mode = GAP_GEN_DISCOVERY; cmd->filt_policy = SCAN_ALLOW_ADV_ALL; cmd->filter_duplic = SCAN_FILT_DUPLIC_EN; // Send the message ke_msg_send(cmd); // We are now connectable ke_state_set(TASK_APP, APP_CONNECTABLE); }

- In the user_app_adv_start() function there is a timer that starts up in order to stop the advertising after about 30 seconds, so we are going to use that in order to stop the advertising.

- So in the callback of the timer adv_data_update_timer_cb() instead of updating of the advertising string,invoke the app_easy_gap_advertise_stop() function.

- In the user_app_adv_undirect_complete() function invoke the user_scan_start() function, so that when the device stops advertising to start scanning.

- In order to stop scanning i won’t use an additional timer in order to cancel the command, but i will use the timeout of the scanning itself.

- To start advertising as soon as the scanning ends create a function user_on_scanning_completed() and from that function invoke the user_app_adv_start();

Thanks, PM_Dialog

moiify
Offline
Last seen:4 weeks 1 day ago
Joined:2020-03-12 07:26
thank you for your answer! It

thank you for your answer! It really helped me。 thank you again.

PM_Dialog
Offline
Last seen:7 hours 55 min ago
Staff
Joined:2018-02-08 11:03
Hi moiify,

Hi moiify,

Glad that my answer was helpful and thanks for accepting it. If you have any follow up question, please create a new forum thread.

Thanks, PM_Dialog