Dec 11, 2020
08:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 11, 2020
08:38 AM
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
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
5 Replies
Dec 11, 2020
10:20 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 11, 2020
10:20 AM
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
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
Dec 11, 2020
11:24 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 11, 2020
11:24 AM
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
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
Dec 13, 2020
12:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 13, 2020
12:08 PM
Any ideas, anyone?
Dec 14, 2020
06:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 14, 2020
06:49 AM
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.
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.
Dec 14, 2020
01:38 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dec 14, 2020
01:38 PM
Thanks, that is indeed what I did, and it worked.
Regards,
Todd Anderson
Regards,
Todd Anderson