LE Audio device as central and peripheral simultaneously

My question is related to LE Audio, i guess, since i have no previous experience from it. Is it possible to have a device as a peripheral for mobile phone sending data to some characteristics and same time as a central to another nRF5340 streaming LE Audio (CIS)?

Device A and B are nRF5340. Device A generating and streaming audio to device B. Audio stream could be e.g. a mic(s) or line(s) in. There is no audio stream from device A to mobile phone. Also device A is generating and sending data to a mobile phone. Data could be e.g. temp, status, voltage etc.

I'm just wondering for example how much resources this LE Audio (CIS) takes.

Parents
  • Hello,

    i guess, since i have no previous experience from it.

    Thank you for clarifying, this is very helpful for us to know when answering the remaining questions! :) 

    Is it possible to have a device as a peripheral for mobile phone sending data to some characteristics and same time as a central to another nRF5340 streaming LE Audio (CIS)?

    Yes, that is indeed possible - the 'ACL' which runs alongside the CIS to control the stream is actually nothing more than a regular BLE connection as you already know it.
    There is currently a limitation of concurrently supporting 2 ISO + 2 ACLs, but so long as you are within this you should be fine. Essentially, you may indeed act as a gateway to another nRF5340 Headset device, and concurrently work as a peripheral to a connected smartphone (regular BLE connection).

    I'm just wondering for example how much resources this LE Audio (CIS) takes.

    The largest swath of resources are used for the LC3 encoding, and the rule of thumb there is that it will consume roughly ~30% CPU to encode a 96 kbps stream, and ~16% to decode the same stream.

    Please do not hesitate to ask if you should have any follow-up questions to this! :) 

    Best regards,
    Karl

  • How would one go on about creating this kind of firmware?

    I am planning on buying few nRF5340 Audio DK's to first play around with the Connect SDK's LE Audio examples. I know there is in the Connect SDK a Central and Peripheral HRS -example and a nRF5340 Audio Application. Could this functionality be achieved by the help of these examples or is there some compatibility issues?

    Thank you!

  • No worries, we can resume this whenever you get a chance or would like to.

    You are correct that you can call bt_gatt_service_register multiple times, so that should not cause any issue itself, but it could be a symptom of something else being wrong in the code.
    Please share more of the project or changes that you have made if you would like us to take a closer look at what might be going on here.

    Best regards,
    Karl

  • Hello,

    i added the NUS service to the nrf5340_audio example act as Gateway. I also can connect to the device using NRFConnect application, but no services or characteristics appear on the NrfConnect app.

    if i comment 1.mcs service in line 726 and reflash the Gateway, the NUS service appear on NrfConnect app. any suggestion?

    nrf5340_audio_01.zip

    In the fuction bt_mcs_init() located in  \v2.6.0\zephyr\subsys\bluetooth\audio\mcs.c
    when i comment  bt_gatt_service_register(&mcs), the nrfconnect app could show the NUS services.

    Is it MCS service take too much room which cause the NUS service can not be registered?
  • Hello,

    Thank you for your patience with this.

    MaxLi said:
    Is it MCS service take too much room which cause the NUS service can not be registered?

    This should not be a problem, no.
    Do you receive an error message from the bt_nus_init call when MCS is already initialized?
    I think the sequencing here could be the issue, as described in the bt_gatt_service_register API reference documentation.

    Best regards,
    Karl

  • it seems bt_nus_init() only register callback and  return 0 directly. nus service was static register with marco BT_GATT_SERVICE_DEFINE.

    the mcs service was registed with bt_gatt_service_register() fuction in line 1348 of  .

    my question is whether static and dynamic registration of services can coexist?



  • Hello,

    MaxLi said:
    it seems bt_nus_init() only register callback and  return 0 directly. nus service was static register with marco BT_GATT_SERVICE_DEFINE.

    Have you also added the nus files and kconfigs to your project?

    MaxLi said:
    my question is whether static and dynamic registration of services can coexist?

    Yes, you my have static and dynamic registration of services in your application.
    You will just need to make sure that your call to bt_gatt_service_register for the dynamic part does not violated the sequence order as described in the API reference documentation.
    If you do dynamically change your services you will also need to use the 'services changed' service to alert a peer that it needs to do a new discovery (since all services and characteristics are discovered and cached upon connection).

    Best regards,
    Karl

Reply
  • Hello,

    MaxLi said:
    it seems bt_nus_init() only register callback and  return 0 directly. nus service was static register with marco BT_GATT_SERVICE_DEFINE.

    Have you also added the nus files and kconfigs to your project?

    MaxLi said:
    my question is whether static and dynamic registration of services can coexist?

    Yes, you my have static and dynamic registration of services in your application.
    You will just need to make sure that your call to bt_gatt_service_register for the dynamic part does not violated the sequence order as described in the API reference documentation.
    If you do dynamically change your services you will also need to use the 'services changed' service to alert a peer that it needs to do a new discovery (since all services and characteristics are discovered and cached upon connection).

    Best regards,
    Karl

Children
No Data
Related