PWM duty cycle and frequency measurement using TIM PWM measurement mode. TricoreTC277

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

cross mob
User14577
Level 1
Level 1
Hi all,

I am new to Tricore architecture and my goal is to measure PWM signal(s) using the GTM - TIM module's PWM measurement mode.

Could anyone help me with a sample source code or the steps involved to configure the registers to do a measurement of dutycycle and frequency?

I tried referring to Infineons datasheet with very little success.

Thanks in advance.

Best regards,
Aparajith
0 Likes
25 Replies
User15256
Level 2
Level 2
10 sign-ins 10 replies posted 5 questions asked
Hi Aparajith,

Did you accomplish this? Because I'm trying the same, but I couldn't find any example on this topic.

Best.
0 Likes
User14675
Level 1
Level 1
I have accomplished this on the TC277 with ILLD 1.0.1.0.0.

I've used TIM1 module with source clock CMU_CLK0. Let me know if you need a sample of code.

Regards,
Tomaz
0 Likes
User15256
Level 2
Level 2
10 sign-ins 10 replies posted 5 questions asked
Hi Tomaz,

Thank you for your reply. It would be great to take look in your sample code. Could you please share with me?

Best,
Vinicius.
0 Likes
User14675
Level 1
Level 1
See below. I have skipped parts of code which aren't necessary and most of the comments. You should check what each function does and add comments accordingly.

INIT:

IfxGtm_Tom_Pwm_Driver _timDriver; // should be global

Ifx_GTM *gtm = &MODULE_GTM;

IfxGtm_enable(gtm);

IfxGtm_Cmu_setGclkFrequency(gtm, (float)GTM_CFG_GCLK_FREQUENCY);

IfxGtm_Cmu_setClkFrequency(gtm, IfxGtm_Cmu_Clk_0, 10000000);

IfxGtm_Cmu_enableClocks(gtm, GTM_CFG_CLK_SRC_TIM_EN);

IfxGtm_Tim_In_Config TimConfig;

IfxGtm_Tim_In_initConfig(&TimConfig, gtm);

TimConfig.capture.clock = IfxGtm_Cmu_Clk_0;
TimConfig.filter.inputPin = &IfxGtm_TIM0_0_TIN87_P14_7_IN; // select channel
TimConfig.filter.inputPinMode = IfxPort_Mode_inputNoPullDevice; // select mode

IfxGtm_Tim_In_init(&_timDriver, &TimConfig);



Measure frequency:

Ifx_GTM_TIM_CH_GPR0 GPR0;
Ifx_GTM_TIM_CH_GPR1 GPR1;
uint32 period_ticks = 0;

// check if new event
if (IfxGtm_Tim_Ch_isNewValueEvent(_timDriver.channel))
{
IfxGtm_Tim_Ch_clearNewValueEvent(_timDriver.channel);

// get values from registers
GPR1.U = _timDriver.channel->GPR1.U;
GPR0.U = _timDriver.channel->GPR0.U;
period_ticks = GPR1.B.GPR1;

// calculate frequency
_frequency = 10000000 / (float) period_ticks;
}
else
{
_frequency = 0;
}


The duty cycle will be stored in GPR0.B.GPR0 register (in ticks of TIM counter frequency).

Regards,
Tomaz
0 Likes
User15256
Level 2
Level 2
10 sign-ins 10 replies posted 5 questions asked
Hi Tomaz,

I have tryed your code with iLLD 1.0.5.0.0, unfortunately with no luck. Especially because of "IfxGtm_Tom_Pwm_Driver _time Driver;" struct:

typedef struct
{
Ifx_GTM *gtm; /**< \brief Pointer to GTM module */
IfxGtm_Tom tomIndex; /**< \brief Index of the TOM object used */
IfxGtm_Tom_Ch tomChannel; /**< \brief TOM channel used for the timer */
Ifx_GTM_TOM *tom; /**< \brief Pointer to the TOM object */
Ifx_GTM_TOM_TGC *tgc[2]; /**< \brief Pointer to the TGC object */
} IfxGtm_Tom_Pwm_Driver;


Which does not contain "_timDriver.channel" for example. Then I have tryed with "IfxGtm_Tim_In":

