2024-02-15 06:19 AM
Hi all, i am trying to use MDMA to transfer data from a cyclic ADC-DMA buffer
my ADC buffer is of x size and it is cyclic: adc_buffer[x]
and i want to transfer its data via MDMA to a larger buffer while its sampling
meaning that after every ADC iteration the MDMA should transfer the data into the larger buffer N Times
sampling_buffer[x*N]
like in the picture below:
The problem is that only the first part of my buffer is being transferred to the larger buffer and then MDMA remains "busy".
Will appreciate any help :)
this is my my code (roughly)
#define MDMA_BlOCKS_N 4
#define ADC1_BUFFER_SIZE 10
MDMA_HandleTypeDef hmdma_mdma_channel0_dma1_stream1_tc_0;
uint16_t adc1_buffer[ADC1_BUFFER_SIZE];
uint16_t adc1_samples[ADC1_BUFFER_SIZE*MDMA_BlOCKS_N]
int main(void)
{
//configuring and starting ADC with DMA.....////
.
.
//
MX_MDMA_Init();
HAL_MDMA_Start_IT(&node_mdma_channel0_dma1_stream1_tc_1,
(uint32_t)&adc1_buffer,
(uint32_t)&adc1_samples,
sizeof(uint16_t) * ADC1_BUFFER_SIZE,
MDMA_BlOCKS_N);
}