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
  • Hi,

    Could you please provide more information about your setup?

    Which external codec do you use?

    Best regards,
    Dejan

  • Hi, 

    Thank you for your swift reply.

    I am using the DA7212 evaluation board, and I can hear sound from the jacks on the DA7212 board. I followed the instructions from Nordic to enable the external codec.

    However, I am still working on achieving stereo sound, as the current output is mono. Any further guidance would be greatly appreciated.

    Best regards,

    Abdulmohaimen Algamoudi

  • Hi Abdulmohaimen,

    Are these logs in NCS v2.6.2 obtained after you implemented the same code changes as when you used NCS v2.4.2?

    Best regards,
    Dejan

  • Hi Abdulmohaimen,

    The error "<err> sw_codec_select: Unsupported channel mode for decoder: 0" in your NCS v2.6.2 log indicates that channel mode for decoder is not properly selected.

    You can look at m_config.decoder.channel_mode, struct sw_codec_decoder and enum sw_codec_channel_mode for the place where channel_mode is set. This is how sw_codec_channel_mode looks like in sw_codec_select.h

    enum sw_codec_channel_mode {
    	SW_CODEC_MONO = 1,
    	SW_CODEC_STEREO,
    };

    You could try to check how m_config.decoder.channel_mode is set.

    Best regards,
    Dejan

  • Good mrning Dejans, 

    I would like to express my thanks again. I was able to configure CIS Stereo mode using the v2.6.2 SDK by following this article and making some modifications to my code.

    While attempting to achieve a bidirectional configuration by enabling CONFIG_STREAM_BIDIRECTIONAL=y to get input from the microphone, I encountered the following error from the headset: (Left)

    *** Booting nRF Connect SDK v3.5.99-ncs1-2 ***
    HL [00:00:00.269,775] <inf> board_version: Compatible board/HW version found: 1.0.0
    HL [00:00:00.295,471] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.6.2                            
             Cmake run : Wed Dec 11 14:29:37 2024
    HL [00:00:00.295,471] <inf> fw_info: ------- DEBUG BUILD -------
    HL [00:00:00.295,471] <inf> fw_info: HEADSET left device
    HL [00:00:00.314,483] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8591
    HL [00:00:00.314,697] <inf> bt_mgmt: Local identity addr: F0:D2:8E:F5:33:C2 (random)
    HL [00:00:00.319,122] <inf> bt_mgmt_adv: Local addr: 4A:4A:60:EC:FA:38 (random)
    HL [00:00:00.319,671] <inf> bt_mgmt_adv: Advertising successfully started
    HL [00:00:00.544,799] <inf> bt_mgmt: Connected: 5D:F5:9F:2E:A1:2A (random)
    HL [00:00:00.544,830] <inf> main: Connected
    HL [00:00:01.312,683] <inf> main: Security changed
    HL [00:00:03.952,850] <inf> bt_content_ctrl_media: Discovery of MCS finished
    HL [00:00:06.432,891] <inf> unicast_server: LC3 codec config for sink:
    HL [00:00:06.432,922] <inf> unicast_server:     Frequency: 24000 Hz
    HL [00:00:06.432,922] <inf> unicast_server:     Duration: 10000 us
    HL [00:00:06.432,922] <inf> unicast_server:     Channel allocation: 0x1
    HL [00:00:06.432,922] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HL [00:00:06.432,922] <inf> unicast_server:     Frames per SDU: 1
    HL [00:00:06.434,326] <inf> unicast_server: LC3 codec config for source:
    HL [00:00:06.434,326] <inf> unicast_server:     Frequency: 24000 Hz
    HL [00:00:06.434,326] <inf> unicast_server:     Duration: 10000 us
    HL [00:00:06.434,356] <inf> unicast_server:     Channel allocation: 0x1
    HL [00:00:06.434,356] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HL [00:00:06.434,356] <inf> unicast_server:     Frames per SDU: 1
    HL [00:00:06.553,558] <inf> main: Presentation delay 10000 us is set by initiator
    HL [00:00:06.553,588] <inf> main: Presentation delay 10000 us is set by initiator
    HL [00:00:06.919,097] <inf> unicast_server: Stream 0x2000f6a0 started
    HL [00:00:06.924,041] <err> sw_codec_lc3: LC3 dec ch: 1 already initialized
    HL [00:00:06.924,072] <err> audio_system: Failed to set up codec
    HL [00:00:06.924,072] <err> audio_system: ERR_CHK Err_code: [-120] @ line: 399
    HL [00:00:06.924,072] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000006  r2/a3:  0x00000005
    HL [00:00:06.924,072] <err> os: r3/a4:  0x00059009 r12/ip:  0x20002d48 r14/lr:  0x00059093
    HL [00:00:06.924,102] <err> os:  xpsr:  0x41100000
    HL [00:00:06.924,102] <err> os: s[ 0]:  0x20001440  s[ 1]:  0x0005922d  s[ 2]:  0xffffff88  s[ 3]:  0x00000004
    HL [00:00:06.924,102] <err> os: s[ 4]:  0x20012250  s[ 5]:  0x20012230  s[ 6]:  0xffffff88  s[ 7]:  0x20012230
    HL [00:00:06.924,133] <err> os: s[ 8]:  0x20012250  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00059279
    HL [00:00:06.924,133] <err> os: s[12]:  0x20004540  s[13]:  0x000699f0  s[14]:  0xffffff88  s[15]:  0x0000018f
    HL [00:00:06.924,133] <err> os: fpscr:  0x00000000
    HL [00:00:06.924,133] <err> os: Faulting instruction address (r15/pc): 0x00004536
    HL [00:00:06.924,163] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    HL [00:00:06.924,194] <err> os: Current thread: 0x20001cf8 (LE_AUDIO_MSG_SUB)
    HL [00:00:06.924,194] <err> error_handler: Caught system error -- reason 3. Entering infinite loop
    

    (Right)

    *** Booting nRF Connect SDK v3.5.99-ncs1-2 ***
    HR [00:00:00.269,622] <inf> board_version: Compatible board/HW version found: 1.0.0
    HR [00:00:00.295,318] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.6.2                            
             Cmake run : Wed Dec 11 14:29:37 2024
    HR [00:00:00.295,318] <inf> fw_info: ------- DEBUG BUILD -------
    HR [00:00:00.295,318] <inf> fw_info: HEADSET right device
    HR [00:00:00.314,270] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8591
    HR [00:00:00.314,483] <inf> bt_mgmt: Local identity addr: F0:CB:62:43:5B:62 (random)
    HR [00:00:00.318,908] <inf> bt_mgmt_adv: Local addr: 78:FC:74:C4:67:5D (random)
    HR [00:00:00.319,427] <inf> bt_mgmt_adv: Advertising successfully started
    HR [00:00:00.433,471] <inf> bt_mgmt: Connected: 5D:F5:9F:2E:A1:2A (random)
    HR [00:00:00.433,502] <inf> main: Connected
    HR [00:00:01.195,648] <inf> main: Security changed
    HR [00:00:03.475,921] <inf> bt_content_ctrl_media: Discovery of MCS finished
    HR [00:00:05.515,960] <inf> unicast_server: LC3 codec config for sink:
    HR [00:00:05.515,991] <inf> unicast_server:     Frequency: 24000 Hz
    HR [00:00:05.515,991] <inf> unicast_server:     Duration: 10000 us
    HR [00:00:05.515,991] <inf> unicast_server:     Channel allocation: 0x1
    HR [00:00:05.515,991] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HR [00:00:05.515,991] <inf> unicast_server:     Frames per SDU: 1
    HR [00:00:05.517,395] <inf> unicast_server: LC3 codec config for source:
    HR [00:00:05.517,395] <inf> unicast_server:     Frequency: 24000 Hz
    HR [00:00:05.517,395] <inf> unicast_server:     Duration: 10000 us
    HR [00:00:05.517,425] <inf> unicast_server:     Channel allocation: 0x2
    HR [00:00:05.517,425] <inf> unicast_server:     Octets per frame: 60 (48000 bps)
    HR [00:00:05.517,425] <inf> unicast_server:     Frames per SDU: 1
    HR [00:00:05.596,618] <inf> main: Presentation delay 10000 us is set by initiator
    HR [00:00:05.596,649] <inf> main: Presentation delay 10000 us is set by initiator
    HR [00:00:05.918,731] <inf> unicast_server: Stream 0x2000f6a0 started
    HR [00:00:05.923,645] <err> sw_codec_lc3: LC3 dec ch: 1 already initialized
    HR [00:00:05.923,675] <err> audio_system: Failed to set up codec
    HR [00:00:05.923,675] <err> audio_system: ERR_CHK Err_code: [-120] @ line: 399
    HR [00:00:05.923,675] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000004  r2/a3:  0x00000003
    HR [00:00:05.923,706] <err> os: r3/a4:  0x00059009 r12/ip:  0x20002d48 r14/lr:  0x00059093
    HR [00:00:05.923,706] <err> os:  xpsr:  0x41100000
    HR [00:00:05.923,706] <err> os: s[ 0]:  0x20001440  s[ 1]:  0x0005922d  s[ 2]:  0xffffff88  s[ 3]:  0x00000004
    HR [00:00:05.923,706] <err> os: s[ 4]:  0x20012250  s[ 5]:  0x20012230  s[ 6]:  0xffffff88  s[ 7]:  0x20012230
    HR [00:00:05.923,736] <err> os: s[ 8]:  0x20012250  s[ 9]:  0x00000000  s[10]:  0x00000000  s[11]:  0x00059279
    HR [00:00:05.923,736] <err> os: s[12]:  0x20004540  s[13]:  0x000699f0  s[14]:  0xffffff88  s[15]:  0x0000018f
    HR [00:00:05.923,736] <err> os: fpscr:  0x00000000
    HR [00:00:05.923,767] <err> os: Faulting instruction address (r15/pc): 0x00004536
    HR [00:00:05.923,767] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    HR [00:00:05.923,797] <err> os: Current thread: 0x20001cf8 (LE_AUDIO_MSG_SUB)
    HR [00:00:05.923,797] <err> error_handler: Caught system error -- reason 3. Entering infinite loop


    The line 399 in audio_system is:

    	ret = sw_codec_init(sw_codec_cfg);
    	ERR_CHK_MSG(ret, "Failed to set up codec");

    I have tried several methods to change the number of data channels to 2, but none of them have worked. Could you please assist me with this issue?

    I would like to mention that with the current working SDK I am using, both headsets are connected and synchronized, but there is no sound coming from the right headset. the log file of the right headset with out  enabling CONFIG_STREAM_BIDIRECTIONAL=y, when the left one output sound:
    .

    *** Booting nRF Connect SDK v3.5.99-ncs1-2 ***
    HR [00:00:00.270,568] <inf> board_version: Compatible board/HW version found: 1.0.0
    HR [00:00:00.296,081] <inf> fw_info: 
             nRF5340 Audio nRF5340 Audio DK cpuapp                      
             NCS base version: 2.6.2                            
             Cmake run : Wed Dec 11 10:07:20 2024
    HR [00:00:00.296,081] <inf> fw_info: ------- DEBUG BUILD -------
    HR [00:00:00.296,112] <inf> fw_info: HEADSET right device
    HR [00:00:00.315,826] <inf> bt_mgmt_ctlr_cfg: Controller: SoftDevice: Version 5.4 (0x0d), Revision 8591
    HR [00:00:00.316,009] <inf> bt_mgmt: Local identity addr: F0:D2:8E:F5:33:C2 (random)
    HR [00:00:00.321,197] <inf> bt_mgmt_adv: Local addr: 59:BE:31:34:72:20 (random)
    HR [00:00:00.321,289] <inf> bt_mgmt_adv: Adv directed to: D3:C8:9D:D1:BE:66 (random).
    HR [00:00:00.321,899] <inf> bt_mgmt_adv: Advertising successfully started
    HR [00:00:00.845,428] <inf> bt_mgmt: Connected: D3:C8:9D:D1:BE:66 (random)
    HR [00:00:00.845,458] <inf> main: Connected
    HR [00:00:00.845,855] <inf> bt_mgmt_adv: RPA (Resolvable Private Address) expired.
    HR [00:00:00.845,916] <inf> bt_mgmt_adv: Local addr: 59:BE:31:34:72:20 (random)
    HR [00:00:01.414,123] <inf> main: Security changed
    HR [00:00:01.414,367] <wrn> bt_gatt: Device is not subscribed to characteristic
    HR [00:00:01.414,367] <wrn> bt_pacs: PACS notify failed: -22
    HR [00:00:07.973,968] <inf> bt_content_ctrl_media: Discovery of MCS finished
    HR [00:00:08.774,108] <inf> unicast_server: LC3 codec config for sink:
    HR [00:00:08.774,108] <inf> unicast_server:     Frequency: 48000 Hz
    HR [00:00:08.774,108] <inf> unicast_server:     Duration: 10000 us
    HR [00:00:08.774,139] <inf> unicast_server:     Channel allocation: 0x2
    HR [00:00:08.774,139] <inf> unicast_server:     Octets per frame: 120 (96000 bps)
    HR [00:00:08.774,139] <inf> unicast_server:     Frames per SDU: 1
    HR [00:00:09.014,648] <inf> main: Presentation delay 10000 us is set by initiator
    HR [00:00:09.576,477] <inf> unicast_server: Stream 0x2000f698 started
    DAC L gain 112   
    DAC R gain 112   
    HR [00:00:09.587,707] <wrn> le_audio_rx: Not in streaming state, throwing data: 1
    HR [00:00:09.599,639] <wrn> audio_datapath: Data received, total under-runs: 5
    HR [00:00:09.666,656] <inf> audio_datapath: Drft comp state: CALIB
    HR [00:00:09.766,662] <inf> audio_datapath: Drft comp state: OFFSET
    HR [00:00:09.966,674] <inf> audio_datapath: Drft comp state: LOCKED
    HR [00:00:09.966,827] <inf> audio_datapath: Pres comp state: MEAS
    HR [00:00:10.076,812] <inf> audio_datapath: Pres comp state: WAIT
    HR [00:00:10.216,796] <inf> audio_datapath: Pres comp state: INIT
    HR [00:00:10.226,806] <inf> audio_datapath: Pres comp state: MEAS
    HR [00:00:10.336,791] <inf> audio_datapath: Pres comp state: LOCKED

    For any further information, I am ready to assist or provide details as needed.

    Thanks in advance.

    Best regards 

    Abdulmohaimen 



  • Hi Abdulmohaimen,

    Have you seen my last reply in this thread

    Best regards,
    Dejan

  • Hello Dejan,

    I would like to express my heartfelt thanks for all the support you have provided throughout this ticket. With your assistance, I was able to achieve the desired configuration with the DK, and I am looking forward to testing it further with my PCB.

    Once again, thank you so much!

    Best regards 

    Abdulmohaimen 

Reply Children
No Data
Related