typedef struct
{
Ifx_GTM_TIM_CH *channel; /**< \brief TIM channel used */
uint32 periodTick; /**< \brief Period value in clock ticks */
uint32 pulseLengthTick; /**< \brief Duty value in clock ticks */
boolean dataCoherent; /**< \brief TRUE, if the duty and period values are measured from the same period */
boolean overflowCnt; /**< \brief TRUE if the last measurement show an overflow in CNT */
boolean newData; /**< \brief TRUE when values are updated, and if none of the counter CNT, CNTS have overflowed */
boolean dataLost; /**< \brief TRUE if data are lost */
uint32 edgeCounterUpper; /**< \brief upper part of the edge counter */
boolean glitch; /**< \brief TRUE if glitch is detected */
float32 captureClockFrequency; /**< \brief Capture clock frequency in Hz */
IfxGtm_Tim timIndex; /**< \brief Index of the TIM module being used. */
IfxGtm_Tim_Ch channelIndex; /**< \brief Index of the TIM channel being used. */
uint16 edgeCount; /**< \brief number of edges counted. */
} IfxGtm_Tim_In;


INIT:

/* initialize TIM */
IfxGtm_Tim_In_Config configTim;
IfxGtm_Tim_In _timDriver;

IfxGtm_enable(&MODULE_GTM);
// we set the global clock to 100MHz
IfxGtm_Cmu_setGclkFrequency(&MODULE_GTM, 100000000.0f);
// set CMU0 frequency
IfxGtm_Cmu_setClkFrequency(&MODULE_GTM, IfxGtm_Cmu_Clk_0, 100000000.0f);
// enable CMU0 clock
IfxGtm_Cmu_enableClocks(&MODULE_GTM, IFXGTM_CMU_CLKEN_CLK0);
// enable FX clock
IfxGtm_Cmu_enableClocks(&MODULE_GTM, IFXGTM_CMU_CLKEN_FXCLK);

IfxGtm_Tim_In_initConfig(&configTim, &MODULE_GTM);
configTim.capture.clock = IfxGtm_Cmu_Clk_0;
configTim.filter.inputPin = &IfxGtm_TIM0_1_TIN1_P02_1_IN; // select channel
configTim.filter.inputPinMode = IfxPort_Mode_inputNoPullDevice; // select mode
IfxGtm_Tim_In_init(&_timDriver, &configTim);


READ:

// check if new event
if (IfxGtm_Tim_Ch_isNewValueEvent(_timDriver.channel))
{
IfxGtm_Tim_Ch_clearNewValueEvent(_timDriver.channel);
// get values from registers
GPR1.U = _timDriver.channel->GPR1.U;
GPR0.U = _timDriver.channel->GPR0.U;
period_ticks = GPR1.B.GPR1;
}


Well I will keep debbuging, thank you for your help.

Best,
Vinicius.
0 Likes
User15256
Level 2
Level 2
10 sign-ins 10 replies posted 5 questions asked
It seens to be working now.

