Set nRF5340 Audio DK as I2S slave over external bus

Hello! I am attempting to use my nRF5340 Audio DK as a gateway to broadcast audio from an external I2S source.

I have added the `CONFIG_AUDIO_SOURCE_I2S=y` line to my project .conf file as described in the README for the nrf5340_audio project.

I also have followed the instructions in this DevZone post to configure the board to use the external I2S connections on the P10 header.

The issue that I am encountering now is that the nRF board is still acting as the I2S master. The other device I want to connect I am not in control of and is configured as an I2S master. I need the nRF board to act as I2S slave and transmit the audio the other device is sending it over the Bluetooth link (in my case as a BIS broadcast). How can I configure the nRF as I2S slave?

Parents
  • Hi, 

    When you set ADK as I2S slave, you may run into the issue as my colleague's explanation in this post. It is strongly recommended to have nRF5340-gateway audio as I2S master, and your custom board can be I2S slave.

    It would be possible to configure the ADK as I2S slave, but we don't have official support for this feature now. Enabling CONFIG_AUDIO_SOURCE_I2S only switches the audio source interface from USB to I2S since that will break the drift/presentation compensation mechanism in the project. If you really want the nRF5340 gateway to run as the I2S slave (which we won't recommend). You have to modify the audio_datapath module to bypass all the compensation mechanisms, and also modify the audio_i2s module for turning the I2S from master into slave.

    Regards,
    Amanda H.

  • Hi Amanda! We've investigated a couple approaches and would like to try running the nRF as a follower. We know that this is not recommended and can result in audio degradation but we think its worth evaluating since the audio degradation may be acceptable for our application. I've attempted to implement the changes that you've indicated above but it does not appear to be working, I'm sure I'm just missing something.

    in src/modules/audio_i2s.c:41:

    static nrfx_i2s_config_t cfg = {
        /* Pins are configured by pinctrl. */
        .skip_gpio_cfg = true,
        .skip_psel_cfg = true,
        .irq_priority = DT_IRQ(I2S_NL, priority),
        .mode = NRF_I2S_MODE_SLAVE,
        .format = NRF_I2S_FORMAT_ALIGNED,
        .alignment = NRF_I2S_ALIGN_LEFT,
        .ratio = NRF_I2S_RATIO_256X,
        .mck_setup = NRF_I2S_MCK_DISABLED,
        .sample_width = NRF_I2S_SWIDTH_16BIT_IN32BIT,
        .channels = NRF_I2S_CHANNELS_STEREO,
        .clksrc = NRF_I2S_CLKSRC_PCLK32M,
        .enable_bypass = true,
    };

    The device we're attempting to link with uses 16bit samples left aligned in 32bit wide frames

    Next, to disable the compensation mechanisms, I've commented out the call to

    audio_datapath_drift_compensation(frame_start_ts);

    within src/audio/audio_datapath.c:699 which is the

    audio_datapath_i2s_blk_complete

    function.

    This feels like the area I might be missing something. Any assistance would be greatly appreciated! Thanks!

  • Cool good to know. Do I have the proper configurations set in that nrfx_i2s_config_t struct as listed above? The timings for the device we're attempting to connect to are below. 32-bit half-frames with 16 bits of left-aligned sample data. I'll try to get a hold of the non-ADK version of the board

    FS

    48 kHz

     

    Word Clock / Word Select / Frame Sync

    SCLK

    3.072 MHz

    64* FS

    Bit Clock / Serial Clock

    MCLK

    12.288 MHz

    256* FS

    Master Clock

  • OK I do have a non-audio DK on hand. Should I use the same nrf5340_audio application? Does it require any config changes to switch boards? Thanks!!

  • Hi, 

    I would also try with:

    NRF_I2S_FORMAT_I2S instead of ALIGNED. 16 bits in 32-bit frame is also very uncommon. That means half the data is "wasted" and I find it hard to believe that the other device has this configuration.

    -Amanda H.

  • That's what it uses. I've verified this with an oscilloscope.

    From the vendor's datasheet:

  • How do I build targeting the non-audio DK? I tried making a new build configuration using the nrf5340dk_nrf5340_cpuapp board target but it had a ton of errors. Thanks!

Reply Children
Related