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.

#TMS570LC43x# measure the time of a pin's high power level

Other Parts Discussed in Thread: HALCOGEN

I want to measure the time of a GIO pin's high power level. 

I can detect the rising edge using the interrupt. But how can I measure the time of the level holding on. Maybe there is a way to set both rising edge interrupt and falling edge interrupt and get the RTI number. However the HALCOGEN can not be set for both edge interrupt.

Hoping for a solution.

  • You are correct that the GIO must be configured for an interrupt on a rising edge or a falling edge. You could configure it for rising edge polarity, then in the interrupt routine, read the RTI, then reconfigure the GIO for falling edge. The next interrupt you would read the RTI again, and reconfigure the GIO for rising edge interrupt ready to catch the next high pulse. This method is simple, but requires that the pulse be long enough to allow the interrupts to be serviced while the pin is high, then again while it is low. Also, any other interrupts in the system would affect the accuracy of the measurement. Using the high end timer (N2HET) , a more complex peripheral, is a better way to do this task. If you are interested in using the N2HET, look at this application note (SPNA225). The part about doing input capture should be relevant to your task.

  • Thank you very much. I only know that the N2HET can generate PWM wave before. It seems that I need to learn more about it.
  • Sorry to bother again.
    I want to measure the time using Timestamp that N2HET provides. However, I find that there aren't any way to change the rising interrupt model to falling interrupt model. Because it is set by "# define GIO_POL_CONFIGVALUE", so I can not change it in the code. Do you have some other way?