This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Tool/software: Code Composer Studio
Hello all,
i want to capture the frequency of an input sine to synchronize an output frequency.
Therefore i use the CMPSS Module to catch the frequency. I used the follwing Moduls like described:
At CMPIN1P i insert the input Sinewave. DACHVALS is set to the half of the Vpp of the input sinewave. The result of the comparator sets the output CTRIPH asynchronus.
The signal CTRIPH goes through ePWM X-Bar to the PWM-Module.
The signal goes through TRIPIN4 to EVENT A QUAL to the Event Filtering.
There i want to capture the time between 2 Edges with the CNTVAL. This value shall be copied to TBPRD register. I tried to show the issue in an Timing Diagramm:
Until DCAEVT1 everything works like i expected. The DCAEVT1 lasts for 10ms (half sine period of input sine 20ms). I want to count the time when DCAEVT1 is one to synchronize the output PWM with the input frequency. The PWM module uses upcount_downcount_mode.
I tried to catch this time with the Edge Capture Logic. With the SW Trigger i should be able to start the measurement with the next Edge of DCAEVT. Then the counter starts to count until the next Edge. When i read the Register VCNTVAL it is zero. So it was not successfull.
My TBCLK is configured to 200 MHz. That means the counter increases the value every 5 ns. With an increasing time of 10ms (DCAEVT1) the countervalue will be 2000000. But the Timer is only 16-bit (65535 is maximum). When i change the TBCLK to a lower frequency i lose precision in generating the output PWM.
Sorry for the bad description i hope there is any solution for this problem?
Best regards,
Martin
Hi Frank,
i routed the signal over OUTPUTXBAR5 to GPIO7 and read it back over the InputXbarRegs.INPUT7SELECT = 7 as you explained.
I first tried to measure the frequency in continous mode like in Example 3 chapter 16.6.3 of the Technical Reference Manual. But the measuring result was not usable. It was really randomly.
With the help of the example "ECap_Capture_Pwm_cpu01" of C2000Ware is got a useful result with a good resolution in oneshot Mode. Now i am able to synchronize my ouput PWM frequency with the input frequency.
Thanks for the help :)
Martin