2024-11-09 02:36 AM
I having some difficulties figuring out details about the ADC usage under Linux, in particular on the MP135F-DK.
I located the io driver sources, and the drive itself seems to work:
Checking the board user manual, the GPIO pins PC2 and PC3 are routed onto CN8, and seem available for application usage as ADC inputs.
Can I access this two channels via the existing /sys/bus/iio/devices interface ?
Or would I have to modify the sources ?
Here a code excerpt from the driver (stm32-adc.c):
static const struct stm32_adc_regspec stm32mp13_adc_regspec = {
.dr = STM32H7_ADC_DR,
...
.or_vddcore = { STM32MP13_ADC2_OR, STM32MP13_OP0 },
.or_vddcpu = { STM32MP13_ADC2_OR, STM32MP13_OP1 },
.or_vddq_ddr = { STM32MP13_ADC2_OR, STM32MP13_OP2 },
.ccr_vbat = { STM32H7_ADC_CCR, STM32H7_VBATEN },
.ccr_vref = { STM32H7_ADC_CCR, STM32H7_VREFEN },
};
Do the definitions marked in red mean only this specific channels are available ?
2024-11-09 04:02 AM
In the stm32-adc.c driver, the defined .or_vddcore, .or_vddcpu, and .or_vddq_ddr mappings (marked in red) indicate specific internal ADC channels for monitoring system voltages (like core voltage or CPU voltage) rather than general-purpose GPIOs (such as PC2 and PC3). These mappings are typically reserved for power management and diagnostics.