TC275 Lite Kit - GTM example question

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

cross mob
User20622
Level 2
Level 2
5 replies posted First solution authored First reply posted
All:
Using ADS, I have created GTM_TIM_CAPTURE_1 _KIT_TC275_LK from GTM_TIM_CAPTURE_1 _KIT_TC297_TFT, and successfully seen the PWM waveform results.
I was able to use P00.2 as TINT and P00.3 as TOUT.


Question: how hard is it to expand the capture to 2 TIMs?

I want to keep P00.2 as TINT and P00.3 as TOUT, and add P00, and add P00.9 as a TINT and P00.10 as TOUT.

Can I take existing code and add second calls to configure second pin? (OR is it more difficult than that?)

IfxGtm_Tim_In_initConfig(&configTIM, &MODULE_GTM); /* Initialize default parameters */

/* Existing code */
configTIM.filter.inputPin = &PWM_IN1; /* Select input port pin */
configTIM.filter.inputPinMode = IfxPort_InputMode_pullDown; /* Select input port pin mode */
IfxGtm_Tim_In_init(&g_driverTIM, &configTIM); /* Initialize the TIM */

/* Configuring 2nd input */
configTIM.filter.inputPin = &PWM_IN2; /* Select input port pin */
configTIM.filter.inputPinMode = IfxPort_InputMode_pullDown; /* Select input port pin mode */
IfxGtm_Tim_In_init(&g_driverTIM, &configTIM); /* Initialize the TIM */

Regards,
Todd Anderson
0 Likes
5 Replies
User20622
Level 2
Level 2
5 replies posted First solution authored First reply posted
All:
I did some further exploration, used only 1 PWM to drive both inputs.

In the measure_PWM(), made the following changes:

void measure_PWM(void)
{
IfxGtm_Tim_In_Config configTIM; // Added configTIM

configTIM.filter.inputPin = &PWM_IN1; // Point at first input

IfxGtm_Tim_In_update(&g_driverTIM); /* Update the measured data */
g_measuredPwmPeriod = IfxGtm_Tim_In_getPeriodSecond(&g_driverTIM); /* Get the period of the PWM signal */
g_measuredPwmFreq_Hz = 1 / g_measuredPwmPeriod; /* Calculate the frequency */
g_measuredPwmDutyCycle = IfxGtm_Tim_In_getDutyPercent(&g_driverTIM, &g_dataCoherent); /* Get the duty cycle */

configTIM.filter.inputPin = &PWM_IN2; // Point at second input

IfxGtm_Tim_In_update(&g_driverTIM); /* Update the measured data */
g_measuredPwmPeriod = IfxGtm_Tim_In_getPeriodSecond(&g_driverTIM); /* Get the period of the PWM signal */
g_measuredPwmFreq_Hz = 1 / g_measuredPwmPeriod; /* Calculate the frequency */
g_measuredPwmDutyCycle = IfxGtm_Tim_In_getDutyPercent(&g_driverTIM, &g_dataCoherent); /* Get the duty cycle */

}

I single step thru the code to get results, which are the same for both measurements. (I know, I can create a second set of variables to hold second input results.)

So, it does look like you can set up a second TIM by calling the same setup functions as the first.

I will also set up a second PWM with different frequency to further delineate this...

Regards,
Todd Anderson
0 Likes
User20622
Level 2
Level 2
5 replies posted First solution authored First reply posted
All:
I think something further must be done for measure_PWM(). Right now I am always seeing 2nd PWM results, so I am not sure that adding .inputPin prior to the Update does what I want...

Regards,
Todd Anderson
0 Likes
User20622
Level 2
Level 2
5 replies posted First solution authored First reply posted
Any ideas, anyone?
0 Likes
User20639
Level 3
Level 3
First solution authored 10 replies posted 5 replies posted
Well, if I understand correctly, you think that adding

configTIM.filter.inputPin = &PWM_IN2;

is enough.

It isn't. You would have to re-run the init function IfxGtm_Tim_In_init(&g_driverTIM, &configTIM); to update your g_driverTIM structure.

Just create an independent set of structures for each channel and it will work fine.
0 Likes
User20622
Level 2
Level 2
5 replies posted First solution authored First reply posted
Thanks, that is indeed what I did, and it worked.

Regards,
Todd Anderson
0 Likes