cancel
Showing results for 
Search instead for 
Did you mean: 

What is the channel for ADC2_IN7 on pin AC2 in the STM32L4RG

JBonn
Associate III
 
2 REPLIES 2
TDK
Guru

Hard to say. AC2 isn't a pin and STM32L4RG isn't a chip or a board. Sure you typed those right?

If you feel a post has answered your question, please click "Accept as Solution".
JBonn
Associate III

My bad. Chip is STM32L476RG. Pin used is PA2. Code generated by the CubeMX is

 hadc2.Instance = ADC2;

 hadc2.Init.ClockPrescaler = ADC_CLOCK_ASYNC_DIV2;

 hadc2.Init.Resolution = ADC_RESOLUTION_12B;

 hadc2.Init.DataAlign = ADC_DATAALIGN_RIGHT;

 hadc2.Init.ScanConvMode = ADC_SCAN_DISABLE;

 hadc2.Init.EOCSelection = ADC_EOC_SINGLE_CONV;

 hadc2.Init.LowPowerAutoWait = DISABLE;

 hadc2.Init.ContinuousConvMode = ENABLE;

 hadc2.Init.NbrOfConversion = 1;

 hadc2.Init.DiscontinuousConvMode = DISABLE;

 hadc2.Init.ExternalTrigConv = ADC_SOFTWARE_START;

 hadc2.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;

 hadc2.Init.DMAContinuousRequests = DISABLE;

 hadc2.Init.Overrun = ADC_OVR_DATA_PRESERVED;

 hadc2.Init.OversamplingMode = DISABLE;

 if (HAL_ADC_Init(&hadc2) != HAL_OK)

 {

  Error_Handler();

 }

 /** Configure Regular Channel

 */

 sConfig.Channel = ADC_CHANNEL_7;

 sConfig.Rank = ADC_REGULAR_RANK_1;

 sConfig.SamplingTime = ADC_SAMPLETIME_12CYCLES_5;

 sConfig.SingleDiff = ADC_SINGLE_ENDED;

 sConfig.OffsetNumber = ADC_OFFSET_NONE;

 sConfig.Offset = 0;

 if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)

 {

  Error_Handler();

 }

Using CubeMX settings:

0693W00000KaqyoQAB.png