FreeRtos slow?

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: FreeRtos slow?

Postby brp80000 » Thu Dec 13, 2018 1:44 am

Can I see an example of this code?
I'll have to use an interrupt when the DMA data is received to process it immediately. And this again will conflict with flash recording.

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: FreeRtos slow?

Postby brp80000 » Thu Dec 13, 2018 11:28 am

  • void i2s_init()
    {
    i2s_config_t i2s_config = {
    .mode = I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_TX | I2S_MODE_ADC_BUILT_IN,
    .sample_rate = 32000, // i2s sample rate
    .bits_per_sample = 32, // i2s data bits
    .communication_format = I2S_COMM_FORMAT_I2S_MSB,
    .channel_format = I2S_CHANNEL_FMT_RIGHT_LEFT, //I2S data format
    .intr_alloc_flags = 0,
    .dma_buf_count = 2,
    .dma_buf_len = 64
    };
    //install and start i2s driver
    i2s_driver_install(I2S_NUM_0, &i2s_config, 0, NULL);
    //init ADC pad
    i2s_set_adc_mode(ADC_UNIT_1, ADC1_CHANNEL_0 | ADC1_CHANNEL_3);
    i2s_adc_enable(I2S_NUM_0); // i2s number
    }
This is my configuration of ADC1 and DMA
How further can I read and process data in DMA?
Last edited by brp80000 on Thu Dec 13, 2018 6:21 pm, edited 4 times in total.

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: FreeRtos slow?

Postby brp80000 » Thu Dec 13, 2018 6:04 pm

Can I poll all four ADC channels in DMA?

User avatar
brp80000
Posts: 138
Joined: Thu Oct 04, 2018 7:13 pm

Re: FreeRtos slow?

Postby brp80000 » Fri Dec 14, 2018 1:29 am

I realized that it is impossible to poll 4 channels of ADC via DMA.

I have configured a timer interrupt 1000 times per second and am using xSemaphoreGiveFromISR().
Then xSemaphoreTake() triggers the highest priority task to capture data (as short as possible with a minimum of calculations). Basic calculations and saving to flash 20 times per second is performed in a low-priority task.
Strange result I'm missing about 10% of the interrupts. So expected 1000 lines in the log should be recorded in 50 seconds, but it takes 54.7 seconds to gettimeofday() in my log.

Who is online

Users browsing this forum: Google [Bot] and 184 guests