I am not able to scan the advertisement from my unicast sink into the NRF5340 unicast Gate way application

Hello,

I am using nrf5340 Audio DK board. In that board I have flashed a sample firmware of Unicast Gateway.

This firmware is suppose to scan the advertisement and establish the connection. I have my own unicast headset which advertise. I am not able to see the scan result in NRF5340 gateway application. 

I need help here, what changes I need to make in NRF5340 gateway application so that it will able to scan and connect with my unicast headset?

Best Regards,

Sanket C

Parents
  • Hi Sanket,

    By default the gateway will search for devices named "NRF5340_AUDIO". This is set in the scan parameters for the Unicast Client and the code is found here. If you change the name to an empty string or the name your Unicast headset is advertising with, your gateways should find the advertisements.

    Best regards,

    Maria

  • Thank you Maria for the help. I could able to scan my device with NRF5340 but now I stuck with below error:

    GW [00:00:58.046,081] <inf> bt_mgmt_scan: Scanning successfully started
    GW [00:00:58.134,460] <inf> bt_mgmt_scan: Creating connection to device: 43:82:A1:00:1F:AC (public)
    GW [00:00:58.134,552] <wrn> bt_conn: Found valid connection (0x20004538) with address 43:82:A1:00:1F:AC (public) in connected state
    GW [00:00:58.134,552] <err> bt_mgmt_scan: Could not init connection
    GW [00:00:58.135,650] <inf> bt_mgmt_scan: Local addr: 42:1F:1C:C1:47:DB (random). May time out. Updates not printed
    GW [00:00:58.135,650] <inf> bt_mgmt_scan: Scanning successfully started

    I am getting repeated error as above. What extra action I need to take here? Please suggest here.

    Best Regards,

    Sanket Chadawar

  • Hello Team,

    I upgraded the NRF COnnect SDK to 2.7.0 and now I am not able to do the same as per previous comments.

    When I try to modify the  here. I observed that it is not a part of the build (I intentionally inserted the build error) and post that also I the build is passed.

    Please guide me.

    Also I am not able to see the adv from the gate way device in my mobile phone  (earlier version I used to see it in the mobile BT scanner)?

Reply
  • Hello Team,

    I upgraded the NRF COnnect SDK to 2.7.0 and now I am not able to do the same as per previous comments.

    When I try to modify the  here. I observed that it is not a part of the build (I intentionally inserted the build error) and post that also I the build is passed.

    Please guide me.

    Also I am not able to see the adv from the gate way device in my mobile phone  (earlier version I used to see it in the mobile BT scanner)?

