Hello everybody. Just as a heads up I would like to say I won't be able to post much of my code due to the nature of my work but I will try posting relevant pieces as much as possible.
Currently I have set up the PDB to initiate DMA transfers from a look up table to the DAC output at some fixed frequency (4096 or 2048 samples in 5ms, so 1 sample per 1.22us or 2.44us). What I would like to be able to do is to use some multiple of this frequency - sufficiently large to ensure the ADC has successfully sampled and converted the DATA - to initiate sampling on the ADC and when the result is ready to initiate a DMA transfer into a buffer (eventually ping pong buffers but that is a post for a later date).
This is for a radar application and the ADC samples need to be very well aligned with the start and end of the DAC output waveform (let's call it a ramp for simplicity). What this means is that if I output 2048 samples to the DAC and read an ADC value every 4 samples, I would have 512 samples in one ramp pulse that I know are well aligned to this pulse. Hence the transfer to the DAC and initiation of ADC sampling would have to happen concurrently (or close to that) on every fourth pulse. The problem here is that if I use the PDB to time DMA transfers to the DAC I don't know how to use some multiple of this to time the ADC samples. Using the same timing would be way to fast for the ADC.
Therefore I turn to you for help in how to achieve this goal. I am not tied to the PDB by the wat but I would like to stick to DMA transfers if possible.
Thank you very much in advance!
P.S: I have achieved this using the Interval Timer (PIT) interrupts to time everything correctly. Unfortunately there is some jitter when I try write the ADC samples to the PC via USB because I imagine the USB suspends interrupts in order to transfer data which messes up my timing. This is an issue that I may make a separate post about in the future, but I am not sure there is a solution.
Currently I have set up the PDB to initiate DMA transfers from a look up table to the DAC output at some fixed frequency (4096 or 2048 samples in 5ms, so 1 sample per 1.22us or 2.44us). What I would like to be able to do is to use some multiple of this frequency - sufficiently large to ensure the ADC has successfully sampled and converted the DATA - to initiate sampling on the ADC and when the result is ready to initiate a DMA transfer into a buffer (eventually ping pong buffers but that is a post for a later date).
This is for a radar application and the ADC samples need to be very well aligned with the start and end of the DAC output waveform (let's call it a ramp for simplicity). What this means is that if I output 2048 samples to the DAC and read an ADC value every 4 samples, I would have 512 samples in one ramp pulse that I know are well aligned to this pulse. Hence the transfer to the DAC and initiation of ADC sampling would have to happen concurrently (or close to that) on every fourth pulse. The problem here is that if I use the PDB to time DMA transfers to the DAC I don't know how to use some multiple of this to time the ADC samples. Using the same timing would be way to fast for the ADC.
Therefore I turn to you for help in how to achieve this goal. I am not tied to the PDB by the wat but I would like to stick to DMA transfers if possible.
Thank you very much in advance!
P.S: I have achieved this using the Interval Timer (PIT) interrupts to time everything correctly. Unfortunately there is some jitter when I try write the ADC samples to the PC via USB because I imagine the USB suspends interrupts in order to transfer data which messes up my timing. This is an issue that I may make a separate post about in the future, but I am not sure there is a solution.