3 Phase PWM with different Frequencies

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

cross mob
Not applicable
Hello,

I want to pulse 3 Lasers in the following pattern

1 - 2 - 1 - 3 - 1 - 2 - 1 - 3 - 1 and so on. The resulting duty cycle of the combined pattern is 50%

In this case the main laser (1) is pulsed with a frequency of 20 kHz and a duty cycle of 25%. In the first off time (laser 1) the second laser (2) pulses with a frequency of 10 kHz and 12,5% duty cycle. The third laser (3) pulses in the second off time of laser 1 with 10 kHz and 12,5% duty cycle. The second laser (2) needs a phase shift of 90° and the third laser a shift of 270°.

In the GUI-menu of the pwmapp I have not found any option to set the phase shift. Is it possible to achieve my required pattern? Can I set the settings once and than the pattern works, when I start the app by software? Or do I have to set the values each time I start the app?


I know that the DAC has nothing to do with the PWM but is it possible to predefine jumps of the DAC, so that the DAC jumps to exact values in the similar pattern when I start the DAC? (I don't want to power the lasers with the DAC but I thought about using the DAC as alternative reference voltage of my ADCs and I expect different values for the different lasers)

Thank you very much for your help!

Regards,
MTR
0 Likes
4 Replies
Travis
Employee
Employee
First solution authored Welcome! 500 replies posted
MTR wrote:
Hello,

I want to pulse 3 Lasers in the following pattern

1 - 2 - 1 - 3 - 1 - 2 - 1 - 3 - 1 and so on. The resulting duty cycle of the combined pattern is 50%

In this case the main laser (1) is pulsed with a frequency of 20 kHz and a duty cycle of 25%. In the first off time (laser 1) the second laser (2) pulses with a frequency of 10 kHz and 12,5% duty cycle. The third laser (3) pulses in the second off time of laser 1 with 10 kHz and 12,5% duty cycle. The second laser (2) needs a phase shift of 90° and the third laser a shift of 270°.

In the GUI-menu of the pwmapp I have not found any option to set the phase shift. Is it possible to achieve my required pattern?
Travis: Yes, by adjusting the duty cycle or the compare match value you can actually cause a phase shift changes. Can you draw out the require PWM pattern for this case for further discussion?

Can I set the settings once and than the pattern works, when I start the app by software? Or do I have to set the values each time I start the app?
Travis: You just need to do the configuration only once.

I know that the DAC has nothing to do with the PWM but is it possible to predefine jumps of the DAC, so that the DAC jumps to exact values in the similar pattern when I start the DAC? (I don't want to power the lasers with the DAC but I thought about using the DAC as alternative reference voltage of my ADCs and I expect different values for the different lasers)
Travis: This sounds innovative, but I prefer you to use a stable voltage reference for ADC.

Thank you very much for your help!

Regards,
MTR


Hi MTR,

I would suggest that you set a structure array containing the frequency and duty cycle parameters for the PWM patterns. During the compare match interrupts, load the next required PWM pattern parameters into the shadow compare(duty cycle) and period(frequency) registers.

Your PWM requirements is possible to achieve, we can discuss further if you have any issue.

Best Regards
Travis
0 Likes
Not applicable
Hi Travis,

thank you very much for all your answers on my topics. I had some problems with some other parts of my project, that is why I'm answering that late.

Wouldn't it be easier to do something like the PWMMP001_Example2? The duty cycle is set in a switch case structure . It should be possible to do switch on and off three different PWM signals with their settings, or did I misunderstand something?

The problem is: That all would result in one PWM signal with a changed pattern, right? To control the three lasers, I would need to set three PWM signals. Actually the pattern doesn't change at all, only the start is the tricky part:
Laser 1: Delay 0, Duty 12.5µs, Period 50µs
Laser 2: Delay 25µs, Duty 12.5µs, Period 100µs
Laser 3: Delay 75µs, Duty 12.5µs, Period 100µs.


If that all is solved by the structure array, than I didn't understand it, I'm sorry! For me it sounded like it would be the same, if I would set a port to high for a certain time and after that I set another port to high and so on...

Thank you again for your help. Maybe you can explain your solution again, because I have no idea how to do this.

Best regards
MTR
0 Likes
Not applicable
Hello again,

Yesterday I spent a lot of time doing some tests with the PWM to solve my problem. I ended up with the example PWMMP001_Example2 with an added PWMSP002 App. The SP002 runs with 20 kHz and a Duty Cycle of 25% and the two Phases of the MP001 run at 10 kHz with a 12.5% DutyCycle. If I do a single shot with the oscilloscope it looks pretty good, so that the peaks are in the same distance to each other and at the right position. But in Run-Mode at the oscilloscop it seams like the MP001 Signals are 20 khz as well, because their phase is changing. I made two screenshots with the oscilloscope:
You can clearly see the change of the top and the bottom signal. If you do a superposition, it seams like they are also at 20 kHz.

So here is my question: How can I syncronize the two signals from the PWMMP001 and the PWMSP002 App?

Thank you very much
MTR
0 Likes
Not applicable
Hello,

sorry for the post this morning. I found a soulution for my problem. The oscilloscope used the wrong channel for triggering. The signal is constant and works fine for me.

Best regards
MTR
0 Likes