EMIOS_IC -- Period Measurement Mode

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

EMIOS_IC -- Period Measurement Mode

Jump to solution
1,444 Views
PaddyChan
Contributor III

Hi,

I'm trying to use EMIOS IC period measurement mode on MPC5748G to get the pulse frequency of the signal generated by the waveform generator.

We were able to successfully measure the corresponding frequencies in the range of 1.4kHz-70kHz, but as soon as the signal frequency drops below 1.4kHz, problems arise. The hexadecimal representation of 1400 is 578, as shown in the yellow highlighted part of the PCAN-View screenshot. When the signal frequency drops below 1.4kHz, the values read by PCAN are completely incorrect. The second attached image shows that when the frequency is 1300Hz, PCAN reads CBB7 which corresponds to 52151Hz, which is clearly incorrect.

We hope to be able to accurately measure in the range of 0~3.5kHz.
Is there any way to achieve this?
And what could be the cause of the issue?
Additionally, the pin configuration for the Input is also shown in Figure 3.

Best regards
Paddy

1.4kHz.png

1.3kHz.png

pin.png

   

Tags (1)
0 Kudos
Reply
1 Solution
1,364 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you would need to increase prescaler for counter bus A. There are global prescaler and internal one for a channel using internal counter. So go to referenced component emios_mc and set it accordingly

 

PetrS_1-1679903388064.png

Finally assume clock dividers in period calculation.

BR, Petr

 

View solution in original post

6 Replies
1,406 Views
PaddyChan
Contributor III

I found that the 1.4KHz limit is caused by the count of 60,000 and the sampling frequency of emios_clk at 80MHz.
I would like to ask if there is a way to lower the sampling frequency to below 65KHz so that I can receive signals from 1Hz to 3.5KHz.

1,365 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you would need to increase prescaler for counter bus A. There are global prescaler and internal one for a channel using internal counter. So go to referenced component emios_mc and set it accordingly

 

PetrS_1-1679903388064.png

Finally assume clock dividers in period calculation.

BR, Petr

 

1,360 Views
PaddyChan
Contributor III

Hi Petr,

Thank you very much.
After we set the count to 65000, clock divide to 256, and prescaler to 10, we were able to measure frequencies from 0.3125Hz to almost 10KHz.
However, we also encountered a problem. In Period Measure Mode, four identical periods are needed to accurately calculate the frequency. We found that when the frequency is low (1Hz), it takes some time to calculate the correct answer. We plan to use this for reading a wheel speedometer, and we are not sure if there is a solution for this issue.

We are using Input Capture Mode, but the results from the same code are still fluctuating over a wide range.

Best Regards
Paddy

1,342 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

not sure for your case/code, but generally; once IPM mode is entered then channel flag (interrupt if enabled) is set at second configured edge and then on each subsequent configured edge. At that time you can read An/Bn registers to get signal period, see mode description in the RM. So not sure why you need four period to get right result.
In SAIC mode each configured edge the flag is set and you should read captured value. 
In all cases you should take care of possible timebase overflows, ideally is to have prescalers set in the way just single overflow can happen, then the period width will be calculated as Width = (An + Counter Bus Period) - Bn

BR, Petr 

1,308 Views
PaddyChan
Contributor III

Hi Petr,

We are currently using the Period Measurement Mode to measure the frequency of a wheel speedometer, but we have found that the signal has a lot of noise, causing our output frequency to often jump to FFFF or display incorrect values, with correct values occasionally being displayed.
Even though the signal has been filtered by our RC low-pass filter and the noise has been significantly suppressed, the problem still persists without any improvement.
Are there any solutions to this problem?


Our method of calculating frequency is:

           uint32_t speed = 1/(retValue1*2560*1.25*pow(10,-8));

 

The first image is the signal before passing through the low-pass filter.

Signal before low-pass filterSignal before low-pass filter

The second image is the signal after passing through the low-pass filter.Signal after low-pass filterSignal after low-pass filter

Best Regards
Paddy

0 Kudos
Reply
1,263 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

the signal looks normal, I think. I expect rather possible issue in SW, but hard to say where.
I posted in past some example for MPC5646C for frequency measurement, for sure not using SDK.
Maybe you can refer to that; https://community.nxp.com/t5/MPC5xxx-Knowledge-Base/Example-MPC5646C-eMIOS-frequency-measurement-CW2...

BR, Petr