Hi All,
We are facing strange issue of loosing audio after ~10 hrs of playback.
Platform:: We have customized platform of SabreSD i.MX 6Q.
Audio Source connected on port-5 of AUDMUX as MASTER using I2S. Port-1 connected SSI-1. Hence, audio received from AudioSource chip -> PORT-5 -> PORT-1 -> SSI-1.
Audio Codec (playback) connected on Port-6 of AUDMUX as SLAVE using I2S. Port-2 connected SSI-2. Hence, audio playback through SSI-2 -> PORT-2 -> PORT-6 -> Audio Codec chip
Existing audio driver for recording path was SSI-1 -> MEMORY. Means one DMA channel setup for DMA_FROM_DEVICE.
We have introduced ASRC in between Recording path (SSI-1 -> ASRC -> MEMORY). So, we have setup two DMA channel; one for SSI-1 -> ASRC i.e. DMA_DEV_TO_DEV & second for ASRC -> MEMORY i.e. DMA_FROM_DEVICE at driver level.
We reference existing playback source code of DMA Channel setup for DMA_DEV_TO_DEV.
Bus width for above channels are DMA_SLAVE_BUSWIDTH_2_BYTES.
Modified clock source of ssi1_clk, ssi2_clk & ssi3_clk to pll4_audio_main_clk in clock.c file.
Now, in our android applicatin we receive recording samples using AudioRecord object & play those sample using AudioTrack. This task done in only one thread at application side.
Result:
After above setup we are able to play recoreded content for approx ~10 hrs. but after that we receive error: "Unvalid SDMA MODE" & audio lost.
As per this log, it seems that DMA channel for DMA_DEV_TO_DEV (SSI-1 -> ASRC) met with an error.We try to read reg value of SDMAARM_EVTERR (Ref pg. no-4871:: 55.20.10 -DMA Request Error Register (SDMAARM_EVTERR) i.MX 6Q RM).
Which suggest that error bit set for above channel; this probably means there is an overflow of data for that channel.
But we could not identify how its possible.
Can anybody help me out to find where we made mistake in setup of DMA channel ? What is the probable reason for above scenario ?
For everybody reference, i am attaching patch here-with.
Please go through it & give comments upon it.
-Ankit.
Original Attachment has been moved to: asrc_V1_for_fsl_community.zip
Hi Lei Ge,
In our case, at all position data format is same S16_LE &sample rate is 44100.
We are using two clock as source to ASRC (i.e config.inclk = INCLK_SSI1_RX, config.outclk = OUTCLK_SSI3_TX).
-Ankit.
Hi Lei Ge,
I am able to reproduce this issue "Audio LOST after ~10 hrs on i.MX 6Q" on SABRE-SD board.
I will give you patch of ASRC which uses two real time clock source(i.e config.inclk = INCLK_SSI1_RX, config.outclk = OUTCLK_SSI3_TX) & tinyalsa test to reproduce this issue.
-Ankit.
Hi Lei Ge,
I am able to reproduce the issue "Audio LOST after ~10 hrs on i.MX 6Q" on SABRE-SD board.
I am using Android source code of: IMX6_JB43_110_ANDROID_SOURCE_BSP provided by Freescale for SABRE-SD board.
I have used your patch attached here:: https://community.freescale.com/docs/DOC-100415 Followed all patch which mentioned in you link.
Here i am attaching patch (Audio_lost_using_ASRC_two_realtime_clock_P2P_channel_SABRESD.zip, include all patch mentioned in your link) which include modification i have done apart from your above patch to use two real time clock for ASRC:
Use 'tinycap' utility to capture only raw PCM data from console (provided in /system/bin).
As this utility 'tinycap' fwrite raw data in file, i have simply disabled fwrite code in 'tinycap' utility source code & created new 'tinycap' utility;which is attached here. Which simply do 'pcm_read() in while loop.
So, now ASRC uses two differenct real time clock source ( one is WM8962;send clock on SSI-2 & another is SSI-3) as input (i.e config.inclk = INCLK_SSI2_TX, config.outclk = OUTCLK_SSI3_TX). Based upon that it will do Sample rate conversion. (here in our case simply do a sync two clock as both clock are at 32*fs, where fs=44100).
ASRC configured as (32*fs); where fs=44100.
Use following command :: tinycap record_asrc.wav -D 0 -d 1 -c 2 -r 44100 -b 16
You can use your 'arecord' utility as well to reproduce this issue. (disable fwrite code in 'arecord' utility as well, because it will mess up stoarge on external storage).
Please provide us comment upon this.
-Ankit.
This is the log i received on SABRE-SD board after ~10 hrs.
/////////////////// start ////////////
root@sabresd_6dq:/extsd/ATP/tinyalsa_test # tinycap record_asrc.wav -D 0 -d 1 -c 2 -r 44100 -b 16
PCM OPEN with 16 bit
ssi3 B4: clock is 22579200 after = 22579200 REQUIRED:22579200
SSI3 ENABLED
###ASRC RECORD: P2P dma channel ID:0 CONFIGURED! ASRC RX ReqID:41, SSI RX ReqID: 17
###ASRC RECORD: P2M dma channel ID:1 CONFIGURED! ASRC TX ReqID:20
Capturing sample: 2 ch, 44100 hz, 16 bit
imx_hifi_trigger
####SRxF:1, Aif:35, Aof:32, SF:461046, Serr:5011, AF:20023, Aerr:200080
####SDMA_H_EVTERR: 2, ch:1, id:0
Unvalid SDMA MODE!
imx_hifi_trigger
SSI3 DISABLED
##ASRC CAPTURE snd_imx_pcm_hw_free
///////////////// end //////////////
Hi LeiGe,
Any comment for this issue?
-Ankit.
Hi LeiGe,
Sorry for late reply... But this issue is still not resolved.
I applied above patch & didn't swap gReg0 & gReg1. But issue still occurs.
-Ankit.
Hi,
Lei Ge
Thanks for this patch we will apply this patch and provide you update.
Thanks
Saurabh/Ankit
Ankit,
Could you try 3.10.17 GA kernel?
check on going
Hi Lei Ge,
Any comments upon above reply ??
-Ankit.
Hi Lei Ge,
I have apply your patch mentioned here (patch-1 & patch-2) -> https://community.freescale.com/docs/DOC-100658
This patch is *not* uses two different real time clock source to ASRC. This patch is simply doing Sample rate conversion for what ASRC configured for.
We want to use ASRC to do sample rate conversion using two different real time clock source. [i.e on sabre-sd one codec (wm8962) sending audio data & clocking to SSI-2 (capture path), while other codec (here not connected but assume it connected) playing audio data & clocking using SSI-3 (i.e).
Here i am attaching patch:
patch-ssi3:: only_ssi3.patch
This only_ssi3.patch is based on above mentioned patch(patch-1 & patch-2). Explanation of this patch & change files is mentioned in my above reply.
Even after applied your patch + little modification for ASRC, "Unvalid SDMA MODE!" error occurs after ~10 hrs & audio stop capture because of P2P channel was off by SDMA.
We want to sync & sample rate conversion of two different clock source using ASRC.
The incoming audio data to this chip (imx6q) may be received from various sources at different sampling rates (capture codec). The outgoing audio data of this chip may have different sampling rates and it can also be associated with output clocks that are asynchronous to the input clocks. [Chapter 15 Asynchronous Sample Rate Converter (ASRC)].
Please review our patch & give comment upon this.
-Ankit.
hi
https://community.freescale.com/docs/DOC-100415 this patch is wrong.
https://community.freescale.com/docs/DOC-100658 this patch is right for SSI_ASRC_2P capture.
memory <-- ASRC_Output FIFO | ASRC_Input FIFO <-- SSI_RX FIFO <-- Audio Codec
| |
ASRC Out clk ASRCK1 <---| |---> ASRC In clk None
| |
ASRC OutPut width | | ASRC InPut width and data format
is set by arecord <---| |---> is set by ASRC P2P parameter
parameter | |
| |
support 44100/48000 | | support 44100/48000
and S24_LE/S16_LE <---| |---> and S24_LE/S16_LE
You can use:
arecord -Dhw:0,1 -c 2 -f S16_LE/S24_LE -r 44100/48000 XXX.wav
aplay XXX.wav
to test this patch.
i use ssi slave mode and
179 config.inclk = INCLK_NONE;
180 config.outclk = OUTCLK_SSI2_TX;
Hi Lei Ge,
You had setup SSI->ASRC->Mem for non-realtime streaming audio (where the input sampling rate clocks avoided by setting ideal-ratio values into ASRC interface registers)
We need to setup realtime streaming audio (where both input and output clocks need to be available and activated).
In our case, both clocks are given to ASRC (config.inclk = INCLK_SSI1_RX , config.outclk = OUTCLK_SSI3_TX).
-Ankit.
hi, when i use S24_LE, the voice captured is much bigger in one channel than the other, do you have such issue?
static const struct asrc_p2p_params ssi_p2p = {
.p2p_rate = 44100,
.p2p_width = ASRC_WIDTH_24_BIT,
};
i am now adding and testing SSI ASRC P2P for capture in our sebresd board now , for about half day now, so far, no such 'unvalid sdma mode' issue found.
I am now adding SSI ASRC P2P for capture in our sebresd board too, i will test if this issue happens in our board.
i use this command for test under linux:
arecord -Dhw:0,1 -c 2 -f S16_LE -r 44100 | aplay
hi, what format do you use, S16_LE or S24_LE?
Hi Lei Ge,
We use S16_LE
-Ankit.