Post Go back to editing

Send audio data through UART in ADSP-BF706 EZ-MINI

Category: Software
Product Number: ADSP-BF706 EZ-MINI
Software Version: CCES 2.11.0

I am using TalkThrough example in ADSP-BF706. It was working fine but i need to send audio data through UART.  I want like data from CODEC need to send to TX - UART, from TX -UART to RX-UART and then send to CODEC. So i am new to this please anyone help me in this.

Parents
  • Hi

    I am sharing the block diagram of Codec and Uart communication. So i am using the TalkThrough example and loopback UART example for this. I am getting some Noise data from UART. So please anyone help me in resolving the issue.

  • Hello,

    Apologies for the delay in response. Initially the thread was in different community and we didn't get a notification for that.

    From your query we understand that you are using BF706 mini kit and want to pass codec data to UART TX, pass those data to UART RX and send to DAC. For your requirement, could you please let us know what are the hardware changes you have done in the kit. Also please share us test code for simulating the noisy results. This would be helpful for us to assist you further.

    Regards,
    Santhakumari.K

  • Hi Santhakumari,

    Thanks for replying, I have changed codec setting in sigma studio. Now i am using the audio Callback example for my application. I am attaching the latest code changes and the codec changes. Now i am getting audio from UART but audio quality is not good. Whenever audio is present, background noise is added. So please go through the attachments and suggest me if i am doing anything wrong or anything i need to do for betterment on audio quality. 

    AudioFilter_Callback_BF706Mini.rarBF706Mini.dspproj

  • Hello Leela,

    When we run the project in BF706 mini kit ("AudioFilter_Callback_BF706Mini), we got "Error 13" message in console window.

    Please share us what are the hardware changes you have done in the board.

    Then we have reviewed your code. From there we understood that you are receiving audio data in sport and send to UART.

    Could you please let us know the reason for introducing UART here. What kind of synchronization mechanism you are following while receiving data from SPORT and send it to UART.

    And inside UART_transmit() function call, you are using blocking API adi_uart_Write()

    When we are using this API, application will block here till write process is completed. But before that you might have got data from SPORT. Please check that code. Also please explain us how you are choosing Tx and Rx buffer size and how you are filling data into buffers.

    For enabling auto buffer mode, you have included baremetal code in your application.

    Please find the updated driver file for SPORT which includes the provision for buffer repetition enable functionality.

    The adi_pdma_EnableBufferRepeat API enables the buffer repetition when a driver uses buffer queuing APIs such as "adi_pdma_PeripheralWrite" and "adi_pdma_PeripheralRead" for DMA buffer submission. When buffer repetition is enabled, the DMA channel will keep on processing (repeating) the last two buffers submitted. In that case there is no need to resubmit the buffers again and again.

    Kindly replace the attached file with the existing file in C:\Analog Devices\CrossCore Embedded Studio <version>\SHARC\lib\src\drivers\Source\sport and then rebuild the project. Also ensure that you have installed the "SPORT Driver for Sharc" add-in via system.svc to the project and take a backup of your adi_sport_bf6xx.c file for future use.
    This would be helpful for us to assist you further.

    Also please set a breakpoint in DmaDataIntHandler() API, before clearing status bit. Here you can identify any error bit is set while performing DMA operation.

    Hope this helps.

    1538.adi_sport_bf6xx.zip

    Best Regards,
    Santhakumari

  • Hi,

    I am using updated Blackfin SPORT driver file.

    Error 13 is UART error, if the UART is not connected properly or baud rate is mismatched at that time this error will come.

    i did hardware changes as per below link. Connecting  P9 TX, RX and Gnd.

    https://ez.analog.com/dsp/blackfin-processors/bf70x/f/discussions/90200/bf706-uart-port 

    Now I am connecting one BF706-ezmini kit with another BF706-ezmini kit. My project requirement is to send data through UART interface between 2 analog boards. For BF706-ezmini kit only UART interface is available to transmit data from one board to another board. I am not using any synchronization mechanism while receiving data from SPORT and send it to UART.

     adi_uart_Write() API will write data to UART, if i use adi_uart_SubmitRxBuffer() API audio is not proper because data is not submitting properly to UART. 

    Please check this and let me know where i am doing wrong.

    Thanks,

    Shivaleela

  • Hi Shivaleela,

    From your query we understood that you need to send audio data between two ADSP-BF706 Ezkit mini. For this you are trying to use UART for data transfer. Generally audio sample is coming continuously from codec, your core should receive all samples via SPORT. Here you are calling blocking API(adi_uart_Write()), it leads to block the core until it completes the work. Because of that some samples of the codec might be missed by SPORT. This may be the cause of noisy audio output. Unfortunately, we can't test your shared project in our BF706 Ezkit mini hardware platform. So please try to use non-blocking APIs for UART submission.

    We suggest you to use SPORT for send audio data between two ADSP-BF706 Ezkit mini. It is especially designed for audio communication and it is very high speed serial communication peripheral. Please refer the serial-port chapter in hrm for more details from below link: www.analog.com/.../BF70x_BlackfinProcessorHardwareReference.pdf

    we misunderstood your application that's why we suggested you to change the adi_sport_bf6xx.c file in the last response. Now from your application we understood that no need to change the file. Can you please revert it back. Sorry for confusion caused here.

    Please try and let us know how you are getting on.

    Regards,
    Santhakumari.K

  • Hi Santhakumari,

    Thank you so much for reply.

    I am using blocking API(adi_uart_Write()) to transmit the audio data but if i use non blocking API(adi_uart_SubmitRxBuffer()), facing  ADI_UART_SUBMIT_FAILED error. It is because of buffer is in use, it is mentioned in this function(static ADI_UART_RESULT SubmitBuffer). If i resolve this issue by giving (pBufInfo->bInUse = false) ,then i will get DMA error. Here i am not getting what to do.

    I am using SPORT with CODEC, i don't know how to use SPORT for UART Tx and Rx. Please if you have any code base share with me. I will try that. 

    In  my code recieve callback function i am getting noise and it is not clear. One more issue i faced like every reset output is not same. Please review once and let me know.

    Please let me know is there anything that i can try instead of UART blocking API.

    Thanks & Regards,

    Shivaleela S P

  • Hi Shivaleela,

    In your application, you need to resubmit the UART buffer inside every ADC/ DAC callback by using adi_uart_SubmitTxBuffer()  or adi_uart_SubmitRxBuffer() APIs.

    Please take care of your UART transmit or receive should be completed, before the next ADC/DAC callback raised. If this is not done properly, then you will receive the error message from UART API.

    Here we have attached the example codes of UART transmit and receive in callback mode for BF706-Ezkit mini. You can modify this code as per your requirement.
    Ezone-561093.zip

    Regards,
    Santhakumari.K

  • Hi Santhakumari.K,

    I modified my code in UART transmit function by adding non-blocking API adi_uart_SubmitTxBuffer(). Now it is same as Blocking API. Still i'm getting noise in the audio.

    I have one more doubt in this, how to configure the mic setting in BF706 board. I did configuration according to below link. But i am not getting any audio from that. Please let me know  is it  possible to connect microphone for bf706 board? If it is possible then please provide me hardware connection.

    In BF706 datasheet, they mentioned  P7 connector is used for unused microphone and Line out so according to that i connected P7 connector MICBIAS and i changed input source to MIC in adi_adau1761_SelectInputSource() function. It is not working please help me in this.

    ADAU1761 mic input settings - Q&A - SigmaDSP Processors and SigmaStudio Development Tool - EngineerZone (analog.com)

    So please let me know to configure the MIC setting and removing the noise. 

    Thank you,

    Shivaleela S P

  • Hi Shivaleela,

    Blocking mode and non-blocking mode operations are different.

    In blocking mode, APIs do not return to application until transaction is complete and in non-blocking mode, API will return back to application and data transfer happens in the background

    You can see the difference from the below help path as well as from the attached image

    CrossCore® Embedded Studio 2.11.0 > System Run-Time Documentation > Device Drivers User Guide > Low-Level Driver API Reference

    Regarding the noise issue, can you please try the below changes in driver source / replace the attached modified file in source path.

    The bit definitions ENUM_SPORT_CTL_FS_LO and ENUM_SPORT_CTL_FS_HI in defBF706.h file should be changed as below:

    #define ENUM_SPORT_CTL_A_CTL_FS_HI (_ADI_MSK_3(0x00000000,0x00000000UL, uint32_t )) /* LFS: Active high frame sync (DSP standard mode) */
    #define ENUM_SPORT_CTL_A_CTL_FS_LO (_ADI_MSK_3(0x00010000,0x00010000UL, uint32_t )) /* LFS: Active low frame sync (DSP standard mode) */

    In adi_sport_bf6xx.c, from Line 1251 to 1255 should be changed as below:

    if(bActiveHighFS == false)
    {
    /* Select the Active Low Frame Sync(FS)*/
    nFsCfg |=(uint32_t) ENUM_SPORT_CTL_FS_LO;
    }

    Please find the attached modified files. Also ensure that you have installed the "SPORT Driver for Blackfin" add-in via system.svc. Please try and let us know how you are getting on.

    And for mic configurations, please post this specific question in "SigmaDSP Processors and SigmaStudio Development Tool" forum.

    Best Regards,
    Santhakumari.K

    Updatedfile.zip

    modes.zip

  • Hi,

    I have modified the driver file and i am getting more noise compared with previous. Please let me know  how to remove noise.

    Regards,

    Shivaleela S P

Reply Children
  • Hi Shivaleela,

    Apologies for the delay.

    Please refer the attached example project. Here we received input audio samples from codec and stored it in one buffer and then transmit the samples to another buffer by using UART protocol. After the UART receive, send the audio samples to codec for output. In this project we configured UART1 as transmitter and UART0 as receiver. So we required the hardware wire connection between UART1_TX and UART0_RX pins. We tested this project in BF706 EZ-KIT MINI board, we can hear clear audio output. Please modify this code for two different BF706 EZ-KIT MINI board.

    To revert back the changes you done in the original source file, we request you to re-install the CCES before using this project.
    Note: Before uninstall please take a backup copy of your license.dat file from below path: C:\ProgramData\Analog Devices\CrossCore Embedded Studio.

    And also apply the below patch. The ADAU1761 codec driver when using adi_sport_ConfigClock() with the bFallingEdge parameter being incorrectly true. A bug whereby the bFallingEdge parameter was not being handled correctly, and this triggered the problems with the ADAU1761 driver examples you have encountered.

    We have a patch for you to apply to adi_adau1761.c at
    C:\Analog Devices\ADSP-BF706_EZ-KIT_Mini-Rel1.1.0\BF706_EZ-Kit_MINI\Blackfin\src\drivers\codec\adau1761\

    For the two calls of adi_sport_ConfigClock() replace the fourth parameter (true,) in each with:

    #if __CCESVERSION__ >= 0x02040000
    false, /* CCES-11151 fixed */
    #else
    true, /* passing true compensates for CCES-11151 */
    #endif

    Can you please replace the codec driver with the attached one in the below installation path and let us the results.

    <installation_path>\Analog Devices\ADSP-BF706_EZ-KIT_Mini-Rel1.1.0\BF706_EZ-Kit_MINI\Blackfin\src\drivers\codec\adau1761

    Please try and let us know how you are getting on.

    Regards,
    Santhakumari.K

    0702.AudioFilter_Callback_BF706Mini.zip

    2337.adi_adau1761.zip