I'm curious as to why i2s_config_t doesn't allow a bits_per_sample of 8. Given that the DAC pins are only 8 bits, surely it would make sense?
It means that we have to either pad our samples or store/transmit twice as much data as we need.
I2S: why no 8 bits per sample?
Re: I2S: why no 8 bits per sample?
OK, I thought I solved things just now, but apparently not. I've got
But I get an assertion error, with the message
How do I fix this?
Also, I'm confused as to how I should set .dma_buf_count and .dma_buf_len. I assume it's got something to do with how you can buffer input, but the documentation doesn't decribe how to set or use them. They're just kinda magic numbers as far as I'm concerned.
Code: Select all
static const int i2s_num = 0; // i2s port number
#define RATE 8000
static const i2s_config_t i2s_config = {
.mode = I2S_MODE_MASTER | I2S_MODE_TX | I2S_MODE_DAC_BUILT_IN,
.sample_rate = RATE,
.bits_per_sample = I2S_BITS_PER_SAMPLE_8BIT,
.channel_format = I2S_CHANNEL_FMT_ONLY_LEFT,
.communication_format = I2S_COMM_FORMAT_I2S,
.intr_alloc_flags = 0, // default interrupt priority
.dma_buf_count = 8,
.dma_buf_len = 64,
.use_apll = false
};
ret = i2s_driver_install(i2s_num, &i2s_config, 0, NULL);
assert(ret == ESP_OK);
Code: Select all
E (7650) I2S: Invalid bits per sample
Also, I'm confused as to how I should set .dma_buf_count and .dma_buf_len. I assume it's got something to do with how you can buffer input, but the documentation doesn't decribe how to set or use them. They're just kinda magic numbers as far as I'm concerned.
Re: I2S: why no 8 bits per sample?
Just a follow-up. Here is sets the bits per sample to be 8:
https://esp-idf-zh.readthedocs.io/zh_CN ... s/i2s.html
I still couldn't get my code to work properly, though.
https://esp-idf-zh.readthedocs.io/zh_CN ... s/i2s.html
I still couldn't get my code to work properly, though.
Who is online
Users browsing this forum: No registered users and 109 guests