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

AURIX™ Forum Discussions

chadpham75
Level 1
10 sign-ins 5 questions asked 5 replies posted
Level 1

Hi all,

I went thru the example and verify the signal and varying different frequencies and it is work perfectly fine for my eval TC37x board

I then tried to change the input pin to #define PWM_IN IfxGtm_TIM1_1_P02_1_IN with the expectation if I changed the CMU_CLKEN_CLK1, I will get the same result

IfxGtm_Cmu_enableClocks(&MODULE_GTM, IFXGTM_CMU_CLKEN_CLK1); /* Enable the CMU clock 1 */

But my g_measuredPwmFreq_Hz = +Inf

and g_measuredPwmDutyCycle = NaN

The data sheet calls out the CMU_CLK0, CMU_CLK1, CMU_CLK6, CMU_CLK7 are used for the TIM filters counters.

What did I do wrong or assume changing the input pin to TIM1 and enable the CLK1 will not work in this case?

 

0 Likes
1 Solution
Nambi
Moderator
Moderator 100 replies posted 10 likes received 25 solutions authored
Moderator

Hi,

In the example, inside the function IfxGtm_Tim_In_initConfig(), the configuration is for TIM0 CH0

config->timIndex = IfxGtm_Tim_0;
config->channelIndex = IfxGtm_Tim_Ch_0;

IfxGtm_TIM1_1_P02_1_IN corresponds to TIM1 CH1. This is a conflict. Can you check?

Best Regards,
Nambi.

View solution in original post

0 Likes
4 Replies
Nambi
Moderator
Moderator 100 replies posted 10 likes received 25 solutions authored
Moderator

Hi,

In the example, inside the function IfxGtm_Tim_In_initConfig(), the configuration is for TIM0 CH0

config->timIndex = IfxGtm_Tim_0;
config->channelIndex = IfxGtm_Tim_Ch_0;

IfxGtm_TIM1_1_P02_1_IN corresponds to TIM1 CH1. This is a conflict. Can you check?

Best Regards,
Nambi.

0 Likes
chadpham75
Level 1
10 sign-ins 5 questions asked 5 replies posted
Level 1

Hi Nambi,

Thank you for pointing out my mistake

After changing to 

config->timIndex = IfxGtm_Tim_1;
config->channelIndex = IfxGtm_Tim_Ch_1;

The result is not there yet

I also need to change

config->capture.clock = IfxGtm_Cmu_Clk_1;

In order to get the Frequency and Duty Cycle correct show in the debug.

However, is this a coincident or the capture module actually don't care about the timeout and filter's clock because I purposely tested by left the unchanged such as

config->timeout.clock = IfxGtm_Cmu_Clk_0;

config->filter.clock = IfxGtm_Cmu_Tim_Filter_Clk_0;

And I still get the good results?

0 Likes
chadpham75
Level 1
10 sign-ins 5 questions asked 5 replies posted
Level 1

Hi Nambi,

Continue to explore this project.

I now want to see if I am able to capture the slower frequency like in 1 to 2 Hz.

I changed the TOM to tomConfig.clock = IfxGtm_Tom_Ch_ClkSrc_cmuFxclk4; 

and #define PWM_PERIOD 872 /* PWM signal period for the TOM */

I verified on the scope the Frequency out put from the TOM is 1.75Hz

But my g_measuredPwmFreq_Hz = 14.67191

and g_measuredPwmDutyCycle = 173.07

chadpham75_0-1658959860326.png

Is this the problem with capture clock either CMU_CLK0 or CMU_CLK1 that too fast for the lower frequency capture?

 

0 Likes
chadpham75
Level 1
10 sign-ins 5 questions asked 5 replies posted
Level 1

Hi Nambi,

Please disregard the question since I solved the issue.

For anyone try the same exercise, as my guessing I tried to slow down the clock for TIM to 1MHz with the setting new frequency and I got the capture work correctly to capture 1.7Hz range

 

#define CMU_FREQ 1000000.0f /* CMU clock frequency */

IfxGtm_enable(&MODULE_GTM); /* Enable the GTM */
IfxGtm_Cmu_setClkFrequency(&MODULE_GTM, IfxGtm_Cmu_Clk_0, CMU_FREQ); /* Set the clock frequency */
IfxGtm_Cmu_enableClocks(&MODULE_GTM, IFXGTM_CMU_CLKEN_CLK0); /* Enable the CMU clock 0 */

0 Likes