I2S: how to enable PDM to PCM converter?

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

I2S: how to enable PDM to PCM converter?

Postby newsettler_AI » Sun May 27, 2018 9:51 pm

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.

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

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

Postby newsettler_AI » Wed May 30, 2018 10:41 am

Any updates?

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

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

Postby fly135 » Wed May 30, 2018 3:00 pm

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

newsettler_AI
Posts: 121
Joined: Wed Apr 05, 2017 12:49 pm

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

Postby newsettler_AI » Thu May 31, 2018 12:30 pm

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);

User avatar
fly135
Posts: 606
Joined: Wed Jan 03, 2018 8:33 pm
Location: Orlando, FL

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

Postby fly135 » Thu May 31, 2018 4:42 pm

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

Who is online

Users browsing this forum: Baidu [Spider] and 127 guests