Children
  • Hello,

    sanket_cha said:
    I upgraded the NRF COnnect SDK to 2.7.0 and now I am not able to do the same as per previous comments.

    Do I understand correctly that you were able to make the connection work when deleting bonding information on reboot? Are you getting identical error logs? Please share the new logs if they are different.

    When you upgraded to NCS v2.7.0, did you build and flash both the app and network core?

    sanket_cha said:
    Also I am not able to see the adv from the gate way device in my mobile phone  (earlier version I used to see it in the mobile BT scanner)?

    The unicast gateway configuration of the audio application will scan, not advertise. The broadcast source configuration will advertise.

    Best regards,

    Maria

  • Hello Maria,

    Do I understand correctly that you were able to make the connection work when deleting bonding information on reboot? Are you getting identical error logs? Please share the new logs if they are different.

    [SC]: Yes, default example (without changing any thing) I am able to connect the Unicast client and server to each other and get the audio.

    But my point is (please forgive me I mentioned wrongly in my previous comment). One device shall adv and another device shall scan. But the device which is adv I am not able to see the adv in the mobile phone (when I turn on the BT scan of the mobile phone-- earlier I used to see the adv in mobile bt name NRF5340_AUDIO). Please note that I kept scanner device OFF at this point and deleted the bonding. 

    Note: As I am not able to see the logs using the serial port so I am not sure what is happening inside.

    My question here is how to see the adv ifrom the advertiser (unicast sink ) in the mobile phone? 

     

    When you upgraded to NCS v2.7.0, did you build and flash both the app and network core?

    Yes I build and flashed both (because I can hear the audio played using the usb of one device and listen to the another device using the Headphone jack)

    Also when I try to modify any thing from the scanner (as I want to adv from my device with some other name so I replaced CONFIG_BT_DEVICE_NAME  in https://github.com/nrfconnect/sdk-nrf/blob/v2.6.0/applications/nrf5340_audio/unicast_client/main.c#L501) and also intentionally added some extra charat after the ; and observed that my west build is still passing and not giving any error

    So I think that the file is not a part of the bulild. 

    Please guide me here to modify the code so that from Gateway (unicast client) I can modify and make it able to scan any other keyword.

  • Hello,

    I have tried to reproduce the issue, but so far I am not having any issues with scanning for the advertisements. This is my method:

    • Add
      config BT_DEVICE_NAME
      default "CUSTOM_AUDIO"
      to nrf5340_audio/unicast_server/Kconfig.defaults
    • Change https://github.com/nrfconnect/sdk-nrf/blob/v2.7.0/applications/nrf5340_audio/unicast_client/main.c#L571-L572 to
      ret = bt_mgmt_scan_start(0, 0, BT_MGMT_SCAN_TYPE_CONN, "CUSTOM_AUDIO",
      BRDCAST_ID_NOT_USED);
    • Build and flash the application with
      python .\tools\buildprog\buildprog.py -c both -d both -b debug --pristine -p -f
       from the nrf5340_audio directory.
    • Observe that the headset connects to the gateway.
      • Gateway:
        *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
        *** Using Zephyr OS v3.6.99-100befc70c74 ***
        GW [00:00:00.286,407] <inf> board_version: Compatible board/HW version found: 1.0.0
        GW [00:00:00.311,279] <inf> fw_info: 
                 nRF5340 Audio nRF5340 Audio DK cpuapp                      
                 NCS base version: 2.7.0                            
                 Cmake run : Wed Aug 28 12:45:47 2024
        GW [00:00:00.311,279] <inf> fw_info: ------- DEBUG BUILD -------
        GW [00:00:00.311,279] <inf> fw_info: Compiled for GATEWAY device
        GW [00:00:00.382,049] <inf> bt_mgmt: Clearing all bonds
        GW [00:00:00.384,185] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8699
        GW [00:00:00.384,399] <inf> bt_mgmt: Local identity addr: D1:D9:6F:57:FD:47 (random)
        GW [00:00:00.384,521] <inf> audio_usb: Ready for USB host to send/receive.
        GW [00:00:00.388,214] <inf> bt_mgmt_scan: Local addr: 41:89:24:EC:49:9B (random). May time out. Updates not printed
        GW [00:00:00.388,214] <inf> bt_mgmt_scan: Scanning successfully started
        GW [00:00:00.430,816] <inf> bt_mgmt_scan: Creating connection to device: 72:09:F8:5D:C1:CB (random)
        GW [00:00:00.536,315] <inf> bt_mgmt: Connected: 72:09:F8:5D:C1:CB (random)
        GW [00:00:00.536,346] <inf> main: Connection event. Num connections: 1
        GW [00:00:00.768,829] <inf> main: Security changed
        GW [00:00:00.805,633] <wrn> bt_vol_ctlr: Failed to mute for remote channel 0, ret = -22
        GW [00:00:00.958,862] <inf> bt_vol_ctlr: VCS discover finished
        GW [00:00:01.328,918] <inf> main: Set members found: 1 of 2
        GW [00:00:01.329,925] <inf> bt_mgmt_scan: Local addr: 41:89:24:EC:49:9B (random). May time out. Updates not printed
        GW [00:00:01.329,956] <inf> bt_mgmt_scan: Scanning successfully started
        GW [00:00:01.628,753] <inf> unicast_client: Discovered 1 sink endpoint(s) for device 0
        GW [00:00:01.649,871] <inf> unicast_client: LEFT sink stream configured
        GW [00:00:01.649,902] <inf> le_audio: LC3 codec config for sink:
        GW [00:00:01.649,902] <inf> le_audio:   Frequency: 48000 Hz
        GW [00:00:01.649,902] <inf> le_audio:   Duration: 10000 us
        GW [00:00:01.649,902] <inf> le_audio:   Channel allocation: 0x1
        GW [00:00:01.649,932] <inf> le_audio:   Octets per frame: 120 (96000 bps)
        GW [00:00:01.649,932] <inf> le_audio:   Frames per SDU: 1
        GW [00:00:02.088,714] <inf> unicast_client: Stream 0x20011cb4 started
      • Headset:
        *** Booting nRF Connect SDK v2.7.0-5cb85570ca43 ***
        *** Using Zephyr OS v3.6.99-100befc70c74 ***
        HL [00:00:00.296,813] <inf> board_version: Compatible board/HW version found: 1.0.0
        HL [00:00:00.321,899] <inf> fw_info: 
                 nRF5340 Audio nRF5340 Audio DK cpuapp                      
                 NCS base version: 2.7.0                            
                 Cmake run : Wed Aug 28 12:38:28 2024
        HL [00:00:00.321,899] <inf> fw_info: ------- DEBUG BUILD -------
        HL [00:00:00.321,929] <inf> fw_info: HEADSET left device
        HL [00:00:00.393,280] <inf> bt_mgmt: Clearing all bonds
        HL [00:00:00.395,507] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8699
        HL [00:00:00.395,721] <inf> bt_mgmt: Local identity addr: D8:E2:87:FA:ED:CB (random)
        HL [00:00:00.424,499] <wrn> unicast_server: CSIP using the default SIRK, must be changed before production
        HL [00:00:00.428,131] <inf> bt_mgmt_adv: Local addr: 72:09:F8:5D:C1:CB (random)
        HL [00:00:00.428,649] <inf> bt_mgmt_adv: Advertising successfully started
        HL [00:00:00.543,853] <inf> bt_mgmt: Connected: 41:89:24:EC:49:9B (random)
        HL [00:00:00.543,914] <inf> main: Connection event. Num connections: 1
        HL [00:00:00.776,184] <inf> main: Security changed
        HL [00:00:00.849,792] <inf> bt_vol_rend: Volume = 195, mute state = 1
        HL [00:00:01.266,235] <inf> bt_content_ctrl_media: Discovery of MCS finished
        HL [00:00:01.646,423] <inf> le_audio: LC3 codec config for sink:
        HL [00:00:01.646,423] <inf> le_audio:   Frequency: 48000 Hz
        HL [00:00:01.646,423] <inf> le_audio:   Duration: 10000 us
        HL [00:00:01.646,453] <inf> le_audio:   Channel allocation: 0x1
        HL [00:00:01.646,453] <inf> le_audio:   Octets per frame: 120 (96000 bps)
        HL [00:00:01.646,453] <inf> le_audio:   Frames per SDU: 1
        HL [00:00:01.666,412] <inf> main: Presentation delay 3000 us is set by initiator
        HL [00:00:02.012,542] <inf> unicast_server: Stream 0x20010a18 started
        HL [00:00:02.013,580] <wrn> le_audio_rx: Not in streaming state (1), thrown 1 packet(s)
        HL [00:00:02.025,512] <wrn> audio_datapath: Data received, total under-runs: 1
    • Turn off the gateway and reset the Headset with deleted bonding information.
    • Use the nRF Connect for Android app (v4.28.1) on a Pixel 7 Pro (Android 14) to scan for the headset advertisements.
      • Verify that the advertisements are successfully scanned by the phone:

    Please let me know if I am missing any details in my method.

    Best regards,

    Maria

  • Hello Maria,

    Thank you for the detail. I will go through it and try it. 

    Shall get back to you once I have any update.

    Best Regards,

    Sanket Chadawar

Related