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.