cancel
Showing results for 
Search instead for 
Did you mean: 

Generating variable frequency PWM on SPC570s

ThanhTung Nguyen
Associate
Posted on October 27, 2017 at 07:17

Dear All

I am trying to generate the variable frequency PWM on SPC570s using Evaluation Board following the documents

'SPC570Sx 32-bit Power Architecture

microcontroller for automotive ASILD applications'

page 759 Usage of Compare Registers

I am using the dual compare registers COMP1 and COMP2 to generate 

variable

frequency PWM. I always get problems '

when changing COMP1 and COMP2 while the counter is active

', the term 

Use caution when changing COMP1 and COMP2 while the counter is active. If the counter has already passed the new value, it will count to 0xFFFF or 0x0000, roll over, then begin counting toward the new value.

The check is: CNTR = COMPx,

not

 

CNTR > COMP1 or

 

CNTR < COMP2. That why I used CMPLD1 and CMPLD2 to pre-load the value of COMP1 and COMP2.

The problem is whenever I use interrupt to change (update new) frequency by changing CMPLD1 and CMPLD2. Although at the beginning, the PWM looks good, however, they do not become complementary PWM anymore when the Frequency is changed in interrupt. The changing value is from 100kHz to 300kHz

Best Regards

#cmpld1 #spc570s #variable-frequency-pwm #cmpld2
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
0 REPLIES 0