I use platformio to work with ESP32-s3 NR16. IDF version 5.3.2.
When I configure I2S using these pins it works but I need to use other pins.
`#define PIN_I2S_0_DATA GPIO_NUM_15
#define PIN_I2S_0_WS GPIO_NUM_16
#define PIN_I2S_0_CLK GPIO_NUM_7 `
I2S works fine.But I need to use other pins.
#define PIN_I2S_0_DATA GPIO_NUM_42
#define PIN_I2S_0_WS GPIO_NUM_39
#define PIN_I2S_0_CLK GPIO_NUM_41
In this case, it does not want to work. But there are no restrictions for these pins. I can assign any functions available through the GPIO matrix to these legs.
My cod for init I2S.
#define I2S_0_DAC I2S_NUM_0
#define PIN_I2S_0_DATA GPIO_NUM_42
#define PIN_I2S_0_WS GPIO_NUM_39
#define PIN_I2S_0_CLK GPIO_NUM_41
void FnInitI2S_0(void)
{
esp_err_t err;
i2s_driver_config_t i2s_cfg;
i2s_pin_config_t i2s_pin;
I2S_DAC.I2S_DAC_RingBuff = xRingbufferCreate(6*1024, RINGBUF_TYPE_NOSPLIT);
memset(&i2s_cfg, 0 ,sizeof(i2s_cfg));
i2s_cfg.bits_per_sample = I2S_BITS_PER_SAMPLE_16BIT;
i2s_cfg.bits_per_chan = I2S_BITS_PER_CHAN_DEFAULT;
i2s_cfg.channel_format = I2S_CHANNEL_FMT_ALL_RIGHT;
i2s_cfg.dma_buf_count = 8;
i2s_cfg.dma_buf_len = 64;
i2s_cfg.mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_TX);
i2s_cfg.sample_rate = 8000;
i2s_cfg.communication_format = I2S_COMM_FORMAT_STAND_I2S;
i2s_cfg.tx_desc_auto_clear = false;
i2s_pin.bck_io_num = PIN_I2S_0_CLK;
i2s_pin.data_out_num = PIN_I2S_0_DATA;
i2s_pin.ws_io_num = PIN_I2S_0_WS;
i2s_pin.data_in_num = I2S_PIN_NO_CHANGE;
i2s_pin.mck_io_num =I2S_PIN_NO_CHANGE;
err = i2s_driver_install(I2S_0_DAC, &i2s_cfg, 0, NULL);
if(err!=ESP_OK) ESP_LOGE(TAG,"ERROR_INSTAL_I2S0");
err = i2s_set_pin(I2S_0_DAC, &i2s_pin);
if(err!=ESP_OK) ESP_LOGE(TAG,"ERROR_INSTAL_I2S0");
else ESP_LOGE(TAG,"I2S0_START_OK");
}