UART does not work together with amr codec

utkutpcgl
Posts: 8
Joined: Tue Nov 17, 2020 5:17 am

UART does not work together with amr codec

Postby utkutpcgl » Tue Nov 17, 2020 8:06 am

Hello.
Since I could not receive an answer in the github webpage of esp-adf, I ask this question here also. I have the following pipeline:
microphone -> i2s_stream_read -> (input_buffer1) -> amrwb_encoder ->amrwb_decoder ->(input_buffer2) ->i2s_stream_write -> speaker
and I use UART1 with TX as GPIO 25 and RX as GPIO26. UART works fine solely. But when the pipeline starts, it stops working (can not write to TX buffer or read from RX buffer). Also, when I first start the pipeline, afterward when I start UART there no sound at the speaker although the ring buffers are still passing data.

By starting the pipeline I mean:

//to record
audio_element_run(i2s_stream_reader);
audio_element_run(amr_encoder);
//audio_element_run(algo_stream);

//to play
audio_element_run(amr_decoder);
audio_element_run(i2s_stream_writer);

//to record
audio_element_resume(i2s_stream_reader, 0, portMAX_DELAY);
audio_element_resume(amr_encoder, 0, portMAX_DELAY);
//audio_element_resume(algo_stream,0,0);
//to play
audio_element_resume(amr_decoder, 0, portMAX_DELAY);
audio_element_resume(i2s_stream_writer, 0, portMAX_DELAY);
And by starting UART I mean:

uart_driver_install(EX_UART_NUM, BUF_SIZE * 2, BUF_SIZE * 2, 20, &uart1_queue, 0);
uart_param_config(EX_UART_NUM, &uart_config);

//Set UART pins (using UART0 default pins ie no changes.)
uart_set_pin(EX_UART_NUM, T1XD_PIN, R1XD_PIN, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
I do not think it is about their priority, but in case it helps:
The priority for the amr_encoder is 6 and amr_decoder is 7 (task priority). The Interrupt allocation priority of UART is 3.

I suspect the codec does not work fine together with UART 1 in my configuration. Also, normally when the codec is active, there is an error saying that amrwb did not let the wathdog timer to be reset. Any help is appreciated. I can share more info if necessary. Thanks in advance.

I Lyrat, espidf 4.1, latest espadf.

utkutpcgl
Posts: 8
Joined: Tue Nov 17, 2020 5:17 am

Re: UART does not work together with amr codec

Postby utkutpcgl » Sat Mar 06, 2021 5:19 am

solved...

Airtau
Posts: 1
Joined: Mon Mar 15, 2021 12:44 pm

Re: UART does not work together with amr codec

Postby Airtau » Mon Mar 15, 2021 12:47 pm

Hello.
How did you solve this problem?

Who is online

Users browsing this forum: No registered users and 17 guests