This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Error when trying to enable extended advertising on code based on NUS example

Hi,

I'm working on an nRF5340 project using nRF Connect SDK v1.7.0 with VS Code. I started my project with the NUS example.

I've been able to customize the standard/legacy advertising packets as required by my customer with no problem using bt_le_adv_start(), but they also want me to be able to use extended advertising in certain circumstances.

In order to do that I see that I have to not only switch to calling bt_le_ext_adv_start, but also create an advertising set using bt_le_ext_adv_create. I found an example that does that for reference (iso_broadcast), but when I call bt_le_ext_adv_create I get a -5 return code (-EIO).

The full sequence of calls is bt_le_ext_adv_create calls le_ext_adv_param_set, which calls bt_hci_cmd_send_sync(BT_HCI_OP_LE_SET_EXT_ADV_PARAM, buf, &rsp);

The send_sync function gets a 1  from this call: status = cmd(buf)->status;

That causes the function to send the -5 back up the chain.

What am I doing wrong?

Thanks,

Glen

  • sorry for the late reply Glen, 

    I need to get your full setup, obviously there is some difference between your and my setup. 

    Have you set CONFIG_BT_EXT_ADV=y in your config? Not sure what else is different.

  • Yes CONFIG_BT_EXT_ADV is y. I'm not sure what to try next either as we're running the same HR CODED example using the same hardware and tools and getting different results.

    How are you verifying that it works - is it just working, or are you looking at the return codes? Maybe the return code doesn't matter and it'll end up working anyway if I just let it run?

  • Susheel Nuguru said:
    I tried to use your code in hr_coded example and adding settings or BT_LE_EXT_ADV_NCONN_NAME in bt_le_ext_adv_create passes normally. Not sure what else is different in your setup but i cannot find anything that is relevant to this issue to be different than your code snippet and this hr_coded exampe  

    I tried hr_coded example with changes to the create function to match yours and the error code returned was 0. 

    Glen M said:
    Maybe the return code doesn't matter and it'll end up working anyway if I just let it run?

    That odes not sound right, error codes other than 0 shows failure and letting it run anyway to expect it to work is very risky.

    Have you tried the hr_coded example with minor changes to the arguments to bt_le_ext_adv_create and run it in the debugger, set a breakpoint at this function and see what error code you get? If this example works for you, then we need to take a closer look at your setup.

  • I finally got somewhere with this - Instead of always using "Debug" I tried "Erase and Flash" from the actions menu and now the example works (both after Erase and Flash and now that I just debug it. Maybe I had some old stuff in the network core or somewhere that was cleaned out by that action?

    Glad to have it going!

Related