微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 无线和射频 > TI WIFI设计交流 > wifi_audio_app移植问题

wifi_audio_app移植问题

时间:10-02 整理:3721RD 点击:

ti工程师们好!

       我修改了wifi_audio_app程序,把编解码芯片改成wm8960,取消了里面的按键程序和网络传输。由于手头上只有一个板子,想修改程序实现一个板子上将输入的音频输出。在main函数中把跟网络和按键有关的函数都注释了,加了    g_ucMicStartFlag = 1;g_ucSpkrStartFlag = 1;g_loopback = 1。现在遇到的问题是播放没声音,调试的时候发现没进DMA中断函数。main函数如下:

int main()
{  
    long lRetVal = -1;
    unsigned char RecordPlay;
    BoardInit();

    //
    // Pinmux Configuration
    //
    PinMuxConfig();

    RecordPlay = I2S_MODE_RX_TX;
    g_ucMicStartFlag = 1;
    g_ucSpkrStartFlag = 1;
    g_loopback = 1;

    if(RecordPlay == I2S_MODE_RX_TX)
    {
        pRecordBuffer = CreateCircularBuffer(RECORD_BUFFER_SIZE);
        if(pRecordBuffer == NULL)
        {
            //UART_PRINT("Unable to Allocate Memory for Tx Buffer\n\r");
            LOOP_FOREVER();
        }
    }

    /* Play */
    if(RecordPlay & I2S_MODE_TX)
    {
        pPlayBuffer = CreateCircularBuffer(PLAY_BUFFER_SIZE);
        if(pPlayBuffer == NULL)
        {
            //UART_PRINT("Unable to Allocate Memory for Rx Buffer\n\r");
            LOOP_FOREVER();
        }
    }


    //
    // Configure Audio Codec
    //
    WM8960_Init();


    //
    // Initialize the Audio(I2S) Module
    //   

    AudioInit();

    //
    // Initialize the DMA Module
    //   
    UDMAInit();


    //if(RecordPlay == I2S_MODE_RX_TX)
    if(RecordPlay & I2S_MODE_TX)
    {
        UDMAChannelSelect(UDMA_CH5_I2S_TX, NULL);
        SetupPingPongDMATransferRx(pPlayBuffer);
    }
    //if(RecordPlay & I2S_MODE_TX)
    if(RecordPlay == I2S_MODE_RX_TX)
    {
        UDMAChannelSelect(UDMA_CH4_I2S_RX, NULL);
        SetupPingPongDMATransferTx(pRecordBuffer);
    }

    //
    // Setup the Audio In/Out
    //    
    lRetVal = AudioSetupDMAMode(DMAPingPongCompleteAppCB_opt, \
                                 CB_EVENT_CONFIG_SZ, RecordPlay);
    if(lRetVal < 0)
    {
        //ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }   
    AudioCaptureRendererConfigure(AUDIO_CODEC_16_BIT, 16000, AUDIO_CODEC_STEREO, RecordPlay, 1);

    //
    // Start Audio Tx/Rx
    //    
    Audio_Start(RecordPlay);

    //
    // Start the simplelink thread
    //
    //lRetVal = VStartSimpleLinkSpawnTask(9);
    //if(lRetVal < 0)
    //{
    //    ERR_PRINT(lRetVal);
    //    LOOP_FOREVER();
    //}


    //
    // Start the Network Task
    //   
    //lRetVal = osi_TaskCreate( Network, (signed char*)"NetworkTask",\
                               OSI_STACK_SIZE, NULL,
    //                           1, &g_NetworkTask );
    //if(lRetVal < 0)
    //{
    //    ERR_PRINT(lRetVal);
    //    LOOP_FOREVER();
    //}

    //
    // Start the Control Task
    //    
    //lRetVal = ControlTaskCreate();
   // if(lRetVal < 0)
    //{
    //    ERR_PRINT(lRetVal);
    //    LOOP_FOREVER();
    //}


    //
    // Start the Microphone Task
    //      
    lRetVal = osi_TaskCreate( Microphone,(signed char*)"MicroPhone", \
                               OSI_STACK_SIZE, NULL,
                               1, &g_MicTask );
    if(lRetVal < 0)
    {
        //ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the Speaker Task
    //
    lRetVal = osi_TaskCreate( Speaker, (signed char*)"Speaker",OSI_STACK_SIZE, \
                               NULL, 1, &g_SpeakerTask );
    if(lRetVal < 0)
    {
        //ERR_PRINT(lRetVal);
        LOOP_FOREVER();
    }

    //
    // Start the task scheduler
    //
    osi_start();     
}

建议在仿真状态查看DMA的相关设置

//As don't have expertise on Audio codec, so it is best to post query in TI-Audio codec((AIC3254) ) forum to know how to configure PLL related configuration.
//特别注意:
//(1)PLAY_WATERMARK宏定义修改 reducing latency or delayed playback 回放延时问题--注意需要修改两个地方!network+pcm_handler
// 详见(Wifi Audio App 8k sample rate delayed playback) https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/p/394864/1400223#1400223
//(2)Unicast通过mDNS获取目的IP地址进行一对一的音频播放,而MuitiCast则采用mDNS的IP地址224.0.0.251进行广播音频数据
//(3)mDNS使用服务器开启及客户端请求问题
// 详见(CC3200 WiFi Audio App) http://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/438276
// 详见(How 2 CC3200s get each other IP address?) http://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/p/400118/1415303#1415303
//(4)回放模式设置
// (Using Audio booster pack wifi demo app example CC3200) http://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/390582#pi239031348=2&pi239031350=3
//(5)操作步骤
//<1>按下复位键(SW1)
//<2>按下发射板的 SW3 键,绿灯长亮
//<3>再按下接收板的 SW2 键,黄灯长亮,红灯也长亮
//此时发射板的红灯及黄灯熄灭,绿灯常亮表示发射板正在传输音频,接收板绿灯熄灭,黄灯及红灯常亮表示正在接收音频
//(6)关于双向音频流控制
//(does the wifi audio sample really running on bidirectional?) http://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/402341

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top