Issue with Stereo Sound from External Codec on nRF5340 DK (SDK v2.6.2)

Hello Team,

I am experiencing an issue with the sound output from an external codec connected to the nRF5340 DK. Currently, the sound is in mono, but my goal is to achieve stereo sound for both the left and right channels.

I read in an article that the configuration may need to be edited to enable stereo output from the external codec. I am using SDK v2.6.2 and would appreciate any guidance or suggestions on how to adjust the configuration to resolve this issue.

Thank you for your support!

Regards,

Abdulmohaimen Algamoudi

Parents Reply Children
  • Hi,

    You could have a look at these potentially relevant discussions - stereo output using external codec and stream multiple stereo audio. If these links do not provide you with relevant information and that is not what you try to achieve, please provide more information about your use case.

    Best regards,
    Dejan

  • Hi, 

    Thanks for you support. 

    I'm still having issues with the application. I followed the steps in this articel, but once the Bluetooth connection starts, an error occurs, this is what i can read from the serial port:

    *** Booting nRF Connect SDK v3.5.99-ncs1-2 ***
    HL [00:00:00.270,782] <inf> board_version: Compatible board/HW version found: 1.0.0
    HL [00:00:00.296,264] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.6.2                            
             Cmake run : Wed Oct 16 05:48:09 2024
    HL [00:00:00.296,264] <inf> fw_info: ------- DEBUG BUILD -------
    HL [00:00:00.296,295] <inf> fw_info: HEADSET left device
    HL [00:00:00.316,284] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8591
    HL [00:00:00.316,497] <inf> bt_mgmt: Local identity addr: F0:D2:8E:F5:33:C2 (random)
    HL [00:00:00.321,716] <inf> bt_mgmt_adv: Local addr: 75:BB:5D:CD:F8:B7 (random)
    HL [00:00:00.321,807] <inf> bt_mgmt_adv: Adv directed to: D3:C8:9D:D1:BE:66 (random).
    HL [00:00:00.322,418] <inf> bt_mgmt_adv: Advertising successfully started
    HL [00:00:00.795,715] <inf> bt_mgmt: Connected: D3:C8:9D:D1:BE:66 (random)
    HL [00:00:00.795,745] <inf> main: Connected
    HL [00:00:00.796,142] <inf> bt_mgmt_adv: RPA (Resolvable Private Address) expired.
    HL [00:00:00.796,234] <inf> bt_mgmt_adv: Local addr: 75:BB:5D:CD:F8:B7 (random)
    HL [00:00:01.036,132] <inf> main: Security changed
    HL [00:00:01.036,407] <wrn> bt_gatt: Device is not subscribed to characteristic
    HL [00:00:01.036,407] <wrn> bt_pacs: PACS notify failed: -22
    HL [00:00:03.036,743] <inf> bt_content_ctrl_media: Discovery of MCS finished
    HL [00:00:05.196,624] <inf> unicast_server: LC3 codec config for sink:
    HL [00:00:05.196,655] <inf> unicast_server:     Frequency: 24000 Hz
    HL [00:00:05.196,655] <inf> unicast_server:     Duration: 10000 us
    HL [00:00:05.196,655] <inf> unicast_server:     Channel allocation: 0x1
    HL [00:00:05.196,655] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HL [00:00:05.196,655] <inf> unicast_server:     Frames per SDU: 1
    HL [00:00:05.198,211] <inf> unicast_server: LC3 codec config for source:
    HL [00:00:05.198,242] <inf> unicast_server:     Frequency: 24000 Hz
    HL [00:00:05.198,242] <inf> unicast_server:     Duration: 10000 us
    HL [00:00:05.198,242] <inf> unicast_server:     Channel allocation: 0x1
    HL [00:00:05.198,242] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HL [00:00:05.198,242] <inf> unicast_server:     Frames per SDU: 1
    HL [00:00:05.277,343] <inf> main: Presentation delay 10000 us is set by initiator
    HL [00:00:05.277,374] <inf> main: Presentation delay 10000 us is set by initiator
    HL [00:00:05.562,866] <inf> unicast_server: Stream 0x2000fbfc started
    HL [00:00:05.567,749] <err> sw_codec_lc3: LC3 dec ch: 1 already initialized
    HL [00:00:05.567,749] <err> audio_system: Failed to set up codec
    HL [00:00:05.567,749] <err> audio_system: ERR_CHK Err_code: [-120] @ line: 398
    HL [00:00:05.567,779] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000004  r2/a3:  0x00000003
    HL [00:00:05.567,779] <err> os: r3/a4:  0x0005914f r12/ip:  0x20002b00 r14/lr:  0x000591d9
    HL [00:00:05.567,779] <err> os:  xpsr:  0x41100000
    HL [00:00:05.567,779] <err> os: s[ 0]:  0x20001530  s[ 1]:  0x00059373  s[ 2]:  0xffffff88  s[ 3]:  0x00000004
    HL [00:00:05.567,810] <err> os: s[ 4]:  0x200128a0  s[ 5]:  0x20012880  s[ 6]:  0xffffff88  s[ 7]:  0x20012880
    HL [00:00:05.567,810] <err> os: s[ 8]:  0x200128a0  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x000593bf
    HL [00:00:05.567,840] <err> os: s[12]:  0x20004a88  s[13]:  0x00069b3c  s[14]:  0xffffff88  s[15]:  0x0000018e
    HL [00:00:05.567,840] <err> os: fpscr:  0x00000000
    HL [00:00:05.567,840] <err> os: Faulting instruction address (r15/pc): 0x00004536
    HL [00:00:05.567,840] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    HL [00:00:05.567,871] <err> os: Current thread: 0x20001de8 (LE_AUDIO_MSG_SUB)
    HL [00:00:05.567,871] <err> error_handler: Caught system error -- reason 3. Entering infinite loop

    My goal is to implement walkie-talkie functionality with stereo sound using an external codec (with on microphones).

    Could you assist me with this?

    Thanks in Advance 

    Best regards,

    Abdulmohaimen

  • Hi Abdulmohaimen,

    If your server needs to decode 2 channels, please try adding Kconfig option - CONFIG_LC3_DEC_CHAN_MAX=2.

    Best regards,
    Dejan

  • Hi Dejen,

    I have added the necessary Kconfig option to the prj.conf file. However, once the Bluetooth connection starts, the following error occurs:

    *** Booting nRF Connect SDK v3.5.99-ncs1-2 ***
    HL [00:00:00.272,918] <inf> board_version: Compatible board/HW version found: 1.0.0
    HL [00:00:00.298,614] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.6.2                            
             Cmake run : Sun Oct 20 17:27:13 2024
    HL [00:00:00.298,614] <inf> fw_info: ------- DEBUG BUILD -------
    HL [00:00:00.298,614] <inf> fw_info: HEADSET left device
    HL [00:00:00.318,389] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8591
    HL [00:00:00.318,572] <inf> bt_mgmt: Local identity addr: F0:D2:8E:F5:33:C2 (random)
    HL [00:00:00.323,944] <inf> bt_mgmt_adv: Local addr: 4B:F2:BB:74:22:A1 (random)
    HL [00:00:00.324,035] <inf> bt_mgmt_adv: Adv directed to: D3:C8:9D:D1:BE:66 (random).
    HL [00:00:00.324,645] <inf> bt_mgmt_adv: Advertising successfully started
    HL [00:00:00.782,989] <inf> bt_mgmt: Connected: D3:C8:9D:D1:BE:66 (random)
    HL [00:00:00.783,020] <inf> main: Connected
    HL [00:00:00.783,569] <inf> bt_mgmt_adv: RPA (Resolvable Private Address) expired.
    HL [00:00:00.783,660] <inf> bt_mgmt_adv: Local addr: 4B:F2:BB:74:22:A1 (random)
    HL [00:00:01.063,781] <inf> main: Security changed
    HL [00:00:01.064,025] <wrn> bt_gatt: Device is not subscribed to characteristic
    HL [00:00:01.064,025] <wrn> bt_pacs: PACS notify failed: -22
    HL [00:00:02.984,405] <inf> bt_content_ctrl_media: Discovery of MCS finished
    HL [00:00:04.904,266] <inf> unicast_server: LC3 codec config for sink:
    HL [00:00:04.904,296] <inf> unicast_server:     Frequency: 24000 Hz
    HL [00:00:04.904,296] <inf> unicast_server:     Duration: 10000 us
    HL [00:00:04.904,296] <inf> unicast_server:     Channel allocation: 0x1
    HL [00:00:04.904,296] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HL [00:00:04.904,296] <inf> unicast_server:     Frames per SDU: 1
    HL [00:00:04.905,883] <inf> unicast_server: LC3 codec config for source:
    HL [00:00:04.905,883] <inf> unicast_server:     Frequency: 24000 Hz
    HL [00:00:04.905,883] <inf> unicast_server:     Duration: 10000 us
    HL [00:00:04.905,883] <inf> unicast_server:     Channel allocation: 0x1
    HL [00:00:04.905,914] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HL [00:00:04.905,914] <inf> unicast_server:     Frames per SDU: 1
    HL [00:00:04.984,985] <inf> main: Presentation delay 10000 us is set by initiator
    HL [00:00:04.985,015] <inf> main: Presentation delay 10000 us is set by initiator
    HL [00:00:05.270,507] <inf> unicast_server: Stream 0x2000fbf8 started
    DAC L gain 112   
    DAC R gain 112   
    HL [00:00:05.281,433] <wrn> le_audio_rx: Not in streaming state, throwing data: 1
    HL [00:00:05.295,318] <wrn> audio_datapath: Data received, total under-runs: 6
    HL [00:00:05.296,325] <wrn> audio_datapath: I2S RX overrun. Single msg
    HL [00:00:05.303,680] <inf> unicast_server: Stream 0x2000fc1c started
    HL [00:00:05.306,304] <wrn> audio_datapath: I2S RX continuing stream
    HL [00:00:05.307,739] <err> sw_codec_select: Unsupported channel mode for encoder: 0
    HL [00:00:05.307,739] <err> audio_system: Encode failed
    HL [00:00:05.307,739] <err> audio_system: ERR_CHK Err_code: [-19] @ line: 172
    HL [00:00:05.307,769] <err> os: r0/a1:  0x00000003  r1/a2:  0x0000000b  r2/a3:  0x0000000a
    HL [00:00:05.307,769] <err> os: r3/a4:  0x0005901d r12/ip:  0x20002bd0 r14/lr:  0x000590a7
    HL [00:00:05.307,769] <err> os:  xpsr:  0x61000000
    HL [00:00:05.307,769] <err> os: s[ 0]:  0x000000ac  s[ 1]:  0xffff0200  s[ 2]:  0xaaaa0200  s[ 3]:  0x01000003
    HL [00:00:05.307,800] <err> os: s[ 4]:  0xaaaaaaaa  s[ 5]:  0xaaaaaaaa  s[ 6]:  0xaaaaaaaa  s[ 7]:  0xaaaaaaaa
    HL [00:00:05.307,800] <err> os: s[ 8]:  0xaaaaaaaa  s[ 9]:  0xaaaaaaaa  s[10]:  0xaaaaaaaa  s[11]:  0xaaaaaaaa
    HL [00:00:05.307,800] <err> os: s[12]:  0xaaaaaaaa  s[13]:  0xaaaaaaaa  s[14]:  0xaaaaaaaa  s[15]:  0xaaaaaaaa
    HL [00:00:05.307,800] <err> os: fpscr:  0xaaaaaaaa
    HL [00:00:05.307,830] <err> os: Faulting instruction address (r15/pc): 0x00003f32
    HL [00:00:05.307,830] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    HL [00:00:05.307,861] <err> os: Current thread: 0x20001ff8 (ENCODER)
    HL [00:00:05.307,861] <err> error_handler: Caught system error -- reason 3. Entering infinite loop
    

    I would like to mention again that my goal is to achieve walkie-talkie-style stereo sound with headsets connected to the DA7212 hardware codec. Before making the modifications, I was able to hear mono sound from the external codec. 

    Could you please assist in resolving this issue? 

    Thanks in advance 

    Besr regardes 

    Abdulmohaimen Algamoudi 

  • Hi Abdulmohaimen,

    You could try to debug your application using tools mentioned in debugging lesson in the nRF Connect SDK Intermediate course.

    Best regards,
    Dejan

Related