My application is using an STMicro ST32F4XX processor acting as a SPI Master, receive only. The SPI slave is an AD7691 in 3 wire, no busy indicator that is getting its input from 4 sources that is selected via an ADG704 MUX.
SPI Master is configured as 2 Lines RX Only, 8 bit data size, CPOL 0, CPHA 1, MSB format, with a 256 SPI prescaler
Order of operation is once the SPI device is initialized,
the MUX pins are set,
wait for 10 microseconds for the source input to stabilize,
CNV pin set HI
wait for 3 microseconds for the conversion process to complete,
enable the SPI RXNE IRQ,
bring the CNV pin LO,
wait for 18 clock pulses,
disable the SPI RXNE IRQ,
Data is captured in a circular buffer and then transferred out.
My problem is the data that I am getting is not what I expect.
The sources are steady state voltages with +2,7v, +2.5V, +4.4V and +2.7v
The data is arriving in 2 to 6 bytes of data per read.
I am translating this data into an 18 bit value and then multiplying it by 38.15 microseconds to get the voltage.
For the 4.4v source, I am expecting byte patterns less than 0x1FFFF and > 0x1C000 , but its all over the place. An Electrical Engineer verified the voltages that were getting to the AD7961 and they are within their expected ranges.
The calculated voltage is all over the place, ranging from negative numbers to values completely out of range (>0x3FFFF).
Am I just mistranslating the incoming data stream?