How to Measure a Signal with eTimer - Capture

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Measure a Signal with eTimer - Capture

3,027 Views
dumitru-daniel_
NXP Employee
NXP Employee

This example shows how you can configure the MPC5744 eTimer block to measure the period of a signal. In addition you should be aware that the eTimer hardware module design includes these distinctive features:
    • 6 x 16-bit counters/timers.
    • Count up or down.
    • Counters are cascadable.
    • Enhanced programmable up/down modulo counting.
    • Max count rate equals peripheral clock/2 for external clocks.
    • Max count rate equals peripheral clock for internal clocks.
    • Count once or repeatedly.
    • Counters are preloadable.
    • Compare registers are preloadable.
    • Counters can share available input pins.
    • Separate prescaler for each counter.
    • Each counter has capture and compare capability.
    • Continuous and single shot capture for enhanced speed measurement.
    • Counting start can be synchronized across counters.

 

The application is going to configure the FlexPWM module to generate a PWM signal that changes its frequency between 1000Hz and 10000Hz. The PWM output pins used are A10(J1.5) and A11(J1.7)

 

The eTimer modele is configured to read the input pin A0(J5.1) and measure its rising edges based on IPBus clock (160Mhz) and a 128 prescaller. 

 

HW Setup:

- MPC5744P DevKit

- Connect a wire between A10(J1.5) to A0(J5.1)

188663_188663.pngpastedImage_1.png

 

SW Setup:

- Model Based Design Toolbox for MPC5744P v2.0

- Simulink model attached

- Matlab 2015b or newer

- Freemaster 2.0 for data visualization

- Check this video for installation and configuration details

 

Verification:

- Build and Download the application to the MPC5744P microprocessor

188665_188665.pngpastedImage_9.png

- Open and connect the Freemaster project attached. You should see:

@10000Hz

188666_188666.pngpastedImage_10.png

@1000Hz

188667_188667.pngpastedImage_11.png

Original Attachment has been moved to: eTimer_measure.mot.zip

Original Attachment has been moved to: Etimer_PWM_measurement.pmp.zip

Original Attachment has been moved to: eTimer_measure.slx.zip

Labels (1)
2 Replies

1,553 Views
hjhjhj
Contributor IV

Hi Daniel,

     In your example ,I can't derectly find that  IPBus clock is 160Mhz .How can I calculate the IPBus clock?55.PNG

66.PNG

Thanks!

Hj

0 Kudos

1,552 Views
dumitru-daniel_
NXP Employee
NXP Employee

Hi @hjhjhj, 

The IPBus is the generic name used for peripheral configuration. The source of the clock for each peripheral might be different. In case of the ETimer the IPBus clock is the MOTC_CLK. Please refer to the MPC5744P Reference manual. T

pastedImage_1.png

The maximum frequency of MOTC_CLK is 160Mhz.

pastedImage_2.png

In the generated code, the clock setup is made in the mcu_init.c file.

Hope this helps!

Daniel