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

     
  • Can you help me in what function do i need to use for accesing mic data to amplifier.I am getting mic data by using i2s_read so,in order to send that data to amplifier what i need to use to configure?

  • To be clear, will you use Audio over BLE at all, or do you just want to do this locally? Because if you intend to use audio over BLE, I suggest you start familiarizing with the nrf5340_audio found in ncs\nrf\applications\nrf5340_audio, but if you are just using the I2S, then I would start with a simpler sample, and just add I2S.

    BR,
    Edvin

  • Actually i want to use both the things.I want data to be processed played in speaker and I want to transfer raw data without any processing over BLE.This is main theme to be done.

  • I understand. In that case, I would recommend that you start with the audio sample, because it will be more work to add this to a barebone I2S application later.

    Try to build the broadcast source configuration, and locate where it picks up the microphone signals.

    Best regards,

    Edvin

  • Thanks Edvin,will check with that sample .Actually I am working with I2S echo saple where it have Rx and Tx using for getting audio and amplification respectively and I thought if I get raw data I can notify the data by creating service and characterstic via ble using Zephyr.Is this approach works?Will there be same working in your mentioned audio sample "broadcast source" ?

    And to mention when I am using Echo sample ,I done changes to code as per my mic and added register address and able to read values from amplifier but I couldnt listen any audio from speaker amplifier ,I can listen only noise may be due to current leckage .I can see the clocks coming correctly from SDOUT i,e to amplifier.So can you help me in his regard.

     &pinctrl {
    	i2c0_default_alt: i2c0_default_alt {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 1, 2)>,
    			<NRF_PSEL(TWIM_SCL, 1, 3)>;
    		};
    	};
    
    	i2c0_sleep_alt: i2c0_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 1, 2)>,
    			<NRF_PSEL(TWIM_SCL, 1, 3)>;
    			low-power-enable;
    		};
    	};
    
    	i2s0_default_alt: i2s0_default_alt {
    		group1 {
    			psels =<NRF_PSEL(I2S_SCK_M, 0, 26)>,
    			<NRF_PSEL(I2S_LRCK_M, 0, 25)>,
    			<NRF_PSEL(I2S_SDOUT, 0, 6)>,
    			<NRF_PSEL(I2S_SDIN, 0, 7)>;
    		};
    	};
    	i2s0_sleep_alt: i2s0_sleep_alt {
    		group1 {
    			psels =  <NRF_PSEL(I2S_SCK_M, 0, 26)>,
    			<NRF_PSEL(I2S_LRCK_M, 0, 25)>,
    			<NRF_PSEL(I2S_SDOUT, 0, 6)>,
    			<NRF_PSEL(I2S_SDIN, 0, 7)>;
    		};
    	};
    };
    
    &i2c1 {
    	status = "okay";
    	pinctrl-0 = <&i2c0_default_alt>;
    	pinctrl-1 = <&i2c0_sleep_alt>;
    	pinctrl-names = "default", "sleep";
    
    tas2563:tas2563@4C{
    		compatible = "i2c-device";
    		reg = <0x4C>;
    		label = "TAS2653";
    	};
    };
    
    &clock {
    	hfclkaudio-frequency = <11289600>;
    };
    
    i2s_rxtx: &i2s0 {
    	status = "okay";
    	pinctrl-0 = <&i2s0_default_alt>;
    	pinctrl-1 = <&i2s0_sleep_alt>;
    	pinctrl-names = "default","sleep";
    	clock-source = "ACLK";
    };

Reply
  • Thanks Edvin,will check with that sample .Actually I am working with I2S echo saple where it have Rx and Tx using for getting audio and amplification respectively and I thought if I get raw data I can notify the data by creating service and characterstic via ble using Zephyr.Is this approach works?Will there be same working in your mentioned audio sample "broadcast source" ?

    And to mention when I am using Echo sample ,I done changes to code as per my mic and added register address and able to read values from amplifier but I couldnt listen any audio from speaker amplifier ,I can listen only noise may be due to current leckage .I can see the clocks coming correctly from SDOUT i,e to amplifier.So can you help me in his regard.

     &pinctrl {
    	i2c0_default_alt: i2c0_default_alt {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 1, 2)>,
    			<NRF_PSEL(TWIM_SCL, 1, 3)>;
    		};
    	};
    
    	i2c0_sleep_alt: i2c0_sleep_alt {
    		group1 {
    			psels = <NRF_PSEL(TWIM_SDA, 1, 2)>,
    			<NRF_PSEL(TWIM_SCL, 1, 3)>;
    			low-power-enable;
    		};
    	};
    
    	i2s0_default_alt: i2s0_default_alt {
    		group1 {
    			psels =<NRF_PSEL(I2S_SCK_M, 0, 26)>,
    			<NRF_PSEL(I2S_LRCK_M, 0, 25)>,
    			<NRF_PSEL(I2S_SDOUT, 0, 6)>,
    			<NRF_PSEL(I2S_SDIN, 0, 7)>;
    		};
    	};
    	i2s0_sleep_alt: i2s0_sleep_alt {
    		group1 {
    			psels =  <NRF_PSEL(I2S_SCK_M, 0, 26)>,
    			<NRF_PSEL(I2S_LRCK_M, 0, 25)>,
    			<NRF_PSEL(I2S_SDOUT, 0, 6)>,
    			<NRF_PSEL(I2S_SDIN, 0, 7)>;
    		};
    	};
    };
    
    &i2c1 {
    	status = "okay";
    	pinctrl-0 = <&i2c0_default_alt>;
    	pinctrl-1 = <&i2c0_sleep_alt>;
    	pinctrl-names = "default", "sleep";
    
    tas2563:tas2563@4C{
    		compatible = "i2c-device";
    		reg = <0x4C>;
    		label = "TAS2653";
    	};
    };
    
    &clock {
    	hfclkaudio-frequency = <11289600>;
    };
    
    i2s_rxtx: &i2s0 {
    	status = "okay";
    	pinctrl-0 = <&i2s0_default_alt>;
    	pinctrl-1 = <&i2s0_sleep_alt>;
    	pinctrl-names = "default","sleep";
    	clock-source = "ACLK";
    };

Children
Related