Sorry I wasn't very clear initially, to be more specific, I am sending out a signal on the DAC, which will be filtered by some external components. That signal is then being fed back into the processor (ADC0). The filtered signal is also sent to a sensor, whose response is being read by ADC1.
I finally got this to work. It took awhile to figure out that the PDB does not trigger the DAC like it does the ADCs.
I set up the PDB with Prescalar=1, Mult=1 and MOD=284 to give me my base frequency of 211,267 Hz.
ADC's PreTrigger values are PDB0_CH0DLY0 = 40, PDB0_CH1DLY0=50. Again I'll note that if these 2 values are too close the 1st value read is incorrect. All subsequent values appear to be fine.
The DAC's PDB "Interval" is set to 284. The DAC is using a normal buffer that has 10 values.
DMA is being used to store the ADC results to ram.
I've been adjusting the ADCs sample timing and Hardware Average values to find the optimal settings. However the results are not what I had anticipated. To test this out I am reading DAC0 back into ADC0 on AD23, and ADC1 is connected to the K60's POT on AD20. I have both ADCs set for LongSampleTime ADLSMP=1, and High-Speed Configuration ADHSC=1. As I change the ADLSTS (Long Sample Time Select) from 2 extra ADCK cycles to 20 ADCK cycles, the standard deviation of the measured values actually increases. I am measuring 100 ADC values, and have run the test 3 times. The POTS measured values (raw data) have a STD of 20 at 2 extra ADCK's and it raises to 120 at 20 ADCKs, with hardware averaging off. I would have thought the opposite would have happened. And with the system using 4 Hardware averages, the STD is consistently 180, no matter how many extra ADCKs are use. (Yes I do calibrate the ADCs at the start of each test.)
I've been looking for information on the PDB Stall / ADC Overflow issue but have not found anything that resolved the issue. If you could you provide me with a link? I'm curious to know what these issues are and how to recover from them.
The last thing I still need to do is to stop the data acquisition after 100 data points have been read into each ADC. My plan is to use the DACs Buffer Read Pointer Top Flag Interrupt and have the ISR disable the PDB after a count of 10.
Does that sound reasonable?
Thanks