This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Multicentral Zephyr Development Examples or Documentation

I have a development environment using Zephyr; setup and working from the documentation I found for the nRF Connect SDK.  I am using SES and am able to debug the provided examples.  How do I alter the build options for the examples?  Right clicking the project only has a greyed out "Options".  I am attempting to alter the UART Central example to connect to multiple peripheral devices.  I can't find any good documentation doesn't seem to touch on this subject at all.  Starting a scan after the first device connects leads to that device immediately trying to connect again.  It appears like it reconnects automatically.  Ideally I would like to catch it during the scan phase and not enter the connection phase if I am already connected?  Also, having the scan running during UART data transmission gives me a ENOTCONN error.  Anyone try to do something similar?

Parents
  • Take a look at this link to get started. Take a look at section 2.2 Create a light intensity controller. Regarding Zephyr with BLE, we recommend to use the standard nRF5 SDK. However, if you really want to use NCS for BLE, you can do this. I will get back to you on connecting to multiple devices, as a colleague of mine has done exactly this.

  • You should be able to add the following code to the relevant zephyr code in the prj.conf file: CONFIG_BT_MAX_CONN=n, where you change n to be the number of connections you have. In the LTE Gateway example, we show how you can connect the 52840 via BLE to a Nordic Thingy:52.

  • I'll double check that but I think this was already updated.  I'll be working on this more this week to see if I can make some headway thank you.

  • Okay so for now I have decided to take a step back and test out just the standard central uart sample given.  Just trying to get a single peripheral device to connect and reconnect on power cycle.  This does not appear to work out of the box.  The first time I connect it works fine but after a power cycle of the peripheral, the peripheral keeps reconnecting over and over again and doing rediscovery.

  • It seems that maybe this is the whole point of this example. From the testing procedure here, it seems that this may be done on purpose.

  • My device is connecting and disconnecting by itself every few seconds without power cycling.  I can't see how that could be by design.  This is my console over the course of a few seconds without touching anything after the initial power cycle of the peripheral.  Not to mention it doesn't detect any services after the initial connection.

    ***** Booting Zephyr OS v1.14.99-ncs1 *****
    Starting NUS Client example
    Bluetooth initialized
    UART initialized
    Scan module initialized
    NUS Client module initialized
    Scanning successfully started
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Security level was raised to 2
    Service discovery completed
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Service not found
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Service not found
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Service not found
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Service not found
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Service not found
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)
    Service not found
    Disconnected: e5:ac:47:28:e8:c7 (random) (reason 8)
    Filters matched. Address: e5:ac:47:28:e8:c7 (random) connectable: 1
    Connected: e5:ac:47:28:e8:c7 (random)

  • Yep, looks like a bug. The disconnect reason for me is either 8 or 61. Error 8 refers to Exec format error, while error 61 points to a connection refused error. See errnho.h for more details. When I tested the uart peripheral example with nRF Connect for Mobile, everything worked fine out of the box. I believe there is an issue with the uart central example. I will take a closer look & update this thread.

    Update: It seems this is a known issue, which will be fixed in a later release of NCS. Am checking if there is a workaround available now.

Reply
  • Yep, looks like a bug. The disconnect reason for me is either 8 or 61. Error 8 refers to Exec format error, while error 61 points to a connection refused error. See errnho.h for more details. When I tested the uart peripheral example with nRF Connect for Mobile, everything worked fine out of the box. I believe there is an issue with the uart central example. I will take a closer look & update this thread.

    Update: It seems this is a known issue, which will be fixed in a later release of NCS. Am checking if there is a workaround available now.

Children
Related