- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I am trying to generate a PWM via GTM TOM Module. I need the PWM at higher Frequencies say around 200KHz. However while going more than 2KHz the frequency is achieved but it's not consistent. PWM is randomly turning off for a particular period of time. This behavior is not periodic, hence not predictable. For example in below screenshot I am trying to achieve 20KHz, but there is a certain of time in between
Please let me know if GTM TOM is a correct method to achieve PWM of higher frequencies or am I doing some mistake in code. I have taken below example code and modified.
In case there is a place where I can find calculations for Period Vs Frequency, limitations wrt achievable frequency etc Please let me know.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
1. I made the following changes to the project and tested it.
i) #define PWM_PERIOD 5000 // 20KHz frequency
ii)#define LED IfxGtm_TOM2_6N_TOUT86_P14_6_OUT // Changed the pin to be able to monitor it on the connector in the TFT kit
iii) Added "g_tomConfig.dutyCycle = PWM_PERIOD/2; // 50% duty cycle"
after "g_tomConfig.synchronousUpdateEnabled = TRUE;"
iv) Commented fadeLED();
I checked several sections of this waveform by zooming in. I observe the waveform to be proper. I have attached it with this comment.
GTM ATOM can generate PWM properly for high frequencies also.
2. I think your observation is either a limitation of the Oscilloscope sampling frequency at your end or an optical illusion.
3. You can also check if the pin you are testing is connected to any other component affecting it.
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can find the details about the example you chose in the link below.
In this example, the duty cycle keeps varying using the fadeLED() function. It is possible that you are observing the effect of this at your end.
You can test by commenting on the fadeLED() function to check the behavior with a constant duty cycle.
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Nambi,
Actually, I commented and gave fixed 50% duty cycle. Still the PWMs are only ON for 15 ms and OFF for 15 ms. Somehow the PWMs at higher frequency generated are corrected but only ON for some time and other time they are OFF.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
1. I made the following changes to the project and tested it.
i) #define PWM_PERIOD 5000 // 20KHz frequency
ii)#define LED IfxGtm_TOM2_6N_TOUT86_P14_6_OUT // Changed the pin to be able to monitor it on the connector in the TFT kit
iii) Added "g_tomConfig.dutyCycle = PWM_PERIOD/2; // 50% duty cycle"
after "g_tomConfig.synchronousUpdateEnabled = TRUE;"
iv) Commented fadeLED();
I checked several sections of this waveform by zooming in. I observe the waveform to be proper. I have attached it with this comment.
GTM ATOM can generate PWM properly for high frequencies also.
2. I think your observation is either a limitation of the Oscilloscope sampling frequency at your end or an optical illusion.
3. You can also check if the pin you are testing is connected to any other component affecting it.
Best Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
99% is a problem with the oscilloscope sampling.