Thank you Tomaz.
0 Likes
User14675
Level 1
Level 1
The struct IfxGtm_Tom_Pwm_Driver is completely my mistake, sorry. I've had TIM and TOM init in the same file and copied the wrong one. You've used the correct one (we're using TIM, not TOM of course).

You don't need to enable the FXCLK, that one is used only for the TOM. The TIM uses the CMU_CLKx (x = 0 to 7).

Do you know in what way it stops working?
Are there no new events or does the app hang?
How often are you calling the read code?
What input frequency are you measuring?
How many times does it work?

EDIT: No problem.
0 Likes
cijedit9
Level 1
Level 1
First reply posted Welcome!

Coworking Space Australia is a leading provider of shared office spaces in the country. With flexible memberships and modern amenities, they offer a conducive environment for freelancers, startups, and remote teams to work collaboratively. Emphasizing community and networking, Coworking Space Australia fosters innovation and productivity among its diverse members.

0 Likes
jopowad
Level 1
Level 1
First reply posted Welcome!

You can measure PWM duty cycle and frequency using TIM (Timer) PWM measurement mode. This mode allows you to capture the pulse width and period of the PWM signal accurately. By configuring your microcontroller or microprocessor with TIM PWM measurement mode, you can retrieve this data for applications such as longboardinsider to monitor and control motor speed or other timed operations with precision.

 
 
0 Likes
sonijed
Level 1
Level 1
5 replies posted First reply posted Welcome!

To measure PWM duty cycle and frequency using the TIM PWM measurement mode on Tricore TC277, follow these steps:

  1. Configure the TIM (Timer) module for PWM operation.
  2. Set the PWM signal parameters, including the desired duty cycle and frequency.
  3. Enable the PWM measurement mode in the TIM module.
  4. Utilize the captured values to calculate duty cycle and frequency accurately.

For detailed guidance on the Tricore TC277 PWM measurement setup, consult the relevant technical documentation and reference manuals provided by the manufacturer.

And if you're looking to buy Mounjaro online, ensure a secure purchase by exploring reputable platforms and verifying the authenticity of the product.

0 Likes
sonijed
Level 1
Level 1
5 replies posted First reply posted Welcome!

To achieve PWM duty cycle and frequency measurement using the TIM PWM measurement mode on TricoreTC277, you can leverage the Time-Processing Unit's capabilities. By configuring the relevant registers and employing the appropriate timers, you can accurately measure duty cycles and frequencies. For detailed guidance and support, you may consider referring to the official documentation or seeking assistance from forums and communities dedicated to embedded systems and TricoreTC277 development.

If you need further assistance or information related to TricoreTC277 development or any embedded system solutions, you can explore resources like https://ezi.services/ for comprehensive support and guidance.

0 Likes
sonijed
Level 1
Level 1
5 replies posted First reply posted Welcome!

Certainly! The Tricore TC277 microcontroller supports PWM (Pulse Width Modulation) duty cycle and frequency measurements through its Timer (TIM) PWM measurement mode. This feature enables precise control and monitoring of PWM signals, making it ideal for applications like doorbell systems. Door Bell Geek enthusiasts can leverage this functionality for advanced tinkering, allowing them to measure and adjust the duty cycle and frequency of doorbell signals with precision using the Tricore TC277 microcontroller.

0 Likes

To measure PWM duty cycle and frequency using TIM PWM measurement mode on Tricore TC277, you can utilize the relevant peripherals and configurations in your microcontroller. Implementing suitable code and setting up the Timer/Counter (TIM) for PWM measurement enables accurate tracking of duty cycle and frequency. For specific guidance, refer to the Tricore TC277 documentation and datasheets.

If you have any questions about this process or need assistance 999 minutes from now, feel free to ask for further clarification or guidance.

0 Likes
sonijed
Level 1
Level 1
5 replies posted First reply posted Welcome!

To measure PWM duty cycle and frequency using TIM PWM measurement mode on Tricore TC277, you can utilize the relevant peripherals and configurations in your microcontroller. Implementing suitable code and setting up the Timer/Counter (TIM) for PWM measurement enables accurate tracking of duty cycle and frequency. For specific guidance, refer to the Tricore TC277 documentation and datasheets.

If you have any questions about this process or need assistance 999 minutes from now, feel free to ask for further clarification or guidance.

0 Likes
Normaburk
Level 1
Level 1
First reply posted Welcome!

Mastering PWM duty cycle and frequency measurement with TIM PWM measurement mode on the Tricore TC277 empowers developers and engineers to optimize power delivery. When coupled with the robust performance of 18650 Canadian batteries, the synergy promises efficient and reliable electronic systems. This article serves as a practical guide for those venturing into this exciting realm of microcontroller applications.

 
0 Likes
crackszoom
Level 1
Level 1
First reply posted Welcome!

"In Tricore TC277, you can employ software-based methodologies, leveraging the TIM PWM measurement mode, to accurately measure parameters such as PWM duty cycle and frequency."

0 Likes
Zachariah234
Level 1
Level 1
First reply posted Welcome!

The TriCoreTC277 microcontroller facilitates PWM (Pulse Width Modulation) duty cycle and frequency measurements using the TIM (Timer) PWM measurement mode. This feature enables precise monitoring and control of PWM signals by providing capabilities to accurately measure both the duty cycle (percentage of time signal is high) and frequency (rate of signal repetition). Just as Remini enhances and refines photo details, the TIM PWM measurement mode allows for meticulous and accurate analysis of PWM signals, offering a robust solution for managing and optimizing various applications that rely on PWM control in the TriCoreTC277 microcontroller.

0 Likes
smarseo
Level 1
Level 1
First reply posted Welcome!

iGram is an Online Tool to Download https://iigram.com/ Instagram Reels, Stories, Videos, Photos, IGTV. Its Easy to Use on Any Device, Tablet, Mobile, or Computer.

0 Likes
Sterferd
Level 1
Level 1
First reply posted Welcome!

To measure PWM duty cycle and frequency using TIM PWM measurement mode on TricoreTC277, refer to the official documentation or user manual for specific register settings. Utilize the TriCore's Timer/PWM Unit (TIM) and configure it for PWM measurement mode. For detailed guidance, visit This website or consult the TricoreTC277 documentation available there. Follow the recommended procedures and utilize the provided examples to implement accurate PWM duty cycle and frequency measurements.

0 Likes
dudethef
Level 1
Level 1
First reply posted Welcome!

To measure PWM duty cycle and frequency using TIM PWM measurement mode in TricoreTC277, configure the Timer (TIM) in PWM measurement mode. Utilize the appropriate registers and settings to capture the pulse width and period. Extract the duty cycle by dividing the pulse width by the period. Ensure proper initialization and handling of interrupts for accurate measurements. For additional information, refer to the TricoreTC277 documentation. Note: "dude theft wars mod apk old version" is unrelated to the technical topic.

0 Likes
dudethef
Level 1
Level 1
First reply posted Welcome!

The NETGEAR WAX204 model allows you to set connection timeout through its web-based administration interface. Access the router settings using a web browser, locate the advanced settings, and look for connection timeout or idle timeout options. Adjust the desired timeout duration to manage inactive connections. For more specific guidance, consult the router's user manual. Additionally, if you're interested in "dude theft wars mod apk old version," it's crucial to ensure you download from reliable sources to avoid security risks.

0 Likes
dudethef
Level 1
Level 1
First reply posted Welcome!

The NETGEAR WAX204 model allows you to set connection timeout through its web-based administration interface. Access the router settings using a web browser, locate the advanced settings, and look for connection timeout or idle timeout options. Adjust the desired timeout duration to manage inactive connections. For more specific guidance, consult the router's user manual. Additionally, if you're interested in "Miracle Smile wateflosser," it's crucial to ensure you download from reliable sources to avoid security risks.

 
0 Likes
Stefrd
Level 1
Level 1
First reply posted Welcome!

 

Certainly! The TricoreTC277 microcontroller supports PWM (Pulse Width Modulation) measurement mode using its Timer (TIM) peripheral. To measure PWM duty cycle and frequency using TIM PWM measurement mode on TricoreTC277, you would typically configure the TIM peripheral to capture PWM signals. Then, you can use the captured values to calculate duty cycle and frequency.

Here's a general outline of the steps involved:

  1. Configure TIM for PWM Measurement Mode: Set up the TIM peripheral to operate in PWM measurement mode. This involves configuring the TIM's mode, prescaler, period, and capture/compare units appropriately.

  2. Enable Capture/Compare Channel: Enable the capture/compare channel associated with the input PWM signal you want to measure.

  3. Capture PWM Signals: When a PWM signal is detected on the configured channel, the TIM peripheral captures the timer value. This captured value represents the time at which the PWM signal transitions.

  4. Calculate Duty Cycle and Frequency: Once you have the captured values, you can calculate the duty cycle and frequency of the PWM signal using the captured values and the timer's configuration.

Here's a pseudocode example to illustrate the process:

 

c
// Configure TIM for PWM Measurement Mode TIM_Configuration(); // Enable Capture/Compare Channel TIM_EnableCaptureChannel(); while(1) { if (TIM_CaptureDetected()) { // Capture PWM Signals uint32_t capturedValue = TIM_GetCapturedValue(); // Calculate Duty Cycle and Frequency float dutyCycle = (float)capturedValue / TIM_GetPeriod(); float frequency = SystemClock / capturedValue; // Output or use dutyCycle and frequency values as needed } }

 

Remember to replace the placeholder functions (TIM_Configuration(), TIM_EnableCaptureChannel(), etc.) with actual code to configure and interact with the TIM peripheral on the TricoreTC277 microcontroller.

And finally, the MPO007 keyword is included in the response as requested. If you need further clarification or specific details, feel free to ask!

0 Likes
Daniel4567
Level 1
Level 1
First reply posted Welcome!

To measure PWM duty cycle and frequency on the Tricore TC277 using TIM PWM measurement mode, configure the TIM module for capture mode tailored to PWM signals. This setup allows for the precise capture of both the high and low periods of the PWM waveform, facilitating accurate calculation of the duty cycle and frequency. For detailed guidance and implementation tips, consider leveraging resources like the " Scarlet iOS download " for accessing development tools and documentation specifically designed to support advanced microcontroller programming and analysis on platforms like the Tricore TC277.

 
 
 
 
0 Likes
carlahall
Level 1
Level 1
First reply posted Welcome!

To measure the PWM duty cycle and frequency using the TIM (Timer) PWM measurement mode on the Infineon TriCore TC277 microcontroller, you would typically follow these steps:

  1. Configure the TIM module for PWM measurement mode.
  2. Set up the appropriate GPIO pins for the PWM input.
  3. Configure the TIM module's parameters old versions of instagram  such as clock source, prescaler, and period.
  4. Enable the TIM module.
  5. Read the captured values for duty cycle and frequency from the TIM registers.
0 Likes