Q
I am having communications problems with the SPI lines, and I can't fix them?
A
The SPI interface can be particularly sensitive to interfering noise.
The most likely reason for reading incorrect data from the AD7793 registers
is an extra spurious (extra) clock pulse appearing on the SCLK line.
The CS line does synchronize the writing of data, but if an incorrect number of
data bits are written then the interface could get confused, and will not
recover then next time CS is asserted.
The way to reset the interface when communication has been lost is to take Din
high and put in 32 SCLK cycles to the part.
If you have established proper communication between the AD7793 and your micro,
you should be able to read back the contents of the registers that you have
programmed.