Incorrect values by ADC on STM32H750
Hello!
A simple setup to run the ADC1 in continuous conversion mode runs as expected, but the measured values are incorrect as inspected via the debugger console. When connecting the ADC1 input pin to GND or 3.3V volts the measured value doesn't change as expected but always fluctuates around the decimal value of roughly ~14000.
The hardware I'm using is a custom discovery board from China according to the schematic:
https://github.com/mcauser/MCUDEV_DEVEBOX_H7XX_M/blob/master/docs/STM32H7XX_M_schematics.pdf
To discard issues with the hardware I verified the connectivity with a multimeter.
The problem persists when using other ADC channels/ input pins.
The code I used is:
int main(void)
{
#define ANALOG_IN 3
#define ADC_PA0_KANAL 16 // ADC1_INP16
RCC->AHB4ENR |= RCC_AHB4ENR_GPIOAEN; // PortA active
RCC->AHB1ENR |= RCC_AHB1ENR_ADC12EN; // dto. ADC_12
RCC->D3CCIPR |= RCC_D3CCIPR_ADCSEL_1; // per_clk ADC_12 enable
GPIOA->MODER |= ANALOG_IN; // PA0 analog IN
ADC12_COMMON->CCR = ADC_CCR_PRESC_3; // prescaler /32
ADC1->CR = ADC_CR_BOOST | ADC_CR_ADVREGEN ;
ADC1->SQR1 = ADC_PA0_KANAL << ADC_SQR1_SQ1_Pos; // input selection
ADC1->CFGR = (0b000<<ADC_CFGR_RES_Pos) | // 16 Bit
ADC_CFGR_JQDIS |
ADC_CFGR_OVRMOD |
ADC_CFGR_CONT; // continous conversion
ADC1->CR |= ADC_CR_ADEN |
ADC_CR_ADSTART;
uint32_t tmp;
while (1)
{
tmp = ADC1->DR;
}
}What am I missing here? Is there a special setting to be considered because ADC1 and ADC2 are tightly couple?
