Jump to content

Read DMA Audio Data

Recommended Posts


I'm doing some modifications to the Audio DMA Project, i'm using the Zybo Z7-20 with the Vitis and Vivado 2023.2 version. This project storage the audio data received by the codec at 96khz during a period of time with a microphone in the memory using AXI DMA, also you can reproduce the file using some headphones.

The point is that i want to read the data that it's storaged, for this purpose i have made the next code:

INTPTR adr = (u32) MEM_BASE_ADDR;  //Starting address of the data, i get this looking in the function used in the project
u32 len = (3 * NR_AUDIO_SAMPLES); //(Time of sec * freq), multiply by 3 because, the data lenght is 24 bits, so it fills 3 memory address (each 1 byte)

const u32 cacheline = 3U; //Aumenting the memory address in 3 to match the size of the data get by the audio codec
u32 tempadr = adr; //Starting Memory Address
u32 tempend = adr + len; //Final Memory Address

while (tempadr < tempend){ //Loop in the interval and auments by 3 each iteration

    int* i = (int*) tempadr;
    u32 data = *(volatile u32*) i; //Get back the data in the actual memory address using pointer
    xil_printf("%u\r\n", data); //Write the data in the serial terminal
    tempadr += cacheline; 


I printf the data in the serial terminal and save the data using external applications, i get the correct number of data, but the problem is that the data looks nonsense is oscillates between the min and max value of 24bits. The procedure was to knock the table and recording the sound in the memory of the Zybo Z7 and then storage the data (Look the data graph).

In theory, the data should look like a straight graph and a peak corresponding to the knock on the table. And i don't know if the problem is that i'm reading the data wrong or the direction is not correct.

Thanks for your responding.🙃




Link to comment
Share on other sites

Hi @Sergio Lopez,

I2S data is signed, twos complement. I suspect that when the signal is ~0, it's toggling back and forth between numbers slightly above (~0x0000) and below zero (~0xFFFF), resulting in the wild swings you're seeing. This might also be obscuring the peak you're trying to detect - especially if the peak is a peak in signal amplitude with zero offset, which would still be switching back and forth between positive and negative.



Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...