eTPU Accumulator implementation for MPC5777C

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

eTPU Accumulator implementation for MPC5777C

487 Views
roopeshrk
Junior Contributor I

This is with reference to implementation of a pulse counting algorithm using eTPU of MPC5777C. Our aim is to read the square pulses mutiple times in a 5 ms window and then output the average of the pulse count at the end of the 5ms window. Clarity is sought in how to configure a time scale less than 5ms and incorporate that measurement in a larger 5ms window.

 

The specs of our project is as follows:

Core Clock: 32 MHz

TCR1 Clock: 4MHz

Frequency Signals to be measured : 100 -200 uSec

 

In order to read the frequency inputs the eTPU channel is configured with TCR1 clock and the pulses are read using the "fs_etpu_ppa_get_accumulation" API call available in the "etpu_ppa,h".

 

The PPA is initialized using the "fs_etpu_ppa_init" API as mentioned below (as per our requirement for maximum count) .However whenever we try modifying the "max_count" or "sample_time" the final output pulse count is not getting updated when obtained through "fs_etpu_ppa_get_accumulation".

 

Further, we were unable to find documentation explaining the significance of the "sample_time" parameter. Is it the window wherein the samples would be accumulated or the instances when sensing or accumulation occurs.

Either way what should be the values in case our requirement is to have 5 samples in a 5ms window.

 

<PPA initialization code>

 

fs_etpu_ppa_init(PPA0+i, //channel

FS_ETPU_PRIORITY_HIGH, //priority

FS_ETPU_PPA_INIT_TCR1, //timebase

FS_ETPU_PPA_RISING_EDGE, //mode

760, // max-count --"Parameter modified for our requirement"

0x100000); //sample_time - "clarity required for value of sample time"

 

We also tried using "fs_etpu_ppa_get_immediate" to get pulse count and period but these output variables are always set to zer0.

 

Request you to clarify the above issue.

0 Kudos
Reply
0 Replies
%3CLINGO-SUB%20id%3D%22lingo-sub-2302749%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EeTPU%20Accumulator%20implementation%20for%20MPC5777C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2302749%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EThis%20is%20with%20reference%20to%20implementation%20of%20a%20pulse%20counting%20algorithm%20using%20eTPU%20of%20MPC5777C.%20Our%20aim%20is%20to%20read%20the%20square%20pulses%20mutiple%20times%20in%20a%205%20ms%20window%20and%20then%20output%20the%20average%20of%20the%20pulse%20count%20at%20the%20end%20of%20the%205ms%20window.%20Clarity%20is%20sought%20in%20how%20to%20configure%20a%20time%20scale%20less%20than%205ms%20and%20incorporate%20that%20measurement%20in%20a%20larger%205ms%20window.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20specs%20of%20our%20project%20is%20as%20follows%3A%3C%2FP%3E%3CP%3ECore%20Clock%3A%2032%20MHz%3C%2FP%3E%3CP%3ETCR1%20Clock%3A%204MHz%3C%2FP%3E%3CP%3EFrequency%20Signals%20to%20be%20measured%20%3A%20100%20-200%20uSec%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EIn%20order%20to%20read%20the%20frequency%20inputs%20the%20eTPU%20channel%20is%20configured%20with%20TCR1%20clock%20and%20the%20pulses%20are%20read%20using%20the%20%22fs_etpu_ppa_get_accumulation%22%20API%20call%20available%20in%20the%20%22etpu_ppa%2Ch%22.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EThe%20PPA%20is%20initialized%20using%20the%20%22fs_etpu_ppa_init%22%20API%20as%20mentioned%20below%20(as%20per%20our%20requirement%20for%20maximum%20count)%20.However%20whenever%20we%20try%20modifying%20the%20%22max_count%22%20or%20%22sample_time%22%20the%20final%20output%20pulse%20count%20is%20not%20getting%20updated%20when%20obtained%20through%20%22fs_etpu_ppa_get_accumulation%22.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EFurther%2C%20we%20were%20unable%20to%20find%20documentation%20explaining%20the%20significance%20of%20the%20%22sample_time%22%20parameter.%20Is%20it%20the%20window%20wherein%20the%20samples%20would%20be%20accumulated%20or%20the%20instances%20when%20sensing%20or%20accumulation%20occurs.%3C%2FP%3E%3CP%3EEither%20way%20what%20should%20be%20the%20values%20in%20case%20our%20requirement%20is%20to%20have%205%20samples%20in%20a%205ms%20window.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CPPA%20initialization%3D%22%22%20code%3D%22%22%3E%3C%2FPPA%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3Efs_etpu_ppa_init(PPA0%2Bi%2C%20%2F%2Fchannel%3C%2FP%3E%3CP%3EFS_ETPU_PRIORITY_HIGH%2C%20%2F%2Fpriority%3C%2FP%3E%3CP%3EFS_ETPU_PPA_INIT_TCR1%2C%20%2F%2Ftimebase%3C%2FP%3E%3CP%3EFS_ETPU_PPA_RISING_EDGE%2C%20%2F%2Fmode%3C%2FP%3E%3CP%3E760%2C%20%2F%2F%20max-count%20--%22Parameter%20modified%20for%20our%20requirement%22%3C%2FP%3E%3CP%3E0x100000)%3B%20%2F%2Fsample_time%20-%20%22clarity%20required%20for%20value%20of%20sample%20time%22%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EWe%20also%20tried%20using%20%22fs_etpu_ppa_get_immediate%22%20to%20get%20pulse%20count%20and%20period%20but%20these%20output%20variables%20are%20always%20set%20to%20zer0.%3C%2FP%3E%3CBR%20%2F%3E%3CP%3ERequest%20you%20to%20clarify%20the%20above%20issue.%3C%2FP%3E%3C%2FLINGO-BODY%3E