I've been using the Impedance example code for the AD5940 as a starting point, and ran into what I believe is either a synchronization error in the code or an understanding error in my brain.
My current understanding is that the timing sequence is entirely driven by the AD5940's sequencer and does not explicitly wait for the host MCU once it has been configured and started. The timing sequence is:
1) AD5940 Takes measurements of Rz and Rcal, puts them in FIFO
2) AD5940 Signals completion of these measurements via GPIO.
3) AD5940 Blind sleep for 250us.
4) Host MCU sees the GPIO flag and pulls data from FIFO
6) Host MCU pushes new stimulus frequency in
7) AD5940 blind sleep of 250us ends
If the blind sleep ends before the new stimulus frequency is configured, the Rz and Rcal measurements can be performed at different stimulus frequencies. This typically results in relatively small error - each step in the frequency step is relatively close together, so the mismatch isn't obvious. However, when the sweep loops back around there is a very large error. While measuring a 10k resistor, the first measurement is within less than a percent, but the second time I measure at 100Hz I get values as high as 16k.
Is my understanding of the sequence and the potential race condition correct?
Can I remove the 250us blind wait if I retrigger the sequence manually over SPI? Do I need a settling time after adjusting the frequency or DC bias?
Is retriggering via SPI the best path forward? My application has an extra external reconfiguration step between measurement samples.