cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1

JoDu_3224996
New Contributor

Hello,

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?

Thank you

0 Likes
1 Solution
Bob_Marlowe
Expert II

"Should I transfer from ADC to a variable doing a DMA transfer from ADC to SRAM"

No, not to a variable, but into a UDB. A PSoC42xx usually has got 4 of those. See here what a UDB is.

Bob

View solution in original post

13 Replies
KyTr_1955226
Valued Contributor

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.

0 Likes
EvPa_264126
Valued Contributor II

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.

DMA2.png

odissey1
Honored Contributor II

Evgeniy,

The Brad Budlong's blog is no longer available. Can you post his Tx UART component?

/odissey1

0 Likes
odissey1
Honored Contributor II

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.

/odissey1

0 Likes
EvPa_264126
Valued Contributor II

I'm not sure that he's whole and working.

I used it in my ancient project: PSoC_OSC_12bit.zip

0 Likes
JoDu_3224996
New Contributor

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.

0 Likes
odissey1
Honored Contributor II

ja.duarte,

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

/odissey1

0 Likes
JoDu_3224996
New Contributor

Sorry about that. Here it is!

0 Likes
odissey1
Honored Contributor II

ja.duarte,

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.

/odissey1

DelSigADC-Filter-DVDA_01a_scm.png

EvPa_264126
Valued Contributor II

and control the execution time of the interrupt

By the way, concerning the limitation of the data value there was a discussion here:

Importance of saturation instructionsfltr.png

Bob_Marlowe
Expert II

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.

Bob

JoDu_3224996
New Contributor

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?

0 Likes
Bob_Marlowe
Expert II

"Should I transfer from ADC to a variable doing a DMA transfer from ADC to SRAM"

No, not to a variable, but into a UDB. A PSoC42xx usually has got 4 of those. See here what a UDB is.

Bob

View solution in original post