Hello,
I have tried to look for PWM chopper module example project in control suite, but couldnt find any. Can anyone let me know how can I get better understanding of it. I need to generate 7 pwms with a gap before the next 7 pwms.
Regards-
This looks pretty close for the TZ setup anyway. I don't have a device available to run this on at the moment. You only actually need to enable one CBC source since these are on the same PWM.
EPwm2Regs.TZSEL.bit.CBC1 = 1;EPwm2Regs.TZSEL.bit.CBC2 = 1;
I would suggest not worrying about the RESET functionality yet. Just configure TZ1 (or whichever TZ you decide to use) and tie it high. Start PWM2 and watch the waveform, then tie TZ1 low. You should the PWMs be forced low until you tie TZ1 high again.
You have a lot of duplicate code for PWM2. You should be able to setup the Step functionality and then with very few lines of code just set the B channel to be inverted. No need to go through all of the TBPRD, TBCTL settings again, etc. This makes it a bit hard to follow. It should just be a bit in the AQ somewhere to invert the B output.
I would recommend playing with the epwm_trip_zone example in controlSUITE to get an idea of how this works (and seeing some example code). This will give you a better idea if this fits for your application before you throw too many hours at it.
Kris
I can see PWM2A andPWM2B low and high when I configure TZ, but at all instance of time. the example doesn't say how to configure or make use of trip zone if I want to correlate trip zone and a signal (step) at whichever time instance I want. Can you give an example or a code snippet that would be helpful?
So you are seeing the trip work as expected? In other words, when the TZ pin is low the PWM outputs are low?
If this is the case, then you just need to configure the PWM1 with some waveform and externally connect it to the TZ pin. If the trip isn't working then I'm not sure I understand what you are seeing. Can you send a waveform? I won't have a device to test any code on until sometime next week, but we should be able to get you up and running.
Actually I am in Sweden and its midnight here. My kit is at office. So canI send you the wave form and code on monday? Will that be ok?