cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 5, 3 & 1 MCU

Anonymous
Not applicable

I am practicing setting up DMAs by using the examples given here:

http://www.cypress.com/documentation/application-notes/an52705-psoc-3-and-psoc-5lp-getting-started-d...

I would like to be able to change the phase of the sine wave by using a potentiometer. Does anyone have any tips on how to accomplish this?

0 Likes
1 Solution
odissey1
Honored Contributor II

choblet,

I looked through few options, it seems the most stable for multiple sine outputs is the project created by Evgeniy Pavlov (AKA 'pavloven') on Jun 18, 2016:

Generating multiple waveforms with fixed phase relationships

To keep two sine outputs synchronized it uses intermediate location in memory, which data is fetched by 32-bit DMA source. To have sine phase shifted, the sourcing array in RAM is simply re-calculated, which takes some time and may (potentially) lead to discontinuities when old data in RAM is being overridden.

I cosmetically freshened the original project, translating comments to English and adding phase update on timer event. Project is attached

/odissey1

DMA8x3_01a.png

DMA8x3_01b.jpg

View solution in original post

5 Replies
odissey1
Honored Contributor II

choblet,

The sine wave has no phase by itself, only as referenced to another wave of the same frequency. That second wave can be e.g. TTL-level digital signal with 50% duty cycle, or yet another sine/cosine wave (and the implementation would vary). So what exactly you looking for?

/odissey1

0 Likes
Anonymous
Not applicable

I'm actually generating two sine waves using the same lookup table, and one of them will remain unshifted for reference.

I use a DMA to transfer the data from the array into SRAM so I can reach higher frequencies.

From there I am able to set up two DMA channels with separate TDs that take data from the table and send it to their respective VDACs. I output the signals to pins and observe two sine waves on the scope.

I found that I can change the frequency of the signal by changing the frequency of the clock to one of the DMAs, but I haven't found a way to change the phase yet.

I would essentially like to be able to control the phase shift of one wave relative to the other by using a potentiometer.

I don't even know or understand how the DMAs or TDs work well enough to figure out what I would change to get the wave to shift. I've been reading the documentation and tinkering around, but I haven't been able to observe any results, so I don't know what affects what.

I have tried changing the address in the lookup table that the TD goes to, hoping that if the address pointed to data entry 64 of the 128 data points it would shift the signal by 90 degrees, but I couldn't figure it out.

0 Likes
odissey1
Honored Contributor II

There are several solutions available, I will draft some demo on weekend.

Anonymous
Not applicable

Thank you, I would greatly appreciate it.

0 Likes
odissey1
Honored Contributor II

choblet,

I looked through few options, it seems the most stable for multiple sine outputs is the project created by Evgeniy Pavlov (AKA 'pavloven') on Jun 18, 2016:

Generating multiple waveforms with fixed phase relationships

To keep two sine outputs synchronized it uses intermediate location in memory, which data is fetched by 32-bit DMA source. To have sine phase shifted, the sourcing array in RAM is simply re-calculated, which takes some time and may (potentially) lead to discontinuities when old data in RAM is being overridden.

I cosmetically freshened the original project, translating comments to English and adding phase update on timer event. Project is attached

/odissey1

DMA8x3_01a.png

DMA8x3_01b.jpg

View solution in original post