Config for Unicast Client (Gateway) and Unicast Server (Headset) with Bidirectional Audio

Hi, 

I'm trying to set up two nRF5340 Audio boards - one as a unicast client (gateway) and the other as a unicast server (headset). I have seperate config files for both that essentially are the clones of the prj.conf file from the samples, but have small changes specific to each board.

I am trying to evaluate the walkie-talkie demo with the below params: 

CONFIG_WALKIE_TALKIE_DEMO=y

CONFIG_AUDIO_SOURCE_I2S=y
Here i am using an external mic instead of the PDM onboard. But using this config, the board only transmits audio from Gateway to headset. I wanted to flip the direction of audio, from headset to gateway. How do i achieve it?
Parents Reply Children
  • Hi Ahaug,

    Thanks for the response. As I have mentioned, my current config consists of the CONFIG_WALKIE_TALKIE_DEMO set to true. But with this param enabled, i cannot integrate an external Mic. It only works with PDM.

    I have also tried the other approach using CONFIG_STREAM_BIDIRECTIONAL. In this config setting, the external Mic does not work even after declaring it in config, Only PDM works: 

    CONFIG_STREAM_BIDIRECTIONAL=y
    CONFIG_AUDIO_SOURCE_I2S=y

    My end goal is to send audio from headset (client) to gateway (server) using the external mic on nrf5340 Audio DK kit.

  • Ah, yes, you're right. I see now that it does only support PDM. Apologies for mixing it up.

    I had a chat with some of our audio experts to understand this better. They summarized it as follows:

    What you need to do is to modify the data flow from PDM-mic -> HW-codec -> nRF5340 (I2S) to match how you've set it up with your external microphone. nrf5340_audio\src\modules\audio_i2s.c could be relevant for this. I'm assuming that your microphone is an I2S microphone, and in this case you don' have to use HW codec from the microphone to the SoC.

    I hope this is enough to get you started

    Kind regards,
    Andreas

  • My Mic is an external contact microphone (Analog). I wanted to use an external contact microphone instead of the pdm mic.

    I am not sure but this might be a bug. The hw_codec.c file consists of configuration for the gateway to set the config according to pdm mic or line-in mic, but there was no config for the headset.

    #if ((CONFIG_AUDIO_DEV == GATEWAY) && (CONFIG_AUDIO_SOURCE_I2S))
    if (IS_ENABLED(CONFIG_WALKIE_TALKIE_DEMO)) {
    ret = cs47l63_comm_reg_conf_write(pdm_mic_enable_configure,
    ARRAY_SIZE(pdm_mic_enable_configure));
    if (ret) {
    return ret;
    }
    } else {
    ret = cs47l63_comm_reg_conf_write(line_in_enable, ARRAY_SIZE(line_in_enable));
    if (ret) {
    return ret;
    }
    }
    #endif /* ((CONFIG_AUDIO_DEV == GATEWAY) && (CONFIG_AUDIO_SOURCE_I2S)) */
    
    #if ((CONFIG_AUDIO_DEV == HEADSET) && CONFIG_STREAM_BIDIRECTIONAL)
    
    if (IS_ENABLED(CONFIG_WALKIE_TALKIE_DEMO)){
    ret = cs47l63_comm_reg_conf_write(pdm_mic_enable_configure,
    ARRAY_SIZE(pdm_mic_enable_configure));
    if (ret){
    return ret;
    }
    } else {
    ret = cs47l63_comm_reg_conf_write(line_in_enable, ARRAY_SIZE(line_in_enable));
    if (ret){
    return ret;
    }
    }
    #endif /* ((CONFIG_AUDIO_DEV == HEADSET) && CONFIG_STREAM_BIDIRECTIONAL) */
    
    /* Toggle FLL to start up CS47L63 */
    ret = cs47l63_comm_reg_conf_write(FLL_toggle, ARRAY_SIZE(FLL_toggle));
    if (ret) {
    return ret;
    }
    
    return 0;
    }
    The above block of code is what i have added instead in function hw_codec_default_conf_enable() in hw_codec.c. 
  •  I think even if you call cs47l63_comm_reg_conf_write(pdm_mic_enable_configure,
    ARRAY_SIZE(pdm_mic_enable_configure)); in headset code, it is still using the on-board PDM mic, instead of your external mic.

    You said you are using an Analog external mic, I assue that would be similar to the 'Line-In' of the 5340 Audio DK, so you need to call cs47l63_comm_reg_conf_write(line_in_enable, ARRAY_SIZE(line_in_enable)); and also try to feed your Analog mic data to the line-in iterface of the on-board HW codec cs47l63.

  • Hi lincoln,

    Yes, External mic in this context is a mic that i connect to the Line-in port in the Audio Dk kit. You are correct, that is what i have done. My prj.conf file is set to select the cs47l63_comm_reg_conf_write(line_in_enable, ARRAY_SIZE(line_in_enable)); config upon build

Related