nRF5340 Audio - configure gateway unit also as ACL peripheral

Hi,

I'm working with nRF5340 Audio DKs.

I'm able to successfully run the audio example in BIS mode (with gateway and headset devices).

My goal is to open another BT connection, in parallel to the audio broadcast on my gateway device, to which I can connect with the headset units and the nRF Toolbox App via NUS. I'd like the gateway device to act as peripheral in that manner and to be able to connect to 6 different devices concurrently via NUS (5 headset units + 1 smartphone app).

I tried implementing it by myself, and I feel like on the brink of it, but calling bt_le_ext_adv_create() twice (once for audio and once for ACL) fails with EIO (I/O error). It's unclear to me why it happens. As I see it, the challange is to create 2 concurrent advertisements in the gateway unit - audio streaming and ACL connection.

On this ticket I received great help from , which implemented the gateway device as central in terms of ACL connection.

I'll share that I was able to deduce from his development and successfully configure the headset device as central in terms of ACL connection (in parallel to audio streaming receival). here are the relevant files: headset_as_ACL_central.rar

I would appreciate any help with such implementation.

Thank you,

Dekel

Parents
  • Thanks for your patience, Dekel.

    Please the attached file. As you know, adding ACL link affects the LE audio performance directly. so you can tune the related parameters number of retransmissions, bitrate, advertising interval and so on. For better performance, you should tune the numbers accordingly. 

       

    Best regards,

    BrianModifiedFiles.7z

  • Hi Brian,

    I tried to run the code you've shared as it is. When trying to connect to the gateway unit with my iPhone, either through nRF connect for mobile or nRF Toolbox, it doesn't succeed.

    I receive the error of BT_HCI_ERR_CONN_FAIL_TO_ESTAB and the unit constantly connects and disconnects from the iPhone:

    I'll mention that there's no I2S audio source connected to the gateway unit and also there's no headset unit around it. That's in order to avoid interference.

    I tried to manipulate prj.conf, but with no success.

    I would appreciate your help.

    Thanks,

    Dekel

  • Hello Dekel,

    I see the error code 0x0E, which is BT_HCI_ERR_INSUFFICIENT_SECURITY.

    I guess the bonding information on the phone side might have trouble. Would you try it again after erasing it on the phone side?

    //Brian

  • Hi Brian,

    The unit wasn't bonded with my Android phone, therefore there's nothing to erase.

    I'll mention that compiling the code you've provided out-of-the-box fails on my PC:

    That's probably due to prj.conf. When I replace it with another file it compiles without issues: 28130.prj.conf

    The attached file is a combination of your prj.conf and another prj.conf, which suits the scenario of using the headset unit as ACL central.

    Can you please take a look on that?

  • Hello Dekel,

    I verified it all from scratch on NCS2.6.0 and confirmed it's built without any errors.

    are you sure that you modified all the files as below?

    -. applications/nrf5340_audio/broadcast_source/main.c
    -. applications/nrf5340_audio/child_image/hci_ipc.conf
    -. applications/nrf5340_audio/prj.conf
    -. applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.c

    And please make sure it should be built with pristine option(--pristine) when you build again.

    //Brian

  • Hi Brian,

    In order to test the Android functionality properly, I've cloned the sdk-nrf to my PC and switched to the "v2.6.0" tag. As a sanity check, I've built it as is using the original buildprog.py (with --pristine). It worked well.

    The next thing I did was replacing the 4 files you've mentioned above and then using buildprog again. It was built & flashed successfully to 2 units (one headset and one gateway).

    I'm able to stream audio through the gateway unit and receive it on the headset unit, but when I try to connect to the NUS advertisment with an Android smartphone, I get this error (BT_HCI_ERR_CONN_FAIL_TO_ESTAB):

    I've tried multiple times, both with nRF Connect For Mobile and nRF Toolbox apps. Furthermore, my Android's bonding list is empty.

    I would appreciate your help with this.

    In addition, I'd appreciate an update regarding the iOS communication. Our project will include both Android and iPhone support.

    Thank you,

    Dekel

  • Hello Dekel,

    Thanks for your update.

    Dekel said:
    I'm able to stream audio through the gateway unit and receive it on the headset unit, but when I try to connect to the NUS advertisment with an Android smartphone, I get this error (BT_HCI_ERR_CONN_FAIL_TO_ESTAB):

    Can you share the binary(merged-domains.hex) of the gateway? I will try it on my side to check. And also, can you tell me what Android model you are testing?

    Dekel said:
    In addition, I'd appreciate an update regarding the iOS communication. Our project will include both Android and iPhone support.

    I believe iOS seems to have trouble with ADV-EXT for connection(NUS). We keep on eye on their response or guide. 

    Thank you,

    Brian

     

