Da14585 master slave integrated module

Learn MoreFAQsTutorials

5 posts / 0 new
Last post
孙梦君
Offline
Last seen:1 week 3 days ago
加入:2020-03-03 02:40
Da14585 master slave integrated module

你好

da14585是否有主从示例程序?

谢谢

Device:
PM_Dialog
Offline
Last seen:1 day 13 hours ago
工作人员
加入:2018-02-08 11:03
Hi There,

Hi There,

I am not completely sure what you are searching for, but please take a look at the Dialog Serial Port Service (DSPS) reference application. The DSPS contains 2 projects :

sps_host : the DA14585 is acting as a Central

sps_device : the DA14585 is acting as a Peripheral

If I misunderstood your question, please try to clarify it as it is little big generic.

This is our English forum and customers post their questions in English. So, please translate your question / comments in English, or post it in our Chinese forums.

https://support.dialog-semiconductor.com/forums/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software-dialog-%E2%80%9Csmartbond%E2%80%9D%E7%B3%BB%E5%88%97%E4%BD%8E%E5%8A%9F%E8%80%97%E8%93%9D%E7%89%99%E2%80%94%E8%BD%AF%E4%BB%B6

Thanks, PM_Dialog

孙梦君
Offline
Last seen:1 week 3 days ago
加入:2020-03-03 02:40
Thank you for your reply

Thank you for your reply

Master and slave integrated program,It can be either a master or a slave, and the master and slave can be switched through the state.

PM_Dialog
Offline
Last seen:1 day 13 hours ago
工作人员
加入:2018-02-08 11:03
Hi There

Hi There

According to Bluetooth LE specification, it is not possible to scan ( GAP Central role) and advertise ( GAP Peripheral role) at the same time. Since you are using DA14585, you can perform role switching from Peripheral to Central GAP configuration and vice versa. This can be done by setting the role to GAP_ROLE_ALL, so that you can either advertise or scan. But it’s not possible to do both simultaneously.

Let’s take the ble_app_peripheral example of the SDK as a start point. By default, the DA14585 is configured as a peripheral, so it starts advertising (undirected). You can use an app_easy_timer() and upon its expiration, you should stop advertising. As soon as it stops, you can configure the device as a Central and start scanning. You can 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, maybe you can start advertising again. Please check the steps below in order to perform role switching.

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

- Create a user_scan_start() function in order 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, an additional timer won’t be used in order to cancel the command, but the timeout of the scanning itself will be used.

- 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

孙梦君
Offline
Last seen:1 week 3 days ago
加入:2020-03-03 02:40
Thank you for your reply. I

Thank you for your reply. I'll try this method