Hi Dialog Team,
I am customising the ble_app_peripheral to implement the following requirement.
1) Device should scan for BLE packets in the GAP_OBSERVER_SCA mode.
2) Upon reception of the first BLE packet, the packet has to be retransmitted by the device as soon as possible.
3) After retransmission of the packet, the device should switch back to scanning mode.
We have to continue this process (steps 1 - 3) throughout the life of the device.
Please let us know if this (role switch) is supported by SDK 6.0.2.
Thanks in advance,
Wisilica
Device:
Hi wisillica,
Yes its possible to switch the roles of the device the same way that the 580 does, just send a GAPM_RESET_CMD and set up the device in the corresponding role.
Thanks MT_dialog
Hi,
We have tried issuing the reset command for role switching purpose. But, the time required for this was observed to be around 5ms. Please suggest the reasons for the same and techniques to reduce this time.
Thanks
Wisilica
Hi wisilica,
你发送一个重置命令堆栈,和then you go through the entire configuration, we haven't estimated a maximum or a minimum time for this change but i suppose that it is quite reasonable, there are no techniques to reduce this time as far as i am aware. But since this is a 585, if you are worried about the timing that it takes to switch between two roles you can set the role in GAP_ROLE_ALL and advertise or scan (you can not do both at the same time) but you can advertise and set a timer, as soon as the timer elapses, stop the advertising procedure 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) so as soon as the scanning completes start the advertising again.
Thanks MT_dialog
Hi,
Could you please provide a sample code which demonstrates this kind of advertisement and scan switch by using GAP_ROLE_ALL.
Thanks
Wisilica
Hi wisilica,
I will provide the changes in order to perform this, using the ble_app_peripheral example:
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_PASSIVE;
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);
}
Following the instruction above you should be able to create a demo that advertises and scans in fixed intervals, without having to switch roles on the 585.
Thanks MT_dialog
Hello Dialog_Support,
我读过最重要的是,我想执行exact functionality as mentioned above. But i have DA14580 board which doesn't support GAP_ALL_ROLE so what changes i need to perform if i use DA14580 board? Can you provide me steps like you have posted above for Da14585 or you can provide or suggest me any example code.
Thanks and Regards,
Ruchi Patel
Hi Ruchi Patel,
The DA14580 doesn’t support dual role by default, so it can operate either as central (scanning operation) or as peripheral (advertising operation). In order to do this, you will have switch between roles override some functionalities. So, you should issue a gapm reset command in order to reset BLE stack and re-configure the device as peripheral or as central depending on your application. Please check the following past posts in which the steps for that configuration are referred.
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...
Thanks PM_dialog