As the esp32_technical_reference_manual_en.pdf mentioned that MCLK could output via GPIO0,I try below code:
Code: Select all
//output clock for I2S0 to CLK_OUT1
//pdf page 67
//(*((int*)PIN_CTRL)) = (*((int*)PIN_CTRL))&0xFFFFFFF0;
reg_val = REG_READ(PIN_CTRL);
ESP_LOGI(TAG, "PIN_CTRL before:%x", reg_val);
REG_WRITE(PIN_CTRL, 0xFFFFFFF0);
reg_val = REG_READ(PIN_CTRL);
ESP_LOGI(TAG, "PIN_CTRL after:%x", reg_val);
//(*((int*)PIN_CTRL)) = 0xFFFFFFF0;
PIN_FUNC_SELECT(GPIO_PIN_REG_0, 1); //GPIO0 as CLK_OUT1
log is:
I (1372) I2S: DMA Malloc info, datalen=blocksize=240, dma_buf_count=6
I (1382) I2S: Req RATE: 44100, real rate: 44642.000, BITS: 16, CLKM: 14, BCK: 8, MCLK: 11289966.924, SCLK: 1428544.000000, diva: 64, divb: 11
D (1392) I2S: data: out 163, in: -1, ws: 25, bck: 23
I (1402) Huan: PIN_CTRL before:3ff
I (1402) Huan: PIN_CTRL after:7ff0
I (1412) wifi: n:6 0, o:1 0, ap:255 255, sta:6 0, prof:1
I (1412) I2S: Req RATE: 22050, real rate: 22321.000, BITS: 16, CLKM: 28, BCK: 8, MCLK: 5644983.462, SCLK: 714272.000000, diva: 64, divb: 22
I (1432) I2S: Req RATE: 44100, real rate: 44642.000, BITS: 16, CLKM: 14, BCK: 8, MCLK: 11289966.924, SCLK: 1428544.000000, diva: 64, divb: 11
My question is :How enable I2S0 MCLK ouput via GPIO0?
Any help will be appreciate.