2022-05-06 07:53 AM
I have a reading problem with dmaWhen reading multi channel with ADC dma I need to know when to sample each channel. In the ADC input, I found a 2us transient in the oscilloscope output below. I considered this transient as adc sampling time and adjusted the delays. (I had to put 138us delay for 160us) are there any errors in my route?
Also, the transient contains 2 peaks, I couldn't understand where the second peak came from.
My code for ADC sampling(I have a reading problem with dma)
delayMicroseconds(IRDelay - 22);//22us adc start delay
HAL_ADC_Start_DMA(&hadc,ADC_Reads,2); // ADC_Reads is dummy
void DMA1_Channel1_IRQHandler(void)
{
/* USER CODE BEGIN DMA1_Channel1_IRQn 0 */
ADCReads[i] = (hadc.Instance->DR); //my reading point
i = 1-i;
/* USER CODE END DMA1_Channel1_IRQn 0 */
HAL_DMA_IRQHandler(&hdma_adc);
/* USER CODE BEGIN DMA1_Channel1_IRQn 1 */
/* USER CODE END DMA1_Channel1_IRQn 1 */
}