TI_ADC(4)

๐Ÿ“ฆ version 15.1, in freebsd 14.5, freebsd 15.1

๐Ÿฆ‹ ti_adc โ€” the TI AM3XXX analog to digital converter driver ๐Ÿฆ‹

okay so bestie, this page is from the arm Kernel Interfaces Manual, and it's literally all about ti_adc, the driver that lets you peek at the analog inputs. iykyk ๐Ÿ’…


โœจ SYNOPSIS โœจ

device ti_adc

that's it. that's the whole vibe check. one line. iconic. ๐ŸŽ€


๐Ÿ’– DESCRIPTION ๐Ÿ’–

so the ti_adc driver gives you access to the AIN (analog inputs) on am3xxx SoCs โ€” like, the actual analog pins on the chip. no cap.

it hands you raw readings of the converted values for each analog input. raw. unfiltered. just numbers straight from the silicon. โœจ

the way you actually get at this ti_adc data is through the sysctl(8) interface, and here's exactly what that looks like, literally verbatim, every single line:

dev.ti_adc.0.%desc: TI ADC controller
dev.ti_adc.0.%driver: ti_adc
dev.ti_adc.0.%pnpinfo: name=adc@44E0D000 compat=ti,adc
dev.ti_adc.0.%parent: simplebus0
dev.ti_adc.0.clockdiv: 2400
dev.ti_adc.0.ain.0.enable: 0
dev.ti_adc.0.ain.0.open_delay: 0
dev.ti_adc.0.ain.0.samples_avg: 0
dev.ti_adc.0.ain.0.input: 0
dev.ti_adc.0.ain.1.enable: 0
dev.ti_adc.0.ain.1.open_delay: 0
dev.ti_adc.0.ain.1.samples_avg: 0
dev.ti_adc.0.ain.1.input: 0
dev.ti_adc.0.ain.2.enable: 0
dev.ti_adc.0.ain.2.open_delay: 0
dev.ti_adc.0.ain.2.samples_avg: 0
dev.ti_adc.0.ain.2.input: 0
dev.ti_adc.0.ain.3.enable: 0
dev.ti_adc.0.ain.3.open_delay: 0
dev.ti_adc.0.ain.3.samples_avg: 0
dev.ti_adc.0.ain.3.input: 0
dev.ti_adc.0.ain.4.enable: 0
dev.ti_adc.0.ain.4.open_delay: 0
dev.ti_adc.0.ain.4.samples_avg: 0
dev.ti_adc.0.ain.4.input: 0
dev.ti_adc.0.ain.5.enable: 0
dev.ti_adc.0.ain.5.open_delay: 0
dev.ti_adc.0.ain.5.samples_avg: 0
dev.ti_adc.0.ain.5.input: 0
dev.ti_adc.0.ain.6.enable: 1
dev.ti_adc.0.ain.6.open_delay: 0
dev.ti_adc.0.ain.6.samples_avg: 4
dev.ti_adc.0.ain.6.input: 2308
dev.ti_adc.0.ain.7.enable: 1
dev.ti_adc.0.ain.7.open_delay: 0
dev.ti_adc.0.ain.7.samples_avg: 0
dev.ti_adc.0.ain.7.input: 3812

see how ain.6 and ain.7 are enabled with actual numbers in them? yeah. that's the good stuff. ๐Ÿ’œ


๐ŸŒธ the beaglebone-black tea ๐ŸŒธ

on Beaglebone-black, analog input 7 is connected to the 3V3B rail through a voltage divisor (2:1). the 3V3B voltage rail comes from the TL5209 LDO regulator, which is limited to 500mA maximum. so like, don't go wild pulling power out of that rail, bestie. it's giving "small but mighty" and we respect it. ๐Ÿ™ˆ

๐Ÿ‘‘ global settings ๐Ÿ‘‘

  • dev.ti_adc.0.clockdiv โ€” sets the ADC clock prescaler. minimum is 10, maximum is 65535. the ADC clock is CLK_M_OSC (24Mhz) / clockdiv. so that gives you a maximum of ~2.4Mhz for the ADC clock, and ~10Khz for the default setting (clockdiv = 2400). math! slay. ๐Ÿงฎโœจ

๐ŸŽ€ settings per input ๐ŸŽ€

  • dev.ti_adc.0.ain.%d.enable โ€” enables the conversion for the input. every single input has to be enabled individually before you can use it โ€” no shortcut, sorry. and when all the inputs are disabled, the whole ADC gets turned off. energy-saving king. ๐Ÿ’ค
  • dev.ti_adc.0.ain.%d.open_delay โ€” sets the number of ADC clock cycles to wait after applying the input configuration and before starting the ADC conversion. it's the little "gimme a sec to get ready" pause. ๐Ÿซถ
  • dev.ti_adc.0.ain.%d.samples_avg โ€” sets the number of samples average used on each input. it can be set to 0 (no samples average), 2, 4, 8, or 16. average it out, bestie. ๐Ÿ“
  • dev.ti_adc.0.ain.%d.input โ€” is the converted raw value of the voltage applied on the analog input. it's made of a 12 bit value (0 ~ 4095). so like, 0 to 4095. that's the range. periodt. ๐Ÿ”ฅ

๐Ÿ’€ SEE ALSO ๐Ÿ’€

go read that one too, it's the whole reason any of this works. ๐Ÿ˜ญ


๐ŸŒˆ HISTORY ๐ŸŒˆ

the ti_adc driver first appeared in FreeBSD 10.1. a little vintage moment. we love a classic. โญ


๐Ÿงš AUTHORS ๐Ÿงš

the driver and this manual page was written by Luiz Otavio O Souza <loos@FreeBSD.org>. thank you king, we appreciate you. ๐Ÿ‘‘๐Ÿ’–


okay that's the whole thing!! this page is from Debian, dated June 1, 2014 โ€” shoutout to the arm Kernel Interfaces Manual for hosting. go read your sensors, bestie, and remember: enable your inputs individually or the ADC simply will not talk to you. ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from