Example MPC5744P eTimer DMA frequency measurement GHS614

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

Example MPC5744P eTimer DMA frequency measurement GHS614

No ratings

Example MPC5744P eTimer DMA frequency measurement GHS614

********************************************************************************

* Detailed Description:

*

* Example gives possible implementation of input signal period/freq measurement.

* eTimer channel capture 1 and 2 features are used. CAPT1/CAPT2 capture counter

* value on rising/falling edge of input signal. The FIFO is set to 2 entries

* and ICF2 is monitored. Free-running mode is used here.

*

* eTimer channel 0-1 are cascaded to achieve 1sec/1Hz measuring with 32bit counter.

*

* DMA is used to read CAPT1/2 registers and form 32bit values used in calculation.

*

* EVB connection:

*   P8.2  - A[1]  .. eTimer0 channel1 input signal

*   P8.1  - A[0]  .. GPIO output, used to show measurement period

*

*   Route LINFlexD_0 TXD/RXD (PB2/PB3) signals to the main board RS-232 transceiver

*   Daughtercard:

*   J17.11–12 ON  .. Connect LINFlexD_0 TXD (PB2) to main board.

*   J17.8–9 ON .. Connect LINFlexD_0 RXD (PB3) to main board.

*

*   Motherboard

*   J14 - SCI_RX ON

*   J13 - SCI_TX ON

*   J25 - SCI_PWR ON

*

* connect pulse signal to the P8.2.

* See results on PC terminal (19200, 8N1, None).

* Change freq/duty of input signal.

*

* ------------------------------------------------------------------------------

* Test HW:  MPC5744P

* Maskset:  1N65H

* Target :  internal_FLASH

* Fsys:     200 MHz PLL with 40 MHz crystal reference

* Terminal: 19200, 8N1, None

********************************************************************************

Labels (1)
Attachments
Comments
Pat

Hi Petr,

For example, If I change the PIT_0 period to 5ms faster than measured signal  (with USE_TERMINAL = 0), what kind of test should I do in order to call the Calculate() function only when I have new capture values to proceed ?

Best regards,

Pat

Hi Pat,

In this example the ICF2 flag of channel 0 is used as DMA trigger and so it is also cleared by DMA.

So you can use the same flag, ICF2, in channel 1 or you can configure the DMA ch1 to set interrupt flag after major loop finished.

BR, Petr

Pat

Hi Petr,

Does DMA write can occur during the Copy_edges() ? If yes, how it can be avoided ?

void Copy_edges(void)
{
  edge1 = edge5;
  edge2 = edge6;
  edge3 = edge7;
  edge4 = edge8

}
Best regards,
Pat
Version history
Last update:
‎04-14-2016 05:17 AM
Updated by: