⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
5 posts / 0 new
Last post
TMiranda
Offline
Last seen:2 years 5 months ago
Joined:2017-11-16 18:00
Using broadcaster role

Hi, I'm trying to use my device in the broadcaster role, but so far I've been unable to do it. I'm using the ble_app_barebone example to do it.

I'm change the parameters .role and .mode in the config.h file from GAP_ROLE_PERIPHERAL and GAP_LIM_DISCOVERABLE to GAP_ROLE_PERIPHERAL and GAP_BROADCASTER_MODE, respectively.

I've also changed the gap start function, from app_easy_gap_undirected_advertise_start() to app_easy_gap_non_connectable_advertise_start() in the user_barebone.c file.

Even with this changes, when I run the application it stops and goes to NMI_Handler.

我遗漏了什么东西?

Thanks in advance.

Keywords:
Device:
PM_Dialog
Offline
Last seen:1 day 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi TMiranda,

Hi TMiranda,

When a device acts as a broadcaster, that means that its able to support only non-connectable advertising. Please follow the steps below in order to configure your device as broadcaster. I made these steps in the ble_app_barebone example of the SDK 5.0.4.

  1. Change to GAP_BROADCASTER_MODE the .mode item of the user_adv_conf structure in the user_config.h header file

  1. Change to GAP_BROADCASTER_ADV the .role item of the user_adv_conf structure in the user_config.h header file.

  1. Add cmd =app_easy_gap_non_connectable_advertise_get_active(); instead of the cmd = app_easy_gap_undirected_advertise_get_active(); in user_app_adv_start() function of the user_barebone.c file

  1. Add the app_easy_gap_non_connectable_advertise_start(); instead of the app_easy_gap_undirected_advertise_start();in user_app_adv_start() function of the user_barebone.c file

  1. Add a user_app_on_adv_nonconn_complete() function as the user_app_adv_undirect_complete(). This function will be triggered when the non-connectable advertising completes. Probably that’s was the reason of the NMI.

  1. 添加user_app_on_adv_nonconn_complete in the user_app_callbacks structure of the user_callback_config.h header file as follow :

.app_on_adv_undirect_complete = user_app_adv_undirect_complete,

Thanks, PM_Dialog

TMiranda
Offline
Last seen:2 years 5 months ago
Joined:2017-11-16 18:00
Hi, thanks for the fast

Hi, thanks for the fast answer.
I'm doing the above mentioned, but I'm facing the following error:
"error: #20: identifier "user_app_on_adv_nonconn_complete" is undefined
.app_on_adv_nonconn_complete = user_app_on_adv_nonconn_complete,"

I'm adding the user_app_on_adv_nonconn_complete() function on the user_barebone.c file this way:
"void user_app_on_adv_nonconn_complete(uint8_t status)
{
// If advertising was canceled then update advertising data and start advertising again
if (status == GAP_ERR_CANCELED)
{
user_app_adv_start();
}
}"

Which is equal to the app_easy_gap_undicrect_advertise_start().

Then, I'm calling it on the user_callback_config.h like this:

" .app_on_adv_nonconn_complete = user_app_on_adv_nonconn_complete,"

I've also followed all the other steps too. Is there something I'm missing?

PM_Dialog
Offline
Last seen:1 day 6 hours ago
Staff
Joined:2018-02-08 11:03
Hi TMiranda,

Hi TMiranda,

You should make a reference of the user_app_on_adv_nonconn_complete() function into the ble_app_barebone.h header file. Please, how we define all our user application function. So, please add this code snippet into the ble_app_barebone.h:

void user_app_on_adv_nonconn_complete(uint8_t status);

Thanks, PM_Dialog

TMiranda
Offline
Last seen:2 years 5 months ago
Joined:2017-11-16 18:00
Yep, everything working fine.

Yep, everything working fine. Thanks!