2024-02-14 12:01 PM
"I used the STM32F746ZG to read the current from an ACS712 sensor, but the problem is that the ADC is not stable. I tried using an STM32F466RE to measure the same current, and this time the ADC is stable. I don't understand why, despite the ADC characteristics of the two STM32 being similar. Is there an explanation for this?"please see the two images below
2024-02-14 12:07 PM - edited 2024-02-14 12:09 PM
ADC is not stable ... did you calibrate adc first ? ( HAL_ADCEx_Calibration_Start(...) )
+
set same/similar sampling time and conversion speed ?
2024-02-14 12:23 PM
yes i setted the same sampling time 480 cycle with ADCCLOCK 36 MHz
i did not calibrate the adc because i do no how , i tryed to call HAL_ADCEx_Calibration_Start but i did not found this in hal librarry
2024-02-14 12:29 PM - edited 2024-02-14 12:38 PM
just look at ..Drivers/STM32Fxx_HAL_Driver/Src/stm32h7xx_hal_adc_ex.c
-- what is there..with xxxcalibrat...
(some series have auto-calibration at start , most not -> then you need to call calibration for adc running as it should. )
2024-02-14 12:33 PM
i looked at Drivers/STM32Fxx_HAL_Driver/Src/stm32h7xx_hal_adc_ex.c but there is no function called HAL_ADCEx_Calibration_Start
2024-02-14 12:46 PM
ok - sorry, maybe this is series without calibration .
+
Data from ACSxxx sensor has noise - doing some averaging the data always needed (my experience) ,
so read data 8x , average /8 -> better value (and 480 sampling time is "over" , try 15 or 28 cycles and average (sum) some values, to reduce the noise.
2024-02-14 12:57 PM
i did this but there is no great difference , i looked to F4 series also has not callibration but they guive me a good result , the probleme i need to work with F7 series
2024-02-14 01:36 PM - edited 2024-02-14 01:38 PM
About calibration - STM not doing good, as i see it, about making this clear and obvious :
all Capacitive-re-dristribution-adcs need calibration cycle , some do automatic, on first "init", some need extra command.
ie in H563 ds :
F4 have "auto" , F7 -- i dont know. (I dont want to load all F7 stuff, to see it. )
But basically all F7 are same or better than F4 series, so your "problem" is not the basic precision of the cpu/soc/adc.
2024-02-14 01:42 PM
what you mean by some need extra command. which command i have do
2024-02-14 01:46 PM - edited 2024-02-14 01:49 PM
Just in case the problem is some unknown effect of the F7 interacting with the sensor board, try the Application 7 noise attenuation method provided in the ACS712 data sheet page 13.
As a further note to Ascha's response, the ACS712 has a low impedance op amp output. Large (480) sampling cycles should not be required, his 15 or 28 cycles likely all that is required.