Reply
  • Hello Dekel,

    Thanks for your update.

    Dekel said:
    I'm able to stream audio through the gateway unit and receive it on the headset unit, but when I try to connect to the NUS advertisment with an Android smartphone, I get this error (BT_HCI_ERR_CONN_FAIL_TO_ESTAB):

    Can you share the binary(merged-domains.hex) of the gateway? I will try it on my side to check. And also, can you tell me what Android model you are testing?

    Dekel said:
    In addition, I'd appreciate an update regarding the iOS communication. Our project will include both Android and iPhone support.

    I believe iOS seems to have trouble with ADV-EXT for connection(NUS). We keep on eye on their response or guide. 

    Thank you,

    Brian

     

Children
  • Hi Brian,

    thanks for the quick response!

    Can you share the binary(merged-domains.hex) of the gateway?

    Coudln't find such file. Here's my build folder: 5822.build.rar

    can you tell me what Android model you are testing?

    Samsung Galaxy A03s, Android version 13.

    I believe iOS seems to have trouble with ADV-EXT for connection(NUS). We keep on eye on their response or guide. 

    Do you think it will be possible to connect with iOS?

    Thank you,

    Dekel

  • Dekel said:
    Coudln't find such file. Here's my build folder: 5822.build.rar

    It didn't work on my side either, but it was different error(BT_HCI_ERR_CONN_TIMEOUT : 0x08).  Please find the attached my binary and try it on your side. You can just drag & drop and program it using nRF Programmer tool.

    Dekel said:
    Samsung Galaxy A03s, Android version 13.

    On my side, the test device is Pixel 6, Android version 14.

    Dekel said:
    Do you think it will be possible to connect with iOS?

    We've been talking to the team and I will keep you updated. At the worst case, we can advertise with legacy ADV for the connection and that should work without issues.

    2337.merged_domains_BK.zip

    Best regards,

    Brian

  • Please find the attached my binary and try it on your side. You can just drag & drop and program it using nRF Programmer tool.

    I did just that - still receive the same error (BT_HCI_ERR_CONN_FAIL_TO_ESTAB).

    At the worst case, we can advertise with legacy ADV for the connection and that should work without issues.

    Sounds like the legacy ADV could be an adequate solution for the Android as well, isn't it?

  • Dekel said:
    I did just that - still receive the same error (BT_HCI_ERR_CONN_FAIL_TO_ESTAB).

    It looks like QoS issue. You should find the optimized parameters tweaking them for your device. This information should be useful to figure out proper number of the parameters.

    Dekel said:
    Sounds like the legacy ADV could be an adequate solution for the Android as well, isn't it?

    For iOS, if Apple doesn't change anything about this issue, that could be an alternatives. For Android, as I said above, this would be more of QoS timing issue rather than ADV-EXT, but it's worth a shot.

  • Thanks for the info.

    You should find the optimized parameters tweaking them for your device.

    Interestingly, when trying to connect with another smartphone, running Android 12, everything works well using your original code! That's awesome. I'm able to communicate through nRF Toolbox app and even send data from the device back to the smartphone (with a small code modification).

    Therefore, I assume that's something about the smartphone I've been using. I'll try with a few more devices to get better statistics.

    For iOS, if Apple doesn't change anything about this issue, that could be an alternatives. For Android, as I said above, this would be more of QoS timing issue rather than ADV-EXT, but it's worth a shot.

    Is it complicated to implement the legacy ADV? If it's relatively simple and you assume it should work without issues, I prefer proceeding in that direction in order to make progress. I'd really appreciate your guidance with that.

Related