2024-01-16 02:37 PM
Hi,
I have an STM32H747IGT6 that I wish to:
The process works fine through (3) with the ADC configured as LL_ADC_REG_DMA_TRANSFER_LIMITED and the DMA configured with LL_DMA_MODE_NORMAL. However, I can't figure out how to restart the DMA / ADC. Can anyone offer guidance on how to restart a one shot DMA transfer to memory from an ADC?
The ADC conversions are triggered from a timer.
Thanks!
Solved! Go to Solution.
2024-01-16 03:32 PM
Ok, the missing step is to start a new conversion on the ADC. For others, see below using LL API.
LL_DMA_ConfigAddresses(DMA1,
LL_DMA_STREAM_1,
LL_ADC_DMA_GetRegAddr(ADC2, LL_ADC_DMA_REG_REGULAR_DATA),
(uint32_t)&shared_mem[SHMEM_SAMPLE_0_INDEX],
LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
LL_DMA_SetDataLength(DMA1, LL_DMA_STREAM_1, SHMEM_NUM_SAMPLES);
LL_DMA_EnableStream(DMA1, LL_DMA_STREAM_1);
LL_ADC_REG_StartConversion(ADC2);
2024-01-16 02:55 PM
Set the memory address back to the beginning of the buffer.
Set the number of transfers.
(Re)start the stream.
2024-01-16 03:25 PM
Hi TDK,
I've tried those steps and I agree they seem sensible for the DMA end. However, it seems like the ADC is still stopped after the end of the transfer and no more DMA requests are being generated.
The reference manual shows the following with no mention of how to restart the ADc for a second one shot sequence.
2024-01-16 03:32 PM
Ok, the missing step is to start a new conversion on the ADC. For others, see below using LL API.
LL_DMA_ConfigAddresses(DMA1,
LL_DMA_STREAM_1,
LL_ADC_DMA_GetRegAddr(ADC2, LL_ADC_DMA_REG_REGULAR_DATA),
(uint32_t)&shared_mem[SHMEM_SAMPLE_0_INDEX],
LL_DMA_DIRECTION_PERIPH_TO_MEMORY);
LL_DMA_SetDataLength(DMA1, LL_DMA_STREAM_1, SHMEM_NUM_SAMPLES);
LL_DMA_EnableStream(DMA1, LL_DMA_STREAM_1);
LL_ADC_REG_StartConversion(ADC2);