2024-02-20 10:59 PM
Hello ALL,
ADC values when 2 channel are disturbed when used in STM32L071 board. i have tried changing the sampling time of channels still no difference the voltage at that pin is around 2.5 volt but the ADC value after conversion i am receiving is around 1100- 1200. i am not using DMA mode can anyone suggest me any other ways to rectify it?
Thank you
Solved! Go to Solution.
2024-02-29 08:12 AM
Hello @Nirav
Sorry for the delay.
Could you try the following project attached?
It configure on a NucleoL073RZ, PA0 -> ADC_IN0 and PB0 -> ADC_IN8 with DMA and TIM22 as ADC conversion trigger. In this example each conversion of ADC are coherent on related channels.
Actually TIM22 triggers ADC/DMA request every 100ms, you can change TIM22 period in order to slow down (or speed up ADC rate)
I just simplified your functions to do not switch between ADC channel and replaced float computation by integer representation in mV.
If you want to implement your own code, simply update while loop which is the background task in charge of the update and the computation of variables GetADCVal_Temp and GetADCVal_J1772.
As STM32L0 is Low power device, you can activate a low power mode between ADC conversion interrupt.
I hope it will help you. Thank you to let me know?
Best regards,
Romain,
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.
2024-03-01 12:48 AM
Hello @RomainR.
The problem got solved when i deactivated the ADC0 channel i.e. PA0 after taking the sample and enabled again to take the sample.
Thank you so much for your suggestions.
Regards,
Nirav Mehta.
2024-09-18 08:07 AM
//The problem got solved when i deactivated the ADC0 channel i.e. PA0 after taking the sample and enabled again to take the sample//
Can you tell how you deactivated the PA0 channel and re-activated it ?
I am also facing the same problem with STM32F030C8T6TR. I have two adc pin on ADC_IN1 (pin11) and ADC_IN2(pin12).
Whatever is tried , I can get only the value of one channel, either ADC_CHANNEL_1 or ADC_CHANNEL_2
Ie: if the hadc.Init.Overrun = ADC_OVR_DATA_PRESERVED ; I get the value of first channel
and if it is hadc.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN; I get the value of second channel
Not both.
This is driving me nuts.
This chip has only one ADC.
Tried even HAL_ADC_DeInit(&hadc) and again initializing with HAL_ADC_Init(&hadc) to clear memory. Nothing seems to work. .