can someone check my setup please? in line 1 the MCU, an stm32F070RB, does a conversion and in line 5 it does another one. but the second conversion fails and the program hangs up at line 7. if i suppress line 7 the program will continue uninterrupted.
the ADC register values are shown below.
the ADC register values are shown below.
Code:
1 ADC1->CR |= (uint32_t)ADC_CR_ADSTART; // start first conversion
2 count = 0;
3 while(((ADC1->ISR & ADC_ISR_EOC) == (uint32_t)reset) && (count < timeout)) count++; // wait for end of conversion
4 capVL = (uint16_t)ADC1->DR; // read value
5 ADC1->CR |= (uint32_t)ADC_CR_ADSTART; // start second conversion
6 count = 0;
7(//) while(((ADC1->ISR & ADC_ISR_EOC) == (uint32_t)reset) && (count < timeout)) count++;
8 capVH = (uint16_t)ADC1->DR; // read value
Last edited: