random PWM generation with timer interrupts - EVM56F8367, CW7.2

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

random PWM generation with timer interrupts - EVM56F8367, CW7.2

2,224 Views
kgeldhof
Contributor I
Hello,

I use the peripheral PWM module on the 56F8367 evaluation board to create edge-aligned PWM waveforms with a period of 100us. This works fine. I also need two channels of the PWM-module to output a 5us pulse, with the rising edge at 30us after the beginning of the PWM period and the falling edge at 35us.

For this purpose I used a timer bean in "Count Mode" and with the option "toggle OFLAG and alternate compare registers". The values of CMPLD1 and CMPLD2 registers correspond to 30us and 5us delay. This works fine as the OFLAG output is the waveform I want. In order to get this output from the PWM channels I defined an interrupt routine "OnCompare" which should be called when the timer reaches its compare values. The routine should then set the (software-controlled) PWM channels high or low.

The timer bean automatically generates the interrupt routine "OnCompare":

#if defined(OnCompare_FAST_INT)
asm void OnCompare(void)
#else
#pragma interrupt
void OnCompare(void)
#endif
{
  /* Write your interrupt code here ... */
}
#if defined(OnCompare_FAST_INT)
  frtid;
  nop;
  nop;
#endif

In this routine I wrote following code:

static int k=0;
// clear timer compare interrupt flags
clrRegBit(TMRC0_SCR,TCF);
clrRegBits(TMRC0_COMSCR,TMRC0_COMSCR_TCF1_MASK|TMRC0_COMSCR_TCF1_MASK);
k=1-k;
if (k==1)    // rising edge of pulse
  {
    // turn on PWM channels 4 and 5
setRegBits(PWMA_PMOUT,PWMA_PMOUT_OUT4_MASK|PWMA_PMOUT_OUT5_MASK);
  }
  else
  {
   // turn off PWM channels 4 and 5
clrRegBits(PWMA_PMOUT,PWMA_PMOUT_OUT4_MASK|PWMA_PMOUT_OUT5_MASK);
  }

However, I see no output at the PWM channels. I also notice that other interrupt routines in my project (like the ADC-OnEnd ISR, Periodic Timer ISR, ...) are not executed anymore! How come?
Labels (1)
Tags (1)
0 Kudos
Reply
1 Reply

501 Views
trytohelp
NXP Employee
NXP Employee
Hi,
This is not easy to determine the cause of the problem.
The better way will be to log it directly in the Technical support system.
Please use Freescale on line support web page.
  - Go to following URL: http://www.freescale.com/TechSupport
  - Click on Submit a Service Request. You will come to a login page.
  - You can submit your request through the web from there.
Please provide us more details about the Tool version used.
To do that you must:
* CW:
Start the IDE and click on Help | About Metrowerks CodeWarrior.
Click on Installed Products 
Provide us all info displayed.
Or you can save them in a txt file.
Can you please provide us your example reproducing the issue ?
 
 
FYI
 
Freescale 56800/E Digital Signal Controllers Version 8.2
You can download this version on our web site via the link:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-56800E-DSC
For details please have a look in:
http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=CW-56800E-DSC&tab=In-Depth_Tab
In the download tab you can download the Special Edition or the Evaluation.
The Special edition contains the special edition license limited to 32 kb of Code.
If you need another version of the license please contact your local distributor.
You can purchase it directly from the web site too.
We changed the pricing and packaging structure for Codewarrior Tool.
Now there are 4 suites:
 special (free version)
 basic
 standard
 professional
Please refer to the link for details:
http://www.freescale.com/webapp/sps/site/overview.jsp?nodeId=0127262E703BC5
Go to the www.freescale.com and click on My Freescale.
After you were logged, select CodeWarrior Licensing under MY Secure Application.
In the new dialog you can manage your license file.
Keep in mind you can have several versions installed on the same PC.
There is only one restriction: install them on separate folder.
If you're using an old version, please backup your project before to try it with this new version.
If you will meet some compatibility issue you could back to the older version without problem.
 
Pascal
0 Kudos
Reply