cancel
Showing results for 
Search instead for 
Did you mean: 

ADC channel numbers incorrect on datasheet STM32U031R8T6

KSB
Associate II

Hi,

I am just trying to run adc in discontonous mode to measure some voltate from two resistor divider connected on channel 6 (PA1) and channel 7 (PA2) and also Vref from internal channel 12 as per datasheet. see below screenshot from DS14581- Rev2

KSB_0-1721264870489.png

KSB_2-1721265399785.png

 

below is the code

RCC->APBENR2|=RCC_APBENR2_ADCEN; //enable adc clock

ADC1_COMMON->CCR=ADC_CCR_VREFEN; //

ADC1->CFGR2|=(1<<ADC_CFGR2_CKMODE_Pos); clock divide by 2

ADC1->CFGR1|=ADC_CFGR1_DISCEN; // discontinuos mode

ADC1->SMPR=0x05; //sampling time setting

ADC1->CR=ADC_CR_ADCAL|ADC_CR_ADVREGEN; // start adc calibration

while((ADC1->CR)&(ADC_CR_ADCAL)) // wait while adc calibraion is not complete

{};

ADC1->CR=ADC_CR_ADEN; // ADC enable

ADC1->CHSELR=ADC_CHSELR_CHSEL6|ADC_CHSELR_CHSEL7|ADC_CHSELR_CHSEL12;// select channels to be converted

ADC1->CR=0x05; //ADC enable and start conversion.

uint16_t adc_data=ADC1->DR;

 

I have tested that when I choose below configuration for channels . I get the desired results.

ADC1->CHSELR=ADC_CHSELR_CHSEL5|ADC_CHSELR_CHSEL6|ADC_CHSELR_CHSEL11;

So that clearly means that  ADC channel 5 is connected to PA1, ADC channel 6 is connected to PA2 and VREFINT is ADC channel 11 in contrast to what is mentioned in the reference manual RM0503 Rev2. and the datasheet of the product.

 

Please confirm.

 

2 REPLIES 2
KDJEM.1
ST Employee

Hello @KSB ,

 

First, I apologize for my late reply.

Thank you for bringing this issue to our attention.

I confirm this is a documentation issue. In the DS14581- Rev2, ADC channels numbering starts by mistake from ADC_IN1 instead of ADC_IN0. 

I reported this typo internally

Internal ticket number: 182169 (This is an internal tracking number and is not accessible or usable by customers).

 

Thank you.

Kaouthar

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Viktor POHORELY
ST Employee

First, really sorry about the difficulties due to documentation misalignment.

Documents are ongoing update to have it fixed.