Zephyr i2s echo code channel number

Hi,

Im currently adjusting this i2s sample code to work with my TAS2781 audio amplifier. The code works perfectly  but I just want to do a little adjustment on the channel number to 4 to give me a 64 ratio as per table 3(i2s nordic documentation) of the config clock set to "ACLK" using the settings below. Once I have change the channel from 2 --> 4 the code stop communication to the i2s channel.

I'm very new to this drivers and I would appreciate if you could suggest what I need to change on the macros below.

also, is there any plans to make the zephyr i2s drive to work with format "config.format = I2S_FMT_DATA_FORMAT_PCM_SHORT;"?

Lanz

Parents
  • Hello,

    I would expect that you get an "Failed to configure streams:..." when trying to set NUMBER_OF_CHANNELS to more than 2, since 2 is the maximum supported.

    Looking at the implementation of i2s_nrfx_configure() I can find it should return -EINVAL.

    	if (i2s_cfg->channels == 2) {
    		nrfx_cfg.channels = NRF_I2S_CHANNELS_STEREO;
    	} else if (i2s_cfg->channels == 1) {
    		nrfx_cfg.channels = NRF_I2S_CHANNELS_LEFT;
    	} else {
    		LOG_ERR("Unsupported number of channels: %u",
    			i2s_cfg->channels);
    		return -EINVAL;
    	}

    Kenneth

Reply
  • Hello,

    I would expect that you get an "Failed to configure streams:..." when trying to set NUMBER_OF_CHANNELS to more than 2, since 2 is the maximum supported.

    Looking at the implementation of i2s_nrfx_configure() I can find it should return -EINVAL.

    	if (i2s_cfg->channels == 2) {
    		nrfx_cfg.channels = NRF_I2S_CHANNELS_STEREO;
    	} else if (i2s_cfg->channels == 1) {
    		nrfx_cfg.channels = NRF_I2S_CHANNELS_LEFT;
    	} else {
    		LOG_ERR("Unsupported number of channels: %u",
    			i2s_cfg->channels);
    		return -EINVAL;
    	}

    Kenneth

Children
Related