Help with DSP56F805 PWM etc.

Started by Unknown June 20, 2002
Please Help,

I am in way over my head. All of a sudden I find myself declared the
Expert on my project, this happened
when I was not looking :(.

I am currently involved on a project where I am supposed to program a
DSP56F805 dev board for PWM independent

I need ~200Hz PWM period with edge aligned independent operation of 4 PWM
channels (PWM0 - PWM3).

Without using the DSK(I can't figure that stuff out), I need the
initialization code to set up the PWMA module. I have a sort of hello
which runs using Metrowerks and dev board but whatever I try I cannot seem
to get PWM operational.

Please if there is a kind sole who could send me some code (Well
Documented) or post here, that would operate the PWM
it would really help me out.
Many Thanks In Advance,


Mitchel J. Stein (Mitch)
Philips Research USA
345 Scarborough Rd.
Briarcliff Manor, NY 10510

Phone: (914) 945-6427 Fax: (914)945-6014

** NOTE- My opinions are just that, "MINE", and they do not reflect those
of my employer **

Hi Mitch,

I got a good chuckle out of your post, thanks.

There are a lot of settings to make for the PWM
to actually output something. I've struggled
myself. The code below is what I use to init my
pwm-A. It uses some of the low-level SDK stuff.
It sets up only 2 channels for pwm but it could
get you started (the other channels are software
controlled outputs). Read and re-read the PWM
chapter of the DSP User's Manual for more info
on the registers and bit assignments and operation.

Good Luck,

void InitPWMs(void)
//set edge and independent channels, all (no dead time)
periphBitSet(0x100E, &ArchIO.PwmA.ConfigReg);
//disable all faults
periphBitClear(0xFFFF, &ArchIO.PwmA.DisableMapping1Reg);
periphBitClear(0x00FF, &ArchIO.PwmA.DisableMapping2Reg);
//Clear pending faults
periphBitSet(0x0055, &ArchIO.PwmA.FaultStatusReg);
//enable pwmA0-5 outputs (bit 15).
//enable software control for led tests of pwmA5-2 (bits 13:10).
//pwmA1-0 are for bulk ps control
periphBitSet(0xBC00, &ArchIO.PwmA.OutputControlReg);
//pwm resol. 10 bits (39khz)
periphMemWrite(0x0400, &ArchIO.PwmA.CounterModuloReg);
//initial fwd dc = 50%
periphMemWrite(0x0200, &ArchIO.PwmA.ValueReg[0]);
//initial rev dc = 50%
periphMemWrite(0x0200, &ArchIO.PwmA.ValueReg[1]);

//load settings
periphBitSet(0x0002, &ArchIO.PwmA.ControlReg);
//enable pwmA
periphBitSet(0x0001, &ArchIO.PwmA.ControlReg);

} // InitPWMs