Welcome to the Linux Foundation Forum!

Why would I get two write_raw() calls in an IIO driver?

I'm working on an IIO DAC driver for a LTC1669 single channel DAC. I have the driver mostly working but have an issue when I write to the out_voltage_raw sysfs file. On an oscilloscope I see the output of the DAC briefly go up then it goes back to 0V.

/sys/bus/iio/devices/iio:device1# echo 512 > out_voltage_raw
ltc1669_write_raw: chan:0 val:512 val2:0 mask:0
ltc1669_write: 512 - 00:00:02
ltc1669_write_raw: chan:0 val:0 val2:0 mask:0
ltc1669_write: 0 - 00:00:00

Any ideas why I'm seeing the second write?

Thanks

Answers

  • Never mind. I figured it out.

    My I2C write function used by (*write_raw) was returning the result if i2c_master_send(). I assumed that return would be 0 on success, it actually returns the number of bytes written.

    Fixed that and now the DAC is set properly.

  • user007
    user007 Posts: 2

    Thank you for the post @bigguiness
    I have a similar issue here. Could you please elaborate more on this?

Categories

Upcoming Training