AD7923
Production
The AD7923 is a 12-bit, high speed, low power, 4-channel, successive-approximation (SAR) ADC. It operates from a single 2.7 V to 5.25 V power supply and...
Datasheet
AD7923 on Analog.com
Hello,
I'm struggling with using LIBIIO with AD7923.
I'm using drivers/iio/adc/ad7923.c from Linux Kernel 5.15.52 on my custom board with NXP ARM AP.
Single read works well. ( cat /sys/bus/iio/devices/iio\:device0/in_voltage0_raw )
But for iio_readdev,
> iio_readdev -t adc_trigger1 -b 16 -s 4 ad7923 voltage0 | hexdump -d
Unable to refill buffer: Connection timed out (110)
And my kernel debug message is "ad7923_trigger_handler: b_sent : -22".
It's from the code below.
static irqreturn_t ad7923_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
struct iio_dev *indio_dev = pf->indio_dev;
struct ad7923_state *st = iio_priv(indio_dev);
int b_sent;
b_sent = spi_sync(st->spi, &st->ring_msg);
if (b_sent) {
printk("%s: b_sent : %d\n", __func__, b_sent);
goto done;
}
iio_push_to_buffers_with_timestamp(indio_dev, st->rx_buf,
iio_get_time_ns(indio_dev));
done:
iio_trigger_notify_done(indio_dev->trig);
return IRQ_HANDLED;
}
For adc_trigger1, I made it like below.
mkdir /sys/kernel/config/iio/triggers/hrtimer/adc_trigger1
And iio_info command shows below about that.
trigger1: adc_trigger1
0 channels found:
1 device-specific attributes found:
attr 0: sampling_frequency value: 100.000000
No trigger on this device
BTW, when I select all 4 channels, it shows outputs like below.
> iio_readdev -t adc_trigger1 -b 16 -s 4 ad7923 voltage0 voltage1 voltage2 voltage3 | hexdump -d
0000000 04286 04286 04284 04284 04278 04273 04277 04277
0000010 04362 04372 04383 04399 07488 07543 07612 07639
But they are NOT real ADC values. I have no idea where they are from.
They are out of the range and different from values from the single reads.
In addition, I'd like to know if the driver ad7923.c is implementing the Sequencer function.
I chose AD7923 to use its sequencer function.
In ad7923.c, only AD7923_SEQUENCE_OFF is used by ad7923_scan_direct() and ad7923_update_scan_mode().
Thanks,
Hi,
I'll contact the product owner and get back to you.
Regards,
Andrei