Restart Q64 when trying to play the AMR data


#1

Hello.

I am using Q64 module, Open AT OS version : 6.37.0, Firmware Version: 7.47.0.
i have tried to modify functions HandleRecordCmd and fnHandlePlayCmd in pcm_record_and_play sample for record and play the AMR data in this way:

....
[b]static void HandleRecordCmd ( u8 Source )[/b]
{
    ....
    RetVal = adl_audioSetOption ( RecordResourceHandle,
    		ADL_AUDIO_AMR_MIXED_VOICE, FALSE );
    RetVal = adl_audioSetOption ( RecordResourceHandle,
    		ADL_AUDIO_AMR_SPEECH_CODEC_RATE, ADL_AUDIO_AMR_RATE_5_15 );
    BufferSizeListen = 14;
    RetVal = adl_audioSetOption ( RecordResourceHandle,
    		ADL_AUDIO_AMR_BUFFER_SIZE, BufferSizeListen );
    ....
        StreamBufferListen = adl_memGet ( BufferSizeListen );
    ....
        PcmBufDelete ( &ListenPlayBuffer );

        /* Initialize the common buffer */
        if ( PcmBufInit ( &ListenPlayBuffer, (5*50*14) ) == FALSE )
        {
            TRACE ( ( PCM_TRACE_LEVEL,
                      "cbAppRecordCmdHandler: fnPcmBufInit failed" ) );
        }

        /* Start listening */
        RetVal = adl_audioStreamListen ( RecordResourceHandle,
        				ADL_AUDIO_AMR, AppListenLowIrqHandle,
                        AppListenHighIrqHandle, StreamBufferListen );
    ....
}
....
[b]static void fnHandlePlayCmd ( u8 AudioDestination )[/b]
{
    ....
    RetVal = adl_audioSetOption ( PlayResourceHandle,
    		ADL_AUDIO_AMR_MIXED_VOICE, FALSE );
    RetVal = adl_audioSetOption ( PlayResourceHandle,
    		ADL_AUDIO_AMR_SPEECH_CODEC_RATE, ADL_AUDIO_AMR_RATE_5_15 );
    /* Get Buffer size for Play and initialize a buffer */
    BufferSizePlay = 14;
    RetVal = adl_audioSetOption ( PlayResourceHandle,
    		ADL_AUDIO_AMR_BUFFER_SIZE, BufferSizePlay );
    ....
        StreamBufferPlay = adl_memGet ( BufferSizePlay );
    ....
            RetVal = adl_audioStreamPlay ( PlayResourceHandle,
                            ADL_AUDIO_AMR, AppPlayLowIrqHandle,
                            AppPlayHighIrqHandle, StreamBufferPlay );
    ....
}

Recording from the microphone is successfully, but when you try to play the recorded data is the restart of the module.
These are the traces:

2013/01/15;16:17:38:796;001;ADL;1;cbAppPlayCmdHandler: SPEAKER
2013/01/15;16:17:38:812;002;ADL;1;cbAppPlayCmdHandler: BufferSizePlay: #14
2013/01/15;16:17:39:359;001;HAC;1;ARM Data Abort caught at 0026059E, Current Task 0x1D by CP15 
2013/01/15;16:17:39:375;001;RTK;1;================== RTK STATUS start ================== 
2013/01/15;16:17:39:375;002;RTK;1;================== RTK STATUS end ================== 
2013/01/15;16:17:41:640;006;ADL;1;Binary header at 00260000
2013/01/15;16:17:41:656;001;ADL;1;PCM_RecordAndPlay: Test Application
2013/01/15;16:17:41:656;002;ADL;1;Jan 15 2013
2013/01/15;16:17:41:656;003;ADL;1;15:04:23

Help me, please. Where there may be a bug. Or give an example of the code.
Thank you.


#2

Hi,

It should be noted that the size of AMR buffer should be equal to the AMR samples that need to be listened and played.

Please do check in your application that the size of buffer is not small.
Also the buffer size should match with the codec rate.
According to the selected codec rate, the buffer has to be defined with a multiple of one speech frame size.

Also you can capture the backtraces and see that what could be the cause of reset.

Thanks.


#3

What size buffer should be for codec ADL_AUDIO_AMR_RATE_12_20?
Where can be seen a working example of playing AMR?
Thanks.