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.
FreeRtos slow?
Re: FreeRtos slow?
- 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
}
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.
Re: FreeRtos slow?
Can I poll all four ADC channels in DMA?
Re: FreeRtos slow?
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.
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