AnsweredAssumed Answered

STM32L476 Adc Injected

Question asked by sahin.gokhan on Dec 12, 2017

Hi everyone,

I'm using all ADC modules ADC1, ADC2, and ADC3 in my application. ADC1 has 8 channels so the data is being read through DMA.

Others which are ADC2 and ADC3 have only 4 channels and I want them to be read in Injected mode. However, both of them read zero data while reading in Injected mode.

Furthermore, while trying to read the second time I get an error, it says it's busy. Where am I doing wrong?

 

if(HAL_ADCEx_InjectedStart(&hadc2)!=HAL_OK)

   Error_Handler();

HAL_ADCEx_InjectedPollForConversion(&hadc2,100);

usAdc[0]=HAL_ADCEx_InjectedGetValue(&hadc2,ADC_INJECTED_RANK_1);

usAdc[1]=HAL_ADCEx_InjectedGetValue(&hadc2,ADC_INJECTED_RANK_2);

usAdc[2]=HAL_ADCEx_InjectedGetValue(&hadc2,ADC_INJECTED_RANK_3);

usAdc[3]=HAL_ADCEx_InjectedGetValue(&hadc2,ADC_INJECTED_RANK_4);

Attachments

Outcomes