Using I2S event queue or Task queue for passing adc values from buffer.

zekageri
Posts: 43
Joined: Mon Sep 03, 2018 11:04 am

Using I2S event queue or Task queue for passing adc values from buffer.

Postby zekageri » Mon Oct 28, 2019 2:34 pm

I can not find any reliable solution for the implementation of the I2S event queues on the Arduino framework.
Currently i'am measuring a 4khz signal from a signal generator with the I2S adc via dma.
The data goes into a buffer on a task and i read that buffer from an other task.

The problem is that i think some data get lost because the other task reads the data from the buffer even when the reader does not finished.

My code right now:

Code: Select all

static void loop0(void * pvParameters){
  for( ;; ){    
        Sampling();                               // RETRIVE DATA FROM DMA BUFFER
  }
}

static const inline void To_the_Stars(){
  if(millis() - Start_Millis >= 1000){
    Start_Millis = millis();
    for(int i = 0;i<NUM_SAMPLES;i++){
      Send_Data_to_Plot(i2s_read_buff[i]); // RETRIVE DATA FROM i2s_read_buff FOR CALCULATION AND VISUALIZATION
    }
  }
}
I'am sampling with 144444hz right now, and the readed data looks like this on the web:
Attachments
Képernyőfelvétel (34).png
Képernyőfelvétel (34).png (1.05 MiB) Viewed 2655 times
Képernyőfelvétel (33).png
Képernyőfelvétel (33).png (1.04 MiB) Viewed 2655 times
Képernyőfelvétel (32).png
Képernyőfelvétel (32).png (1.04 MiB) Viewed 2655 times

Who is online

Users browsing this forum: No registered users and 73 guests