Interfacing Codec with ESP32

anurag.telkar
Posts: 1
Joined: Thu Dec 29, 2016 11:01 am

Interfacing Codec with ESP32

Postby anurag.telkar » Thu Dec 29, 2016 11:37 am

Hi,

Can any one please tell me how to start work on CODEC using ESP32.

Thank you in advance.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: Interfacing Codec with ESP32

Postby kolban » Thu Dec 29, 2016 2:44 pm

As I understand it, a "codec" is a technical word for a an coder/decoder ... see: https://en.wikipedia.org/wiki/Codec

If this is your meaning, then there is no such thing as "THE" codec ... but rather "a codec". What kind of data stream are you planning on receiving as input or output and what do you wish to encode it from/to?
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: Interfacing Codec with ESP32

Postby WiFive » Thu Dec 29, 2016 11:02 pm


User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: Interfacing Codec with ESP32

Postby rudi ;-) » Thu Dec 29, 2016 11:57 pm

anurag.telkar wrote: Can any one please tell me how to start work on CODEC using ESP32.
hi
not sure too what you mean in detail,
but if you mean "how to make a code for the esp32" you can create code in many ways, and many programming languages
examples:
with
-> arduino ide
-> esp-idf and an code editor like eclipse
-> and many more

for start your program then on the esp32 you need to make a binary firmware from your code.
this is done example in arduino ide auto with the button compile and upload.

you can do this manual too example with esp-tool

your binary firmware then is going on upload to the serial flash

perhabs you describe in detailed what you mean with "to start on CODEC using ESP32"
and if you search the first steps to code programms for using esp32, which programming language you know or want to start.
example c, c++, microPython, JavaSrcipt, Basic and so on and on.

if there is an interpreter ready to use for others, then we can make proposals in next steps in programming environment.

hope this helps
best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

dom124
Posts: 2
Joined: Tue Dec 20, 2016 1:51 pm

Re: Interfacing Codec with ESP32

Postby dom124 » Mon Jan 02, 2017 9:41 pm

Hi!, i want to know if is possible to implement a i2s slave communication... I need to receive data from a microcontroller via i2s bus, and send data from the ESP. i have implemented the code that you propose here and it works fine to sending data but now i need to implement in the other I2S port the slave mode. Can you help me to begin with these?
Thanks!
Carlos

BakerMan
Posts: 9
Joined: Tue Jan 24, 2017 1:26 pm

Re: Interfacing Codec with ESP32

Postby BakerMan » Fri Feb 03, 2017 2:40 pm

Hello Folks,

at the moment i work on a kind of pcm to uart bridge. There is already a post for making a DIY Interface using the second CPU without scheduler in an infinity loop. http://www.esp32.com/viewtopic.php?f=2&t=764

As long as i dont recieve uart data the transmission on my non standard pcm interface works fine. Ill have to look for an other solution. At the moment iam trying to make the i2s device running as slave. Due to the lack of documentation of that interface ive tried a lot for my own. I build a "pcm" test generator (clk, ws, data) with an arduino, which sends the sample 55 33 0F 55 continusly with a sample rate of 8kHz. The ESP32-I2S works fine as master, but as slave on my testgenerator it dont work. Ive build the exact waveforms like the i2s master sends out. Nothing happens! My Code:

Code: Select all


i2s_config_t i2s_config = {
    .mode = I2S_MODE_SLAVE | I2S_MODE_TX,
    .sample_rate = 8000,
    .bits_per_sample = 16,                                    //16, 32
    .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT,             //format LEFT_RIGHT
    .communication_format = I2S_COMM_FORMAT_PCM | I2S_COMM_FORMAT_PCM_SHORT,
    .intr_alloc_flags = ESP_INTR_FLAG_LEVEL1,
    .dma_buf_count = 8,
    .dma_buf_len = 256
};

i2s_pin_config_t pin_config = {
      .bck_io_num = 26,
      .ws_io_num = 25,
      .data_out_num = 22,
      .data_in_num = I2S_PIN_NO_CHANGE
};

i2s_driver_install(i2sNum, &i2s_config, 0, NULL);   //install and start i2s driver
i2s_set_pin(i2sNum, &pin_config);

char sample[4] = {0x55, 0x33, 0xF0, 0x55};
char *samplePTR = &sample;

i2s_start(I2S_1_TX);

	while(true) {
		i2s_write_bytes(I2S_1_TX, sample, 8, 10);
		//i2s_push_sample(I2S_1_TX, sample2PTR, 10);
	}
It doesnt matter if i use write bytes oder push, it wont work in slave mode, but runs well in master mode.

What did i wrong? It seems that the EPS dont accept my external clock and ws signal?

Can you help me in that matter?

Kind regards

Who is online

Users browsing this forum: Bing [Bot] and 132 guests