Page 1 of 1

I2S: how to enable PDM to PCM converter?

Posted: Sun May 27, 2018 9:51 pm
by newsettler_AI
Hi,

How can I enable hardware PDM to PCM converter?

I found this settings in IDF:
https://github.com/espressif/esp-idf/bl ... /i2s.h#L84

but I didnt locate any function that actually use this enum.

Re: I2S: how to enable PDM to PCM converter?

Posted: Wed May 30, 2018 10:41 am
by newsettler_AI
Any updates?

Re: I2S: how to enable PDM to PCM converter?

Posted: Wed May 30, 2018 3:00 pm
by fly135
It's a flag "I2S_MODE_PDM = 64" in the i2s_mode_t structure in the i2s_config_t structure, passed to the "i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, int queue_size, void* i2s_queue);" function.

After checking your link I see it's not in your branch of the SDK.

John A

Re: I2S: how to enable PDM to PCM converter?

Posted: Thu May 31, 2018 12:30 pm
by newsettler_AI
fly135 wrote:It's a flag "I2S_MODE_PDM = 64" in the i2s_mode_t structure in the i2s_config_t structure, passed to the "i2s_driver_install(i2s_port_t i2s_num, const i2s_config_t *i2s_config, int queue_size, void* i2s_queue);" function.

After checking your link I see it's not in your branch of the SDK.

John A
So, in case this flag is set, converter will be enabled?

I'm not sure how can I set it.
Should I jsut add I2S_MODE_PDM in MODE section?

Code: Select all

	 i2s_config_t i2s_config = {
        .mode = I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN | I2S_MODE_ADC_BUILT_IN | I2S_MODE_PDM,
        .sample_rate =  EXAMPLE_I2S_SAMPLE_RATE,
        .bits_per_sample = EXAMPLE_I2S_SAMPLE_BITS,
	    .communication_format = I2S_COMM_FORMAT_I2S_MSB,
	    .channel_format = EXAMPLE_I2S_FORMAT,
	    .intr_alloc_flags = 0,
	    .dma_buf_count = 2,
	    .dma_buf_len = 1024
	 };
	 //install and start i2s driver
	 i2s_driver_install(i2s_num, &i2s_config, 0, NULL);

Re: I2S: how to enable PDM to PCM converter?

Posted: Thu May 31, 2018 4:42 pm
by fly135
That is correct. Except don't think you need the DAC (or TX if just reading mic) flags.

I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM

John A