I fail to see all this effort to incorporate a DC Offset adjustment for the square/aux channel when there is no amplitude adjustment. All of the sources will be fixed logic levels. The 'sign-bit' output of the AD9834 does not vary with FSadjust. Most likely you will want this output to be solely positive to some logic device or gate. In my experience with it, I have found uses for an amplitude adjustment that was 0V to some +V value though (When using a PWM output for example.).
I guess I'm trying to be able to generate 0-centered square waves, but I'm really racking my brain for a reason to have anything other than 0-centered or 0-V
+ on the square/aux channel... and really coming short on the former too, other than "because I can". How do you implement the amplitude adjustment? The easiest way I can think of on the spot is to power the AD9834 from 5V from USB so that sign-bit out is 0-5V, then can be attenuated down to 3.3V, 1.8V, 1V or whatever with discrete steps.
This would also simplify the circuit overall, only needing the single high-speed opamp for the primary channel, and the one lower speed for DC offset.
I don't think I would be too worried about filter losses and DC offset errors at this point. More concerning would be the flatness of the filter in the pass-band. I had to fine tune (in software) both the gain and the DC offset after the hardware was built. I suspect you will need small scaling factors in your software too in order to get exact results. In addition, you will probably have two different scaling factors dependent on whether you have the attenuator switched in or out.
Yes, this is one of the reasons I want some kind of loopback to the MCU from multiple points to be able to do some calibration and store that information to the internal EEPROM on the STM32. Then some algorithm on the software side to do be able to automate that process when required. I was thinking tapping off a few points:
- DC offset. While I can't directly monitor the whole range (my circuit maps [0,3.3] onto [2.5,-2.5]), I want to measure a few points on the positive side and linearly interpolate that through the range
- Sine output (post diff-opamp). Setting the AD9834 reset bit I should get a mid-scale output, which after performing (1), would allow me to be able to calibrate FSadjust by adding a DC offset to place the mid-scale output within the middle of the STM32 ADC range. This would be performed both with and without attenuation.
As far as compensating for the insertion loss of the filter over frequency ranges, the only way I could really see that being done automagically is with a fastish ADC (>=100MS/s for a 10Meg signal). That hardly seems worth it here, I'd probably just do this manually.