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?

  • I was able to get the application building with the v2.4.0 version of the SDK. I verified that I could send audio from the onboard codec with the nRF still as the I2S master and have it come out on the other board. I also tried disabling the drift compensation features as described with the nRF still as master and the comms still worked. However, once I switched the board over to the external I2S and made it a slave, there was no longer any audio. Any thoughts? The I2S configuration I am using is copied below. I needed to change a couple values based on the I2S format the other device uses (16 bit samples in 32 bit half-frames left aligned, 48kHz sample rate, 256x MCLK, 3V3 signals).

    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,  // MODIFIED
        .format = NRF_I2S_FORMAT_ALIGNED,  // MODIFIED
        .alignment = NRF_I2S_ALIGN_LEFT,
        .ratio = NRF_I2S_RATIO_256X,  // MODIFIED
        .mck_setup = NRF_I2S_MCK_DISABLED, //0x66666000, MODIFIED
        .sample_width = NRF_I2S_SWIDTH_16BIT_IN32BIT, // MODIFIED
        .channels = NRF_I2S_CHANNELS_STEREO,
        .clksrc = NRF_I2S_CLKSRC_ACLK,
        .enable_bypass = true,   // MODIFIED
    };
  • Hi, 

    nRF5340 on audio DK is using 1.8v, that could be the root cause.

    -Amanda H.

  • The external I2S source provided an MCLK signal. Does the nRF need this input when acting as I2S slave? I've tried adding some resistor dividers on a breadboard to bring the signals down to 1V8 levels but it's still not working. It also seems like the DIN line pulls the signal down to 1Vpp when I connect it

  • Yes, that is required. If the nRF is a slave, all three clocks are required. I would suggest to get the I2S input working on a nRF5340 DK (not ADK) first, to start out with lower complexity. 

    -Amanda H.

  • 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

Related