我难以理解如何将 TLV320ADC5140配置为在单个 TLV320通道上使用两个 PDM 麦克风(硬件配置为左、右)并通过 I2S 发送数据。
无论我尝试何种配置、最终都只有在我的微控制器(ESP32)上接收到正确的麦克风数据、并且音频始终抖动。
我敢肯定、我对配置 TLV320ADC5140的方式有一定的了解、并希望收到一些建议。
但是、到目前为止、我遵循了数据表中的8通道 PDM 示例、我已通过删除其中的6个通道来将其卸下:
/* ASI_CFG0: I2S mode and 32bit word length */ 0x07: 112 [0111 0000] /* PDMIN_CFG: PDMDIN1_EDGE ch1 positive, ch2 negative respective of INMP621 datasheet, page 5 */ 0x20: 192 [1100 0000] /* GPO1_CFG: PDM clock output, drive active low active high */ 0x22: 65 [0100 0001] /* GPI_CFG0: PDM data input channel 1 and 2 */ 0x2B: 69 [0100 0101] /* CH1_CFG0: configured for PDM input */ 0x3C: 64 [0100 0000] /* IN_CH_EN: enable channel 1 */ 0x73: 192 [1100 0000] /* ASI_OUT_CH_EN: enable channel 1 slot */ 0x74: 128 [1000 0000]
对于单个通道(具有交错的左/右数据)上的两个麦克风如何映射到输出 ASI 时隙、我想我觉得更加困惑。 它是否仍通过 I2S 总线呈现为交错式数据?
PDM 接口的帧大小是如何确定的? 鉴于 ASI_WLEN 设置为32位、左通道为16位、右通道为16位吗?
其他相关信息:
- PDMCLK 似乎是3.072MHz
- FSYNC 为16kHz
- BCLK 为1.024MHz
- 采样速率为16kHz
I2S 总线初始化如下:
Audio::Audio() : tlv {}, bck {21}, ws {25}, data {27}, sampleRate {16000}, bitsPerSample {32}, channelFormat {I2S_CHANNEL_FMT_RIGHT_LEFT}, communicationFormat {I2S_COMM_FORMAT_I2S} { /* zero the buffer */ std::memset(this->buffer, 0, BufferSize); /* i2s configuration */ this->config = { .mode = (i2s_mode_t)(I2S_MODE_MASTER | I2S_MODE_RX), .sample_rate = this->sampleRate, .bits_per_sample = i2s_bits_per_sample_t(this->bitsPerSample), .channel_format = this->channelFormat, .communication_format = this->communicationFormat, .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1, .dma_buf_count = 4, .dma_buf_len = 1024, .use_apll = false, .tx_desc_auto_clear = false, .fixed_mclk = 0 }; /* configure the GPIO pins */ this->pins = { .bck_io_num = this->bck, .ws_io_num = this->ws, .data_out_num = I2S_PIN_NO_CHANGE, .data_in_num = this->data }; }
下面是显示 BCLK 和 SDOUT 的示波器轨迹。 似乎只有一半的数据在 SDOUT 上发送:
更新:
我已更新 ASI_CH1 = 32、使其为 I2S 右侧时隙0、并已设置 ASI_CH2 = 0、使其为 I2S 左时隙0、现在我在 SDOUT 上看到更多数据:
基本上、我完全不知道我现在在做什么...