You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Analog-to-digital converter<br />
<strong>STM32W108C8</strong><br />
11.1 Functional description<br />
11.1.1 Setup and configuration<br />
To use the ADC follow this procedure, described in more detail in the next sections:<br />
●<br />
●<br />
●<br />
●<br />
●<br />
●<br />
11.1.2 GPIO usage<br />
Configure any GPIO pins to be used by the ADC in analog mode.<br />
Configure the voltage reference (internal or external).<br />
Set the offset and gain values.<br />
Reset the ADC DMA, define the DMA buffer, and start the DMA in the proper transfer<br />
mode.<br />
If interrupts will be used, configure the primary ADC interrupt and specific mask bits.<br />
Write the ADC configuration register to define the inputs, voltage range, sample time,<br />
and start the conversions.<br />
A GPIO pin used by the ADC as an input or voltage reference must be configured in analog<br />
mode by writing 0 to its 4-bit field in the proper GPIO_PnCFGH/L register. Note that a GPIO<br />
pin in analog mode cannot be used for any digital functions, and software always reads it as<br />
1.<br />
Table 106.<br />
ADC GPIO pin usage<br />
See Section 8: General-purpose input/outputs on page 55 for more information about how<br />
to configure the GPIO pins.<br />
11.1.3 Voltage reference<br />
Analog Signal GPIO Configuration control<br />
ADC0 input PB5 GPIO_PBCFGH[7:4]<br />
ADC1 input PB6 GPIO_PBCFGH[11:8]<br />
ADC2 input PB7 GPIO_PBCFGH[15:12]<br />
ADC3 input PC1 GPIO_PCCFGH[7:4]<br />
ADC4 input PA4 GPIO_PACFGH[3:0]<br />
ADC5 input PA5 GPIO_PACFGH[7:4]<br />
VREF input or output PB0 GPIO_PBCFGH[3:0]<br />
The ADC voltage reference (VREF), may be internally generated or externally sourced from<br />
PB0. If internally generated, it may optionally be output on PB0.<br />
To use an external reference, an ST system function must be called after reset and after<br />
waking from deep sleep. PB0 must also be configured in analog mode using<br />
GPIO_PBCFGH[3:0]. See the <strong>STM32W108C8</strong> HAL documentation for more information on<br />
the system functions required to use an external reference.<br />
161/215 Doc ID 018587 Rev 2