This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

When does NHET sample Input Pin?



Hello,

I am looking for some explanation here.

WCAP Instruction is supposed to capture the Input Pin Edge time stamp.

Question is when does NHET sample the Input Pin Voltage Level in order to determine the occurrence of EDGE of the signal?

Is it at the beginning of NHET Low Resolution Loop Time   or    during the WCAP VLIW Instruction Execution Cycle Time?

Any detailed explanation related to Input Pin Sampling instance w.r.t. NHET Low Resolution Execution cycle will help me to understand it for my application.

Thank you.

Regards

Pashan

 

  • Hello Pashan.

    The TRM has a very good description about the input edge-detection functionality on pages 1264 and 1265. There is a further WCAP-specific example shown on pages 1268 and 1269. Let me try to explain it using the figure on page 1269:

    In the above diagram, the WCAP instruction is required to time-stamp the falling edge on the HET0 input pin. If the HR capability is enabled in the WCAP instruction, the HR capture register captures the HR count value as soon as the falling edge is detected. This value then gets written to the WCAP instruction data field when it is executed in the next loop. The HR prescaler in this example is 4, that is LRP = 4 * HRP.  The table 18-6 on page 1255 shows that in this case only bits 6 and 5 of the 7-bit HR data field are valid. So the value of 2 will be stored in the bits 6 - 0 of the WCAP instruction as "10xxxxx", where the x indicates a don't care.

    The WCAP instruction execution also captures the current value of the counter stored in register A. This value is 4 in this loop. This value is stored as "100" and is right-justified in the WCAP data field bits 9, 8 and 7.

    In effect, once the falling edge has been detected, the value 0x240 will be stored in the data field of the WCAP instruction. The application needs to read this value and determine that the falling edge occurred when the HR counter was 2 and the LR loop counter was 3 (current value captured - 1).

    Regards,

    Sunil

  • Hi Pashan, Sunil,

    I'd like to point out that the current NHET design actually samples the edge in two different ways.

    For the purpose of high resolution time stamping, it will sample the edge using the HR clock, this is how you get the fraction of the LR clock captured and stored in the LSBs of the data field.

    However, the edge dection that is used to indicate 'event occurred' is based on the same input but synchronized to the LR clock.  

    This has the practical implication of limiting the input signal high and low pulse widths to be at least 1 LRP or longer.   If a shorter pulse high or low period is injected as an input, the WCAP's timestamp may fire but the edge detection could miss the edge and then an incorrect result would happen.

    Sunil, there is probably a better place to point to see a picture of the above... maybe you could point to this ?

    Best Regards,
    Anthony