cancel
Showing results for 
Search instead for 
Did you mean: 

why has PA4 (ADC1CH18) low impedance as soon as adc2 temp channel gets initialized

froesel
Associate III

Hello,

In our project, we are using a STM32H7B3ZI, LQFP144 package.

We are using a simple 24v, 33k/2k7 voltage divider to sense a voltage and expected a voltage at this pin ~1.8V.

The signal is connected to PA4, evaluated by ADC1CH18, no PU, no PD.

0693W00000UnulpQAB.pngFurthermore, we are using the temp channel of ADC2.

We use CubeMX for configuration, version 1.10.

During initialization, everything is fine, the signal has something around 1.78V. As soon as ADC2 is initialized, the PA4 pin will be pulled down to 0.7V. This is not expected behavior, as PA4 is not connected to ADC2 in any way and the input impedance should way higher than ~2k.

We can reproduce this bahaviour with serveral PCBA. Furthermore, we unsoldered the package pin,and voltage divider was fine. Same bahavior after deleting flash of uC.

Could you please explain this behavior? Are there known issues?

Thank you,

Florian

1 ACCEPTED SOLUTION

Accepted Solutions

Interesting. Can you please confirm that you are changing ADC2 registers and not ADC1? Read out and check/post content of ADC1_PCSEL and ADC2_PCSEL.

Nonetheless, from reading the RM, it does not appear that setting ADC2_PCSEL.PCSEL18 would be a requirement for the temperature measurement, so you should be able to skip that setting. Yes, I am talking about modifying Cube/HAL functions, or writing your own.

I don't have/use the 'H7A3.

JW

View solution in original post

10 REPLIES 10
froesel
Associate III

added relevant part of the schematic and measurement of finding

0693W00000UnuqpQAB.png 

0693W00000UnuqaQAB.png

Single-step the program, including Cube if you used it. At which point does gets the input pulled down?

Are valid voltages on VDDA/VREF+ pins?

JW

froesel
Associate III

Hi JW,

debugged step-by-step. The problem occures as soonas the temp channel of ADC2 gets configured:

adc.c

//start line 268
 
 /** Configure Regular Channel
 
 */
 
 sConfig.Channel = ADC_CHANNEL_TEMPSENSOR;
 
 sConfig.Rank = ADC_REGULAR_RANK_8;
 
 sConfig.SamplingTime = ADC_SAMPLETIME_16CYCLES_5;
 
 if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
 
 {
 
   Error_Handler();
 
 }

HAL_ADC_ConfigChannel is called inside stm32htxx_hal_a, there in line 2900:

//start line is 2900
 
   hadc->Instance->PCSEL |= (1UL << (__LL_ADC_CHANNEL_TO_DECIMAL_NB((uint32_t)sConfig->Channel) & 0x1FUL));

afterwards, voltage level is 0.7V.

I added the cube *.ioc which was used to reproduce the same behavior, after ADC2_Init(); pin is 0.7V.

Florian

Interesting. Can you please confirm that you are changing ADC2 registers and not ADC1? Read out and check/post content of ADC1_PCSEL and ADC2_PCSEL.

Nonetheless, from reading the RM, it does not appear that setting ADC2_PCSEL.PCSEL18 would be a requirement for the temperature measurement, so you should be able to skip that setting. Yes, I am talking about modifying Cube/HAL functions, or writing your own.

I don't have/use the 'H7A3.

JW

froesel
Associate III

Hi JW,

ADC1_PSCEL before line 2900:

0x0

ADC2_PSCEL before line 2900:

0x84207

signal is okay,

after:

ADC1_PSCEL after line 2900:

0x0

ADC2_PSCEL after line 2900:

0xc4207

signal not okay.

so PCSEL19 of ADC2 is written... seems not ok to me, as this is the Vref_sense of ADC2 (which is actually enabled for adc2, too but is set in some lines before) voltage and not the internal Vsense for temperature sensor signal. Could someone confirm this behavior? 0693W00000Unz1NQAR.png0693W00000Unz1DQAR.png0693W00000UnyzCQAR.png

0xc4207 - 0x84207 = 0x40000 and that's bit 18, so that's indeed the temperature sensor, not VREFINT. Bit 19 was already set before line in question (although IMO that shouldn't be a requirement either).

Nonetheless, IMO the temperature sensor should never be connected to the external pin, and marking of PA4 in DS indicates that it should be connected only to ADC1_INP18 not to ADC2_INP18.

@Amel NASRI​ , can you please have a look at this? It appears to be a candidate for an erratum.

Also, if the temperature sensor subchapter is correct, software - thus Cube - should not set ADC2_PCSEL.PCSEL18 bit at all.

Florian,

as I've said above, the temperature sensor should not require any ADC1_PCSEL bit to be set, so you have to write your own code, perhaps starting from Cube (copying its function) and omitting given line for the temperature sensor.

JW

froesel
Associate III

Hi JW,

it's okay, if I have to write own code, but the reason for it's behavior needs to be evaluated. Would be great, if someone of ST could investigate the reason for the problem.

Thanks,

Florian

Hi @Florian Rösel​ & @Community member​,

As it is implemented currently, I confirm that ADC2_PCSEL.PCSEL18 bit is set.

That shouldn't be the case as highlighted by @Community member​. I'll take care of reporting this issue related to ADC HAL driver.

However, I would like to know if the problem is fixed when you perform suggested update on your side or you still see a wrong signal on PA4?

-Amel

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.

froesel
Associate III

Hi Amel,

thank you for your support. Can confirm, that if I modify the code in a way that PCSEL wont be set for temp sense, the signal is corrrect. For the moment the problem seems to be solved by this workaround but I would appreciate if this will be fixed soon.

Thanks,

Florian