2024-03-16 10:04 AM
Hello STM community,
I've been encountering some difficulties with ADC acquisition on my STM32MP157D-DK1 board. I've attempted to perform an acquisition of a potentiometer value using the ADC, but unfortunately, I haven't been successful.
I've tried two approaches:
In both scenarios, I've failed to obtain a correct analog readings. Despite trying various configurations, I haven't had any luck. Here's what's happening:
Upon connecting the signal connector to the correct pin on the board, I consistently observe the same value (the maximum) for any voltage value, except when the potentiometer reaches the end of travel (0 voltage), at which point the value begins to fluctuate. It seems like the digital value is being saturated during the conversion process.
The potentiometer was connected to the GND and 3V3 pins of the Arduino connector CN16.
I've tried adjusting configurations and settings, but so far, nothing has worked. I would greatly appreciate any insights or guidance on how to resolve this issue. Thank you in advance for your assistance.
Best regards,
Federico
2024-03-19 07:44 AM
Hi @FedericoB
This is usually when there is no supply or no reference on ADC.
Did you have correct &m4_adc node in your Linux device tree ?
As VDDA and VREFBUF are managed by Cortex-A7 SW, you should tell Linux that the Cortex-M4 is using ADC, otherwise Linux shutdown any unused supplies (you usually show this shutdown on Linux console few seconds after Linux prompt).
Please have a look to https://wiki.st.com/stm32mpu/wiki/How_to_configure_system_resources#ADC_example
Regards.
2024-03-20 03:59 AM
Good morning,
Thank you for your response.
I have checked and indeed, when I turn on the board, I get the message "vdda: disabling". I have never been able to configure the device tree. I followed this guide (1) to install Buildroot and configure a kernel with preemption. When I try to use a device tree source built with CubeMX, I cannot compile it with Buildroot because some files are missing (like "stm32mp157c-m4-srm.dtsi"). I noticed that the files in the "dts" folder are different from the files present in the online guides. In particular, I have this file (2) while most of the guides refer to this (3). I don't understand what I'm doing wrong in creating the dts.
2024-03-20 06:32 AM
HI @FedericoB
I recommend to use latest Ecosystem Revision (latest is v5 based on Linux kernel 6.1.28) as Device Tree are not fully compatible in between revision.
Device tree generated by CubeMX are only partial and you always need to handle some manual adding (usually using diff with existing and working files of the board starter package)
https://wiki.st.com/stm32mpu/wiki/How_to_compile_the_device_tree_with_the_Developer_Package
Regards.