2020-08-10 11:38 PM
Hello,
I am using STM32G030C8 microcontroller's several ADCs. Most of them are working okay but two of them (ADC1 IN15, PB11 and ADC1 IN16, PB12) are not showing correct ADC values.
In ADC IN15: When I use only this channel in the code then it shows 0 but when I read multiple channels it shows the value of the channel which is read before it.
In ADC IN16: The value is always very low regarding the actual voltage on that pin.
My VREF is 2.5V. I generated the code with CubeMX and using Keil IDE.
I have tested it in more than 1 hardware with same results. Also I have technically verified the voltage at the pin. The voltage at said pin is varied from 1.2V to 1.5V. Same type of input signals are applied to ADC channels 7,8,9,10,11 and reading values without any issues.
Also uploading the project for reference
2020-08-11 01:08 AM
Sounds like high input signal impedance/inadequate sampling time.
What's the input signal source?
JW
2020-08-11 01:11 AM
Input is driven by opamp. I am sure this is not an input issue because 5 other channels are connected with same type of input but they are showing correct readings.
2020-08-11 05:37 AM
Check your CHSELRMOD bit. If it's 1, only channels 0-14 may be selected for regular conversion.
If it's 0, you can select any channel.
2020-08-11 05:46 AM
Set it up in CubeMX to see the correct code to convert channel 15+.
2020-08-11 06:47 AM
Humm, ST gets really inventive in the ADCs... no two alike... TDK, don't you happen to know, this "feature", is it present in any other STM32 family too?
JW
2020-08-11 06:54 AM
2020-08-11 07:16 AM
@Community member
I have also used STM32F407VG's all ADC channels without such weird issue
@TDK
I have used CubeMX, though it didn't give me any error. Original project files are attached with question
2020-08-11 07:21 AM
2020-08-11 07:27 AM
> I have used CubeMX, though it didn't give me any error. Original project files are attached with question
Your project only converts a single channel, channel 3. The error is not in the CubeMX generated code, it's in the user code you added.
Channels 1, 15 and 16 are set up as inputs, but they're not actually part of the conversion in your project.