eTPU Accumulator implementation for MPC5777C

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

eTPU Accumulator implementation for MPC5777C

438 次查看
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 项奖励
回复
0 回复数
%3CLINGO-SUB%20id%3D%22lingo-sub-2302749%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%E4%B8%BA%20MPC5777C%20%E5%AE%9E%E7%8E%B0%20eTPU%20%E7%B4%AF%E5%8A%A0%E5%99%A8%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2302749%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E8%BF%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6%B5%8B%E9%87%8F%E9%A2%91%E7%8E%87%E4%BF%A1%E5%8F%B7%EF%BC%9A100%20-200%20uSec%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E4%B8%BA%E4%BA%86%E8%AF%BB%E5%8F%96%E9%A2%91%E7%8E%87%E8%BE%93%E5%85%A5%EF%BC%8CeTPU%20%E9%80%9A%E9%81%93%E9%85%8D%E7%BD%AE%E4%BA%86%20TCR1%20%E6%97%B6%E9%92%9F%EF%BC%8C%E8%84%89%E5%86%B2%E6%98%AF%E4%BD%BF%E7%94%A8%20%22%20etpu_ppa%E3%80%81h%20%22%20%E4%B8%AD%E6%8F%90%E4%BE%9B%E7%9A%84%20%22%20fs_etpu_ppa_get_accedulative%20%22%20API%20%E8%B0%83%E7%94%A8%E8%AF%BB%E5%8F%96%E8%84%89%E5%86%B2%E7%9A%84%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CP%3EPPA%20%E4%BD%BF%E7%94%A8%20%22%20fs_etpu_ppa_init%20%22%20API%20%E8%BF%9B%E8%A1%8C%E5%88%9D%E5%A7%8B%E5%8C%96%EF%BC%8C%E5%A6%82%E4%B8%8B%E6%89%80%E8%BF%B0%EF%BC%88%E6%A0%B9%E6%8D%AE%E6%88%91%E4%BB%AC%E5%AF%B9%E6%9C%80%E5%A4%A7%E8%AE%A1%E6%95%B0%E7%9A%84%E8%A6%81%E6%B1%82%EF%BC%89%E3%80%82%E4%BD%86%E6%98%AF%EF%BC%8C%E6%AF%8F%E5%BD%93%E6%88%91%E4%BB%AC%E5%B0%9D%E8%AF%95%E4%BF%AE%E6%94%B9%20%22%20max_count%20%22%20%E6%88%96%20%22%20sample_time%20%22%20%E9%80%9A%E8%BF%87%20%22%20fs_etpu_ppa_get_accedulation%20%E8%8E%B7%E5%BE%97%E7%9A%84%E6%9C%80%E7%BB%88%E8%BE%93%E5%87%BA%E8%84%89%E5%86%B2%E8%AE%A1%E6%95%B0%E6%97%B6%EF%BC%8C%E4%B8%8D%E4%BC%9A%E6%9B%B4%E6%96%B0%22%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%AD%A4%E5%A4%96%EF%BC%8C%E6%88%91%E4%BB%AC%E6%97%A0%E6%B3%95%E6%89%BE%E5%88%B0%E8%A7%A3%E9%87%8A%22sample_time%22%20%E5%8F%82%E6%95%B0%E6%84%8F%E4%B9%89%E7%9A%84%E6%96%87%E6%A1%A3%E3%80%82%E6%98%AF%E7%B4%AF%E7%A7%AF%E6%A0%B7%E6%9C%AC%E7%9A%84%E7%AA%97%E5%8F%A3%EF%BC%8C%E8%BF%98%E6%98%AF%E5%8F%91%E7%94%9F%E6%84%9F%E5%BA%94%E6%88%96%E7%B4%AF%E7%A7%AF%E7%9A%84%E5%AE%9E%E4%BE%8B%E3%80%82%3C%2FP%3E%3CP%3E%E5%A6%82%E6%9E%9C%E6%88%91%E4%BB%AC%E7%9A%84%E8%A6%81%E6%B1%82%E6%98%AF%E5%9C%A8%205%20%E6%AF%AB%E7%A7%92%E7%9A%84%E7%AA%97%E5%8F%A3%E5%86%85%E9%87%87%E9%9B%86%205%20%E4%B8%AA%E9%87%87%E6%A0%B7%E7%82%B9%EF%BC%8C%E9%87%87%E6%A0%B7%E5%80%BC%E5%BA%94%E8%AF%A5%E6%98%AF%E5%A4%9A%E5%B0%91%EF%BC%9F%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%EF%BC%88PPA0%2Bi%EF%BC%8C%2F%2F%E9%80%9A%E9%81%93%3C%2FP%3E%3CP%3EFS_ETPU_PRIORITY_HIGH%2C%20%2F%2F%E4%BC%98%E5%85%88%E7%BA%A7%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--%22%E6%A0%B9%E6%8D%AE%E6%88%91%E4%BB%AC%E7%9A%84%E8%A6%81%E6%B1%82%E4%BF%AE%E6%94%B9%E7%9A%84%E5%8F%82%E6%95%B0%22%3C%2FP%3E%3CP%3E0x100000)%3B%20%2F%2Fsample_time%20-%22%E9%87%87%E6%A0%B7%E6%97%B6%E9%97%B4%E5%80%BC%E6%89%80%E9%9C%80%E7%9A%84%E6%B8%85%E6%99%B0%E5%BA%A6%22%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E6%88%91%E4%BB%AC%E8%BF%98%E5%B0%9D%E8%AF%95%E4%BD%BF%E7%94%A8%20%22%20fs_etpu_ppa_get_immediate%20%22%20%E6%9D%A5%E8%8E%B7%E5%8F%96%E8%84%89%E5%86%B2%E8%AE%A1%E6%95%B0%E5%92%8C%E5%91%A8%E6%9C%9F%EF%BC%8C%E4%BD%86%E8%BF%99%E4%BA%9B%E8%BE%93%E5%87%BA%E5%8F%98%E9%87%8F%E5%A7%8B%E7%BB%88%E8%AE%BE%E7%BD%AE%E4%B8%BA%E9%9B%B6%200%E3%80%82%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%E8%AF%B7%E6%82%A8%E6%BE%84%E6%B8%85%E4%B8%8A%E8%BF%B0%E9%97%AE%E9%A2%98%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E