Re: [PATCH 4/4] iio: ad7949: fix channels mixups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Le 13/09/2019 à 10:30, Andrea Merello a écrit :
Il giorno ven 13 set 2019 alle ore 09:19 Ardelean, Alexandru
<alexandru.Ardelean@xxxxxxxxxx> ha scritto:

So, at power-up this chip seems to need 2 dummy reads to discard data.
Which seems to happen in ad7949_spi_init()

One thing that maybe could be optimized (for the driver), is in `ad7949_spi_read_channel()` to use the current-channel &
not do a SPI write to change the channel if it doesn't change.

Datasheets (in general) are not always obvious about describing chip behavior for SW (or for writing a driver), but I
would suspect that if you are reading garbage data, it could be that the channel has changed.
This is true for some other ADCs.
And requires testing for this one.
Yes, it's exactly what I've seen here. If the channel does not change
then the AD is already in acquisition phase on the right channel (I
assume it's OK to keep it in such phase indefinitely), then we can
just trigger a new conversion (CNV low->high, that is a dummy xfer)
and then read the result in following xfer, as the driver already did.

I craft a V2 that performs the extra (3rd) spi xfer only if the
channel has to change.

This design should be ok. I didn't implement in that way because not enough time to optimize the driver before release (I don't have access to the chip anymore) and for our workflow it was not relevant (we scanned all channels).


About your fix to read / write several times before reading the value after channel change seems not relevant. Did you try with the current implementation? Because when I developed the driver, I have always got the expected value for each channel with this design.


Just to be sure we are not adding useless steps.

Added Charles-Antoine, since he wrote the driver.
Shoud have added him on the other patches as well, but I just remembered.
I tried on my first answer, but apparently mails to his address bounce
back with a failure response..

But now it seems ok. Did you put the right email address?


Thank you for the copy.

Regards,

Charles-Antoine Couret




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux