Accessing two channels of i2s

Hi,I am using NRF5340 AUDIO DK BOARD and Ihave been trying to access i2s mic and I want to transfer the mic data to Amplifier .Is it possible to do with single I2s ? As I observe nrf5340  has two channels.If it possible how to configure pins for mic and amplifier as I have been using SCK,SDIN,LRCK but if want to configure for Amplifier what pins can I use for it as it doesn't have other SCK,LRCK pins.And I want to know difference between MCK and SCK in i2s configuration,Ihave attached the i2s configuration below.

Parents
  • The I²S peripherial can do both reading and writing at the same time - as long as you use the same clock signal(s).

    We would need what I²S mics or codec chips you intend to use in order to help you further.

    MCK and SCK are coarsly described in the PS and should appear in the datasheet of your I²S codec.

  • So will it be possible getting mic data and sending mic data to Amplifier with same SCK,LRCK pins (p0.14,p0.16) for both,because I used SAI protocol in STM there it has 2 Channels of SAI A,SAI B which is two channel ,so it has dedicated pins for each channel where i have used one for MIC data collection and other channel for Amplification .So I want to know how in NRF i2s work with 2 channels where it has single clocks .I am using MIC SPH0645LM4H and Amplifier TAS2562YFPT

     
  • So you are able to sample the microphone, right?

    I don't know how this amplifier expects it's data. Does the datasheet of the amp say anything about how it wants it's data?

    BR,

    Edvin

  • Amplifier needs PCM data of mic.

    Can you please provide me any sorce code how can i able to use 2 channels in I2S one mic and one for transmitting to amplifier.First confirm is nrf having two channels I2S format for config this thing

  • PCM and I2S is almost the same thing. An I2S interface will provide you a PCM stream of data. The default Audio example (ncs\nrf\applications\nrf5340_audio) should provide an example how to use both I2S to a microphone and PCM to an output stream, or to a sound device. 

    Please check the nRF5340_Audio documentation.

    So e.g. the configuration of an Broadcast source should record the audio from somewhere (the microphone) using I2S, and the Broadcast sink will take that data and output it as PCM (via the I2S interface).

    Best regards,

    Edvin

  • I mainly wanted to know how to perform getting mic data as well send data for amplification by sharing same clock of LRCK and SCK .I need how to configure that both to achieve .Will i get any source for achieving or first is it possible to achieve that live data.

  • We don't provide source code, unfortunately. You need to write the application yourself.

    If you just want to pass the data into the amplifier, is it not possible to just provide the clock signal, and wire the I2S data directly to the amplifier? Also connect it to the nRF (using the same wire split into two), so that you can just read the mic data like it is done in the sample, and the I2S' PCM stream will go directly to the amplifier as well? You would also need to wire the LRCLK to both devices. 

    Are you sure the amplifier doesn't provide it's own clock signals to the microphone? I am not saying it does, but it could make sense that it does. 

    BR,
    Edvin

Reply
  • We don't provide source code, unfortunately. You need to write the application yourself.

    If you just want to pass the data into the amplifier, is it not possible to just provide the clock signal, and wire the I2S data directly to the amplifier? Also connect it to the nRF (using the same wire split into two), so that you can just read the mic data like it is done in the sample, and the I2S' PCM stream will go directly to the amplifier as well? You would also need to wire the LRCLK to both devices. 

    Are you sure the amplifier doesn't provide it's own clock signals to the microphone? I am not saying it does, but it could make sense that it does. 

    BR,
    Edvin

Children
  • I would like to explain my application here and need to confirm if I can achieve this using nrf5340


    1) We will read data from Microphone using I2S

    2) Then, We will send the same data to Amplifier which is also connected through I2S
    (This process should not have any larger delay and we need live streaming of microphone data)

    Query:

    Can this be achieved using the below connection method. If not, what should be done to use this I2S with 2 channels
    is it not possible to just provide the clock signal, and wire the I2S data directly to the amplifier?
    I am not sure whether it works,please confirm me that,If yes will it achieve by using i2s_buf_write will be transfer to amplifier?
    Please note: Our chosen amplifier will act only as slave and it cannot give out its own clock signals to Microphone.

  • I believe this is possible, yes. You would then need to read the data from the microphone, then take the buffer from the microphone and send it (using i2s_buf_write) to the amplifier. It would require two instances of I2S. This is why, if you don't need the raw data from the microphone, you could try to connect the output of the I2S from the microphone directly to the amplifier, and test if that works. This would reduce the delay, as you wouldn't need first receive then transmit the PCM data.

    BR,
    Edvin

  • In that specified case,No, we cannot connect microphone directly to the amplifier, we need to get the raw data from microphone and process it by adding filters, volume controls which is required in our application.

    We want to know is it possible to do the above explained method with this Single I2S with two channel configuration.?

    So for that processing of raw data and need to send for amplification at same time .So to achieve how can i use the buffer to perform.This is actual case .My sampling Rate is 16khz.

  • I take that back. The nRF5340 only has one I2S instance. Do you need to transmit data both ways for the microphone? Something to set it up? Or is it sufficient to only receive?

    And how about the amplifier? I guess you want the PCM data coming back from the amplifier as well? In that case, this actually may not work. Unless you either bitbang the microphone, or you would need to uninit one device, initialize the other, and keep swapping between these, which means that at least half the time you will not be able to record from the microphone. 

    BR,
    Edvin

  • I take that back. The nRF5340 only has one I2S instance. Do you need to transmit data both ways for the microphone? Something to set it up? Or is it sufficient to only receive?

    OK,I want to receive data from MIC and apply filters to that audio.Here what does instance represent-The  Channels?Because I saw in datasheet nrf5340 has 2-channels.So thought to use one for Rx for mic and one for Tx to Amplifier.So make me confirm we can perform in this controller

    And how about the amplifier? I guess you want the PCM data coming back from the amplifier as well?

    Here I will use Tx and want to transmit data from processed mic data by applying filters and I just want to play that in Speakers.But this I want with no data loss

Related