nRF5340 Audio DK: LE Audio and UART2 Concurrently

Hi,

I have problems with the nRF5340 Audio DK to get LE Audio and UART2 concurrently on the same CIS stream to work.

GOAL

Use 2 x nRF5340 Audio DKs to transfer audio both directions via Line IN and at the same time send UART2 data from and to the 2 kits concurrently.  Exactly like the Walkie-Talkie demo but with LINE IN instead of Microphone.  And the UART must be a physical one and UART2 was chosen with a UART/RS232 converter.  So full duplex audio and serial data.

What I did so far

I did manage to modify the Application "<Path to ncs folder>\v2.2.0\nrf\applications\nrf5340_audio" to work with the LINE IN port. See my Forum post:
nRF5340 Audio DK: Walkie Talkie Demo - LINE IN instead of MIC

I also managed to modify both these samples to work with UART2 instead of the CDC Com port UART0.  I used the 2 Samples "Central UART" and "Peripheral UART". See my Forum post:

 Central and Peripheral UART Samples on UART2 - nRF5340 Audio DK 

Then I created a third Project with 2 applications that I want to combine the 2 projects. However, I only manage to get the "GATEWAY" paired with the NUS Server to work. But on the HEADSET side I can't get the NUS Client to work.  I tested the combined GATEWAY and NUS Server (Peripheral UART) with a HEADSET only and with the NUS Client (Central UART). That is why I know the GATEWAY/NUS Server side works.

The Audio still works but I cannot receive or sent serial data on the NUS client side which is on the HEADSET application side.

Application

We need to transfer Audio and Data in a full duplex Intercom system over a short distance because the wiring of an audio and data line is not possible due to moving parts.

Could you please help me combine the 4 projects into 2 please?  Is concurrent UART and LE Audio even possible?

Kind Regards

  • Hi, 

    Which version of NCS are you using?

    Do you test the HEADSET merged with the NUS client and Peripheral UART sample?

    Could you provide the output log on both sides and the sniffer log?

    Regards,
    Amanda H.

  • Hi Amanda,

    2.2.0.   (Was using 2.3.0 originally but had a problem earlier with the board so I went one version down. )

    I tried both (first Central and lastly Peripheral) with the HEADSET, currently Peripheral UART on the HS.

    I do not have a 3rd device that can run the sniffer application.

    I am having issues with the logging because of the UART2 change.  Here is my log, I had to add a lot of printk() lines to log to UART0:

    *** Booting Zephyr OS build v3.2.99-ncs1 ***

    InitLEAudio()

    nRF5340 APP core started

    bt_dev.drv

    atomic_clear_bit

    atomic_test_and_set_bit

    bt_settings_init

    bt_monitor_send

    k_work_submit

    LE Audio Setup Done.



    InitUART2()

    Starting Bluetooth Central UART example

    bt_conn_auth_cb_register

    bt_conn_auth_info_cb_register

    Bluetooth initialized

    settings_load

    module_init

    Scan module initialized

    Scanning successfully started

    UART2 Setup Done.





    *** In ble_write_thread ***

    * Entering Loop *

    Failed to send data over BLE connection(err -128)

    NUS send timeout

    Thank you

    Fritz

  • fweinrebe said:
    Failed to send data over BLE connection(err -128)

    Error -128 means that Socket is not connected. 

    Please make sure Central and Peripheral UART are connected. 

    -Amanda H. 
  • Amanda Hsieh said:
    Please make sure Central and Peripheral UART are connected. 

    If I knew how to I would not have asked for help.

    I have disabled the code because it creates another problem:

        // printk("  bt_enable.\n");
        // err = bt_enable(NULL);
        // if (err)
        // {
        //  printk("Failed to Enable UART service (err: %d)", err);
        //  error();
        // }

    If I disable the LE Audio code and uncomment the code "bt_enable(NULL);" then it works. But If I enable the LE Audio code again, then It doesn't work anymore.

        printk("  bt_enable\n");
        err = bt_enable(NULL);
        if (err)
        {
            printk("Bluetooth init failed (err %d)", err);
            LOG_ERR("Bluetooth init failed (err %d)", err);
            return;
        }

    *** Booting Zephyr OS build v3.2.99-ncs1 ***

    InitLEAudio()

    nRF5340 APP core started

    bt_dev.drv

    atomic_clear_bit

    atomic_test_and_set_bit

    bt_settings_init

    bt_monitor_send

    k_work_submit

    LE Audio Setup Done.



    InitUART2()

    Starting Bluetooth Central UART example

    bt_conn_auth_cb_register

    bt_conn_auth_info_cb_register

    bt_enable

    bt_dev.drv

    atomic_clear_bit

    atomic_test_and_set_bit

    Bluetooth init failed (err -120)

    *** In ble_write_thread ***

    Some further testing here is a log with more detail:


    *** Booting Zephyr OS build v3.2.99-ncs1 ***

    InitLEAudio()

    nRF5340 APP core started

    bt_dev.drv

    atomic_clear_bit

    atomic_test_and_set_bit

    bt_settings_init

    bt_monitor_send

    k_work_submit

    LE Audio Setup Done.



    InitUART2()

    Starting Bluetooth Central UART example

    bt_conn_auth_cb_register

    bt_conn_auth_info_cb_register



    Bluetooth initialized

    settings_load

    module_init

    uart_init

    UART device is ready

    Scan module initialized

    NUS Client module initialized

    Scanning

    Scanning successfully started

    UART2 Setup Done.



    Filters matched. Address: FC:55:67:78:B1:1F (random) connectable: 1

    Connecting failed

    connected

    bt_addr_le_to_str

    Connected: FC:55:67:78:B1:1F (random)



    *** In ble_write_thread ***

    * Entering Loop *

    bt_addr_le_to_str

    Security changed: FC:55:67:78:B1:1F (random) level 2

    gatt_discover

    MTU exchange done


    Isn't the Init error related to there being already a LE Audio stream going and BT is already initialized and connected?
  • yes, err -120 means Operation is already in progress. 

    From the second part of the log, it seems you fix the issue, right? There is no error in the second part of the ble_write_thread

    -Amanda H.

Related