DMA to WWM - 3 phase sinewave generator

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
10 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

   

Bob

0 Likes
Anonymous
Not applicable

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

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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 

0 Likes
lock attach
Attachments are accessible only for community members.
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

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

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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?

0 Likes
Anonymous
Not applicable

missprinted! this is message to support smiley      

0 Likes