This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Issue on AIC codec with IPNC V2.6

Expert 1840 points
Other Parts Discussed in Thread: TLV320AIC3101

Hi,

I am working with DM368 IPNC. We are using V2.6 software. Previous, we support to use internal codec of SOC but now we move to use external codec AIC3x.

For that change we modified the kernel config as below

# CONFIG_SND_DM365_INTERNAL_CODEC=y

# CONFIG_SND_SOC_CQ0093VC=y

CONFIG_SND_DM365_EXTERNAL_CODEC=y

CONFIG_SND_SOC_TLV320AIC3101=y

 

With the new kernel, we can play audio for alarm function in IPNC but micro and audio stream didn't work. I saw the error message from log whenever we turn on audio.

ERROR  (drv_audio.c|DRV_audioRead|157): audio error from read : Resource temporarily unavailable

ERROR  (audioThr.c|AUDIO_audioTskMain|684): AUDIO_audioTskRun()

We knew that we got problem during read data from driver and the function DRV_audioRead always return -11.

does Any one have experience for this? PLease share me what you know.

 Thank you so much!

  • Please change the macro 'NUM_CHANNELS' as shown below,

    File: audioThr.c

    #define NUM_CHANNELS (1)     ->    #define NUM_CHANNELS (2)

    Good luck~!

  • hi,

    I really thanks for your sharing. Do you have some experiences to the AIC audio gain? By this modification, the audio worked but the audio volumn adjustment may not affect.

    Thank you so much!

  • You can change the audio volumn of left and right channel as below.

    <audio in>

    amixer -c 0 sset 'Left MIC to Left Input',0 100%

    amixer -c 0 sset 'Right MIC to Right Input',0 100%

     

    <audio out>

    amixer set 'PCM' 100%

  • hi,

    Firstly, I wanna show my big thanks for your help. I tried the amixer and figure out your command didn't work in my case with audio out.

    But instead of that the command:  

    amixer -c 0 sset 'Line DAC',0 X% 

    worked correctly.

    Thanks again for your hint. From your name, I guess you are korean. If you are now staying in Seoul I will be very happy to invite you a coffee.

  • hi TaeHo Kim89108, I met the same problem with bioz ,Under your proposal,I changed NUM_CHANNELS to 2, audio data can be reiveived, but there is a new problem. When I delete audio task,there is an error below: Alignment trap: av_server.out (568) PC=0x401aba28 Instr=0xe591300c Address=0xfec 77b47 FSR 0x001 and once the error occored, I cann't begin audio task again. Is there someting else to be changed except NUM_CHANNELS ? In this program, i opend a capture and playback audio device, is that playback device caused this problem? NUM_CHANNELS of playback device should be set to 1 or 2?

  • hi, Pen Zeng1

    Did you delete the audio task except the video task?

    I think the problem is memory reference error...but I don't know why right now.

    I will reply to you if I find a solution.

    Good luck..!

  • You're welcome.. late reply..

    I'm a Korean. But I live in Daejeon :D

    Thank you for your kindness.

    Good luck~!

  • I have just gone to Boryeng Mud festival last weekend :).

    Glad to know you and hope to see you one day.

  • Hi,TaeHo Kim89108

    When I run 

    OSA_tskSendMsg(&gAUDIO_ctrl.audioTsk, pTsk1, AVSERVER_CMD_CREATE, NULL, OSA_MBX_WAIT_ACK); nad 

    OSA_tskSendMsg(&gAUDIO_ctrl.audioTsk, pTsk1, AVSERVER_CMD_START, NULL, OSA_MBX_WAIT_ACK);

    to create and start audio task, the capture device is running, but when i DELETE the audio tast,that is

    OSA_tskSendMsg(&gAUDIO_ctrl.audioTsk, pTsk1, AVSERVER_CMD_DELETE, NULL,OSA_MBX_WAIT_ACK);

    an error occored as below:

    AUDIO: Received CMD = 0x0301

    AUDIO: Delete...
    AUDIO_audioTskDelete
    *** glibc detected *** ./av_server.out: free(): invalid next size (normal): 0x00380d28 ***

    And I print the  gAUDIO_ctrl.inputBuffer pointer which is created by AUDIO_audioTskCreate() the pointer value is just 0x00380d28.

    The video task is allways running when start up and not closed.

    int AUDIO_audioTskCreate()
    {
    int ret = OSA_EFAIL;
    DRV_AudioConfig Audioconfig;

    Audioconfig.deviceId = 0;
    Audioconfig.numChannels = NUM_CHANNELS;
    Audioconfig.samplingRate = SAMPLE_RATE;
    Audioconfig.buff_Of_Samples = NUMSAMPLES;

    ret = DRV_audioOpen(&gAUDIO_ctrl.audioHndl, &Audioconfig);
    if( ret != OSA_SOK )
    {
    return ret;
    }

    gAUDIO_ctrl.streamId = ALG_AUD_CODEC_G711;
    gAUDIO_ctrl.encodedBuffer = (short *)OSA_cmemAlloc(ENCODEDBUFSIZE,32);
    if (gAUDIO_ctrl.encodedBuffer == NULL)
    {
    OSA_ERROR("Failed to allocate encodedBuffer\n");
    return OSA_EFAIL;

    }

    /* Allocate input buffer */
    gAUDIO_ctrl.inputBuffer = OSA_memAlloc(INPUTBUFSIZE);
    if (gAUDIO_ctrl.inputBuffer == NULL)
    {
    OSA_ERROR("Failed to allocate input buffer\n");
    return OSA_EFAIL;
    }
    return OSA_SOK;
    }

    int AUDIO_audioTskDelete()
    {
    DRV_audioClose(&gAUDIO_ctrl.audioHndl);
    if( gAUDIO_ctrl.inputBuffer )
    {
    OSA_memFree(gAUDIO_ctrl.inputBuffer);
    }


    if( gAUDIO_ctrl.encodedBuffer )
    {
    OSA_cmemFree((Uint8 *)gAUDIO_ctrl.encodedBuffer);
    }

    return OSA_SOK;
    }

  • hi, I am working with DM368 IPNC. We are using V2.6 software,to. For your change we modified ehe kernel config as yours,and change NUM_CHANNELS from 1 to 2,but the record is wrong . My MCLK is from CLKOUT1,24MHZ,MIC in use MIC2. Can you tell me where am I wrong???