I'm a PSoC beginner and I need to apply a math function to each sample converted by an ADC in order to have a certain result on the output of a VDAC. This needs to be applied considering that the value of the samples is read in Volts.
I'm using an ADC DelSig with 16 bits and I'm only transferring the 12 MSB to a DVDAC with 12-bit resolution through DMA. Also, I'm using an oscilloscope to analyze the results.
Basically, the question is: is there any way to access each sample, modify its value and then transfer it to the VDAC?
Solved! Go to Solution.
I would also be curious to know if this is something that's doable using a single DMA. My first reaction is that you can't, because at some point between coming out of the ADC and moving to the DAC, you would need to get at the value and modify it. The whole idea with DMA is to have no CPU intervention in the process, and modifying the value is inserting CPU intervention in the process.
I'm not super familiar with using DMA, but I think you would have to 2 DMA transactions.
First DMA transaction would take your ADC reading and drop it into a RAM location. You would trigger an interrupt off the nrq signal of the DMA component to know when you have a new ADC value ready.
You could then do any math you need to the value. If it's a quick simple operation (like a bit-shift) you could just do it inside the ISR tied to nrq.
Once you modify the value, you could then enable a separate DMA transaction to get it to the DAC.
FWIW I have no idea if two DMA transactions is worth doing in this way. Someone more experienced in DMA could probably break it down, I've only really used DMA to drop ADC readings into RAM.
variant: use the intermediate register. (.. DMA-> REG-> DMA ..)
I used registers to add digital signals to 12 bits of ADC.
But this did not involve processing.
The Brad Budlong's blog is no longer available. Can you post his Tx UART component?
The data rate for DelSig-ADC is rather low (<40kHz), it can be sampled, modified and written to the DAC within a single interrupt on data ready.
I'm using the project attached. The filter component is only being used as a register to transfer data from the ADC to the VDAC. Should I have an ISR tied to nrq of the DMA as well with the instructions I need to modify each sample?
How does the data transfer should be done having these new instructions?
Sorry for any silly question.
archive is damaged. Upload project using Creator standard way: (1) first clean the projec using Build->Clean; (2) Select project name in the Explorer window ->Create archive bundle->Minimal; (3) you can further save space by deleting "Generated files" folder inside archive. (4) upload the provect_archive.zip
It appears to be Cypress standard ADC-Filter-VDAC8 project. I updated ISR code to pass data to DVDAC in 12-bit mode (attached). Project is untested.
Please note that DVDAC is not an actual 12-bit DAC. It performs very poorly in 12-bit mode (INL looks rather like a 9-bit, see Fig.15). More about DVDAC here: http://www.cypress.com/documentation/application-notes/an64275-psoc-3-and-psoc-5lp-getting-more-reso...
Further more: it makes no sense to sample signal at 16-bit (+Filter) to make less than 12-bit output.
One more hint for a solution:
When the modification of the ADC value is not too complex you may use a self-made datapath component which is DMA capable. Using two DMA channels the transfer chain ADC -> Modification -> DVDAC can be made.
I'm a little bit lost here, how exactly should I do this?
Should I transfer from ADC to a variable doing a DMA transfer from ADC to SRAM, and then another DMA transfer from that variable to the Filter Pointer? Where should I put the modification code?