cancel
Showing results for 
Search instead for 
Did you mean: 

generating a PWM reference signal(Modem)

manoritesameer
Associate II
Posted on May 02, 2014 at 21:34

Hello everyone,

      I have a PWM signal generated from an external source and I want to create a reference signal from this one. First this signal is of constant duty cycle (I want to create a reference signal here), later on the signal is modulate. (Basically Modulation and Demodulation of a Digital Signal) 

How would I do this. Thanks

  

#stm
5 REPLIES 5
Posted on May 02, 2014 at 22:40

I have a PWM signal generated from an external source and I want to create a reference signal from this one. First this signal is of constant duty cycle (I want to create a reference signal here), later on the signal is modulate. (Basically Modulation and Demodulation of a Digital Signal) 

 

''First this signal is of constant duty cycle'' which one? The source or the reference?

Depending on the frequency, you can count the cycles of the original source, integrating over time, or you can time-stamp the rising/falling edges, and determine frequency/duty.

If you know the frequency, you can program a timer within the integer divider limits of the design. There are better ways of generating signals, but ST didn't implement them.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
manoritesameer
Associate II
Posted on May 02, 2014 at 23:01

thanks clive,

       The thing is I can calculate my frequency and Duty cycle to generate a PWM signal, but unfortunately the signal would be out of sync i.e the off time on one may be over the on time of the second though they maybe of the same duty cycle.

The intent is get the modulated signal from the carrier frequency.

Thanks

Posted on May 02, 2014 at 23:19

It would take effort to synchronize them, but you can control the phase through the TIMx->CNT and period TIMx->ARR

You can have one channel in PWM Output mode, and others in Input Capture mode, you could measure the relative phase.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
manoritesameer
Associate II
Posted on May 05, 2014 at 22:53

hello clive, 

      thanks for the suggestion, I dont how to do this, but if I am using exti and detect the rising edge of the signal(set a bit) and then start a timer and when the timer expires (reset the bit) would that create a reference PWM. 

Thanks

Posted on May 06, 2014 at 01:57

I guess you could use EXTI, but you can interrupt off timer pins, they can latch the ''phase'', so are immune from interrupt latency.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..