Hey. I'm working on a project that utilises a PSoC to link to a 40kHz sonar transducer pair to implement synthetic aperture imaging.
I have an ambitious plan.
1. The transmitted waveform utilizes the DAC to output voltages using a predefined lookup table via the DMA component. I have this already set up and working, but it's running on an infinite loop. How do I set up the DMA to run a one-shot set of outputs?
2. The received waveform will be sampled by the ADC. I'm looking to either transfer each sample using the UART to a PC (good old RS-232) sample by sample, or save several thousand 8 bit ADC samples onto the PSoC, then transfer them in bulk to the PC. FIRST, is there enough space on the PSoC for all these samples, and SECOND, can I implement this second transfer using DMA as well?
3. Is there any way to do the above 2 steps without involving the CPU? ie CPU tells DMA to start output waveform. When all the the output waveform points have been shipped to the ADC, the DMA signals the ADC to start sampling, and simultaneously start transferring sampled values?
3. Is there any way to do the above 2 steps without involving the CPU? ie CPU tells DMA to start shipping to the DAC at 1msps. When all the output waveform points have been shipped to the DAC, the DMA signals the ADC to start sampling, and simultaneously start transferring sampled values?
One way to get the data out, would be to use a timer to kick the DMA, for each sample. The same signal could be wired to a counter to count the number of samples, and have the counter interrupt when the number of samples are complete.
For transferring the Look up table values to a DAC, set up a DMA TD that has source address as SRAM location where, the look up values are stored and the destination address as the VDAC Data Pointer. The TD should have the next TD as Invalid TD, so that the chain terminates. Note that there was an errata on ES2 Silicon, that says that the TD chain will not terminate inspite having INVALID_TD parameter. This issue has been fixed in ES3 . Hence there wont be any kind of Infinite loops. However there are workarounds to make it work on ES2 as well. Let me know if you are using ES2.
Yes there is enough space. There is 8KB SRAM in PSoC3. Or it is possible to do the sample by sample transfer using the DMA. In this case, the source for the DMA will be the ADC Data registers and the destination will be the UART TX Data Pointer. Note that the DMA rate of transfer can be controlled using the drq terminal. Hence you can use the ADC EOC terminal to trigger the DMA transfer.
Yes it is possible to do the complete transfer without CPUs involvement. You need to configure the DMA appropriately and provide proper terminations and triggers.