There is currently 1 post.
Font size: Small - 100% (Default)  Content converter: No conversion
 
Clicks Replies
126 0
在ADS1115的Config Register寄存器中
巨大八爪鱼
武林盟主 二十一级
Reply
Floor 1 Posted at: 4/24/26 14:24
在ADS1115的Config Register寄存器中:
bit11:9 PGA[2:0](电压量程)由设备树的ti,gain属性配置。
bit8 MODE由Runtime PM管理,suspend时为1(Single-shot mode or power-down state),resume时为0(Continuous-conversion mode)。
bit7:5 DR[2:0](数据速率)由设备树的ti,datarate属性配置。
bit4 COMP_MODE由in_voltage0_thresh_either_en和in_voltage0_thresh_rising_en文件内容决定。
当echo 1 > in_voltage0_thresh_rising_en时,COMP_MODE=0(Traditional comparator)。
当echo 1 > in_voltage0_thresh_either_en时,COMP_MODE=1(Window comparator)。
bit3 COMP_POL由设备树的interrupts属性的电平设置决定。
配置为IRQ_TYPE_LEVEL_LOW时,COMP_POL=0(Active low)。
配置为IRQ_TYPE_LEVEL_HIGH时,COMP_POL=1(Active high)。
bit2 COMP_LAT恒为1(Latching comparator)。
bit1:0 COMP_QUE[1:0]由in_voltage0_thresh_either_period文件内容决定。
当设备树里面ti,datarate = <4>时,data->data_rate[dr]=128。
cat /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
输出0.007812。
这是因为COMP_QUE=0(Assert after one conversion)。
1÷128=0.0078125

2÷128=0.015625
echo 0.015625 > /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
cat /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
输出0.015625。
这就把COMP_QUE设为了1(Assert after two conversions)。

4÷128=0.03125
echo 0.03125 > /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
cat /sys/bus/iio/devices/iio:device1/events/in_voltage0_thresh_either_period
输出0.031250。
这就把COMP_QUE设为了2(Assert after four conversions)。
Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
(Shortcut key: Ctrl+Enter)
Post Information
Clicks: 126 Replies: 0
Author: 巨大八爪鱼
Last reply: 巨大八爪鱼
Last reply time: 4/24/26 14:24
Announcements