Hi
When I used ETPU for input capture, the duty cycle 0 and 100% could not be captured. When the duty cycle changed from 0% to 100%, the 100% duty cycle could not be detected. If the duty cycle changed from 0-> 40%-> 100% and 100% duty cycle can be detected, that is,100% can be detected when an intermediate value is given from 0 to 100%, and 0 can be detected when the input is directly changed from 100% to 0. In addition, the initial state of the external input captured after initialization is incorrect, and the external initial input is connected with a pull-up resistor. The captured duty cycle should be 100%, but the capture initial value displayed is 0. What should I pay attention to in input capture and how to improve the above situation.
Hello,
The eTPU input capture (IC) function only takes action when it detects an edge (can be configured to falling/rising/any). So it will not capture 0 or 100% duty cycle signals without help from the host such as some kind of timeout mechanism - if no edges occur over some amount of time (minimum frequency) then the host can deem the signal to be at 0 or 100% duty.
There are a couple of other input functions you could investigate - PPA or FPM - although they both suffer the problem that they do not start measurement until at least one edge occurs, so if they are initialized when the input signal is 0/100% duty they will fail to provide good feedback.
With regards to the pin state - are you reading the IPS value from the appropriate channel SCR register? It doesn't appear the IC function does any pin sampling.
Hi
I would like to add that when I gave the input from 0 to 100%, I used Lauterbach to observe the IPS bit of SCR register, and found that the IPS bit was not set to 1. Is this related to the detection mechanism of the chip itself?
If you read the IPS value in code rather than via Latuerbach does it still read 0? I assume your SIU settings are valid, PA and IBE set as needed etc.? For MPC5634 I do not know why IPS would not reflect the value of the pin if all configuration is correct.
Hello
Thanks for getting back to me, I understand the initial state of the problem, and is the same as I thought, is the need to have an edge to activate, but the duty ratio from 0 to 100% directly, this still can't detect a 100% duty cycle, we set the timeout handling mechanism, in fact 0 to 100% duty cycle can be input capture, Only the capture of 100% duty cycle is conditional. The condition requires an intermediate value transition as described in the problem. Could you give me some more detailed suggestions?
I am still unsure of the exact situation you are trying to measure that is giving you problems - could you provide a diagram or more information? IC, depending upon how it is configured, could capture a change from 0->100% duty or vice-versa. Thanks for any further clarification.
Hi
Thank you for your help. We have rearranged the timeout logic and the problem has been solved.