Cypress Perform

Home > Design Support > Cypress Developer CommunityTM > Cypress Forums > PSoC® 3 > DMA to WWM - 3 phase sinewave generator

Bookmark and Share
Cypress Developer CommunityTM
Forums | Videos | Blogs | Training | Rewards Program | Community Components



DMA to WWM - 3 phase sinewave generator
Moderator:
RKRM

Post Reply
Follow this topic



DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 18 May 2012 3:24 PM PST
Top Contributor
23 Forum Posts

Hi, I can't find any application note wich could help to clear DMA to PWM data flow settings.

I build 3 phase inverter using dma but there is no description (at least I coudn't find) how to make dma send bytes to pwm duty register.

My project attached (main.c file is just copied from another appnote) . Any help welcomed

Oleg




Re: DMA to WWM - 3 phase sinewave generator

Bob Marlowe posted on 19 May 2012 02:13 AM PST
Top Contributor
1768 Forum Posts

There are two issues I found at first sight:

Your PWM is defined to be 16 bits wide, but your wavetable is 8 bits and your dma is 1 byte per burst. you shoulkd set the PWM to be 16 bits.

The address in DMA (VDAC) is undefined, because you use a PWM. The correct value should be something like

PWM_1_PERIOD_LSB or PWM_1_PERIOD_LSB_PTR

There is a WaveDAC component which will suit your needs easier which is to be found here http://www.cypress.com/?rID=54769&cache=0 

although this component will use 3 of the four DACs in the PSoc3-chip for your 3 phases

 

Hope that helps

Bob

 

 

 

 

 



Re: DMA to WWM - 3 phase sinewave generator

Bob Marlowe posted on 19 May 2012 02:14 AM PST
Top Contributor
1768 Forum Posts

mis-typed (and NO edit-function here!) You should set your PWM to 8 Bits wide (not 16)

Bob



Re: DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 19 May 2012 07:22 AM PST
Top Contributor
23 Forum Posts

thanks for the help. this is my first project (apart from following appnotes) and the graphical programming is something I haven't done before.

My idea was 16 bit pwm but it doesn't really matter as long as issue is to understand working flow. I tried to use dma wizard to make dma send bytes to pwm but  I stopped on stage where I had to configure transaction descriptors. How to find out destination address? I suppose this is duty register, but where to find its assress? graphical programming isn't easier after low level text programming for me. For the dac they use destination LO16(VDAC8_DATA_PTR)  but they don't describe where to get it

I can't use dac because my outputs control 3 mosfet half bridges to generate sinewaves

and thank you again



Re: DMA to WWM - 3 phase sinewave generator

Bob Marlowe posted on 19 May 2012 08:24 AM PST
Top Contributor
1768 Forum Posts

When you build a project a handfull of files are generated. They all start with the module-name you used. So in your project you'll find a file "PWM_1.h" which contains all the C-declarations you may use to access PWM_1. There I found the declarations I showed you. There is no magic behind that.

Do not alter those files (unless you are instructed to do so) because they are overwritten each tim you re-build your project. Since the absolute addresses may change from build to builld depending on additional hardware you define and use it is strongly recommended to use the names from the .h-files and not any absolute addresses.

 

Bob



Re: DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 19 May 2012 03:25 PM PST
Top Contributor
23 Forum Posts

just realized that. but if you just have started project and after configuring hardware  start writing code - there is no any *.h files. so then you build application without code and get *h files. right?

anyway, it still doesn't work. can't think what else is wrong.



Re: DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 20 May 2012 04:47 AM PST
Top Contributor
23 Forum Posts

But the same hardware single phase dma-pwm generator is working. so what's wrong with my 3-phase? any clue? 



Re: DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 20 May 2012 08:40 AM PST
Top Contributor
23 Forum Posts

I got a great help from Russian community on kazus.ru. assigning a name "C" to one of my output pins stops my project from working!

Once I changed the name it works 



Re: DMA to WWM - 3 phase sinewave generator

Bob Marlowe posted on 20 May 2012 08:57 AM PST
Top Contributor
1768 Forum Posts

Yes, I came to a similar conclusion as I noticed that your program dead-looped in the initialization code. So I re-built it from scratch and my scope told me it was working.

I changed some of the parameters you used for initializing DMA, that will not have any impact on the current project, but makes life so much easier when switching to PSoC5.

You'll have to phase-shift your 2 phases. t´his can be done by an initial TD that sets up within your table and is followed by a complete TD which is looped on.

Additionally you might put the table into the code-area thus saving ram by

1. Prepending the definition of wave with CYCODE

2. Setting up the DMA for a source of Flash-memory

 

Have a brief look at the examples in the DMA-datasheet concerning "DMA Address Portability"

 

Bob



Re: DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 21 May 2012 02:40 PM PST
Top Contributor
23 Forum Posts

Great job! Thanks a lot. Your circuit isn't very clear for me but it works, so my project had a kick  ahead. I'd be pleased if you'd go into details how it's working if you have a couple free minuts or make an appnote.

Meanwhile, I also had success with some help. my 3 phase generator also works but it's different. I had a problem while building it - when I have a name "C" to one of my outputs (phase C now) - project didn't work! only work with other names! Why is that?



Re: DMA to WWM - 3 phase sinewave generator

Oleg_S posted on 21 May 2012 02:44 PM PST
Top Contributor
23 Forum Posts

missprinted! this is message to support  






ALL CONTENT AND MATERIALS ON THIS SITE ARE PROVIDED "AS IS". CYPRESS SEMICONDUCTOR AND ITS RESPECTIVE SUPPLIERS MAKE NO REPRESENTATIONS ABOUT THE SUITABILITY OF THESE MATERIALS FOR ANY PURPOSE AND DISCLAIM ALL WARRANTIES AND CONDITIONS WITH REGARD TO THESE MATERIALS, INCLUDING BUT NOT LIMITED TO, ALL IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT OF ANY THIRD PARTY INTELLECTUAL PROPERTY RIGHT. NO LICENSE, EITHER EXPRESS OR IMPLIED, BY ESTOPPEL OR OTHERWISE, IS GRANTED BY CYPRESS SEMICONDUCTOR. USE OF THE INFORMATION ON THIS SITE MAY REQUIRE A LICENSE FROM A THIRD PARTY, OR A LICENSE FROM CYPRESS SEMICONDUCTOR.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms and Conditions of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms and Conditions of this site. Cypress Semiconductor and its suppliers reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Spec No: None; Sunset Owner: GRAA; Secondary Owner: RAIK; Sunset Date: 01/01/20