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.

TDA2P-ACD: GPIO interrupt delay

Part Number: TDA2P-ACD

Hi

We are using PWM module to generate 60 Hz signal. Same signal is routed back to TDA.
Further, we are using GPIO interrupt (GPIO_4) for detecting rising edge of PWM. Inside ISR we are time-stamping
this event. So, difference between two consecutive interrupts should be 16 667 us. But, in our case, time difference is
always very close to 16 000 us or 17 000 us. For example, if we change PWM signal to 50 Hz 100 Hz, or any frequency which
period is rounded to 1 ms (eg. 20 ms or 10 ms) time-stamp is very precise. So, our conclusion that this could be related
to GPIO interrupt latency and GPIO clock. Is this correct? What is clock frequency used for GPIO_4 and is it possible to change it.
Please, give us some hint, our customer is waiting for replay.

Time-stamp function returns time in micro seconds.

Best regards,
Stefan.

  • Hi all,

    GPIO controllers can sample up to 200Mhz frequency.

    I don't think that your issue is related to GPIO clock or any frequency.

    It seems most likely some software issue.

    Can you give details on the different scenarios you have tested and measured timestamp data?

    Are you printing this from the ISR?

    Note that Linux interrupt latency cannot be guaranteed to microsecond level

    Regards,

    Nikhil D

  • Hi Nikhil,

    I forgot to mention that we are running Linux (A15) + RTOS combination. But, interrupt happens under RTOS (IPU2), so Linux interrupt latency is not problem.

    Here are few test scenarios:

    1. PWM frequency 60 Hz (Period ~16 667 us)

    [HOST] [IPU2 ] 298.232111 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.249100 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.265113 s: >>>>>>> Diff: 16001
    [HOST] [IPU2 ] 298.282102 s: >>>>>>> Diff: 16999
    [HOST] [IPU2 ] 298.299121 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.315104 s: >>>>>>> Diff: 16000
    [HOST] [IPU2 ] 298.332123 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.349112 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.365125 s: >>>>>>> Diff: 16001
    [HOST] [IPU2 ] 298.382114 s: >>>>>>> Diff: 16999
    [HOST] [IPU2 ] 298.399103 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.415116 s: >>>>>>> Diff: 16000
    [HOST] [IPU2 ] 298.432105 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.449124 s: >>>>>>> Diff: 17000
    [HOST] [IPU2 ] 298.465107 s: >>>>>>> Diff: 15999

    As you can see, difference between two interrupts is either 16 ms or 17 ms (EXPECTED around 16 667 us)

    2. PWM frequency 50 Hz (Period ~20 000 us)

    [HOST] [IPU2 ] 273.018727 s: >>>>>>> Diff: 20000
    [HOST] [IPU2 ] 273.038736 s: >>>>>>> Diff: 20000
    [HOST] [IPU2 ] 273.058744 s: >>>>>>> Diff: 20001
    [HOST] [IPU2 ] 273.078722 s: >>>>>>> Diff: 19999
    [HOST] [IPU2 ] 273.098731 s: >>>>>>> Diff: 20000
    [HOST] [IPU2 ] 273.118739 s: >>>>>>> Diff: 20000
    [HOST] [IPU2 ] 273.138717 s: >>>>>>> Diff: 20000
    [HOST] [IPU2 ] 273.158726 s: >>>>>>> Diff: 20001
    [HOST] [IPU2 ] 273.178734 s: >>>>>>> Diff: 19999
    [HOST] [IPU2 ] 273.198743 s: >>>>>>> Diff: 20000
    [HOST] [IPU2 ] 273.218721 s: >>>>>>> Diff: 20001

     

    Everything is OK, time difference as expected.

     

    3. PWM frequency 100 Hz (Period ~10 000 us)

    [HOST] [IPU2 ] 98.475294 s: >>>>>>> Diff: 9999
    [HOST] [IPU2 ] 98.485298 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.495302 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.505307 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.515311 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.525315 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.535319 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.545293 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.555297 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.565302 s: >>>>>>> Diff: 10001
    [HOST] [IPU2 ] 98.575306 s: >>>>>>> Diff: 9999
    [HOST] [IPU2 ] 98.585310 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.595315 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.605319 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.615323 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.625297 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.635301 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.645305 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.655310 s: >>>>>>> Diff: 10000
    [HOST] [IPU2 ] 98.665314 s: >>>>>>> Diff: 10001
    [HOST] [IPU2 ] 98.675318 s: >>>>>>> Diff: 9999

    Everything is OK, time difference as expected.

    4. PWM frequency 30 Hz (Period ~33 333 us)

    [HOST] [IPU2 ] 245.931434 s: >>>>>>> Diff: 33003
    [HOST] [IPU2 ] 245.964436 s: >>>>>>> Diff: 33001
    [HOST] [IPU2 ] 245.998444 s: >>>>>>> Diff: 33995
    [HOST] [IPU2 ] 246.031446 s: >>>>>>> Diff: 33004
    [HOST] [IPU2 ] 246.064448 s: >>>>>>> Diff: 33001
    [HOST] [IPU2 ] 246.098426 s: >>>>>>> Diff: 33996
    [HOST] [IPU2 ] 246.131458 s: >>>>>>> Diff: 33003
    [HOST] [IPU2 ] 246.164460 s: >>>>>>> Diff: 33001
    [HOST] [IPU2 ] 246.198438 s: >>>>>>> Diff: 33996
    [HOST] [IPU2 ] 246.231440 s: >>>>>>> Diff: 33003
    [HOST] [IPU2 ] 246.264442 s: >>>>>>> Diff: 33001
    [HOST] [IPU2 ] 246.298450 s: >>>>>>> Diff: 33995
    [HOST] [IPU2 ] 246.331452 s: >>>>>>> Diff: 33004
    [HOST] [IPU2 ] 246.364454 s: >>>>>>> Diff: 33001

    Difference between two interrupts is either 33 ms or 34 ms (EXPECTED around 33 333 us). Same behavior as in first test. 

    My target is test 1 and test 4, which are not working as expected. Also, you can see strange sequence in test 1 and test 4. At both tests there are two also same time-stamps in a row, after that +-1 ms, again two in a row, etc...

    For example  ... 17 ms, 17 ms, 16 ms, 17 ms, 17 ms, 16 ms, ...

    I'm printing from ISR, but I think this is not a problem, considering low ISR rate. Also, at the highest rate (100 Hz) it works as expected.

    What is RTOS interrupt latency? Any other suggestions?

    Best regards,

    Stefan.

  • Hi Stefan,

    What is the Timer that you are using to take the time stamp?

    Regards,

    Rishabh

  • Rishabh,

    We are using TIMER_5 for time-stamp.

    Regards,

    Stefan.

  • Hi Stefan,

    Thanks. Can you also share the Timer5 register dumps in failure and pass cases.

    Regards,

    Rishabh

  • Rishabh, Nikhil,

    The issue is resolved by putting GPIO module in no-idle mode. Thank you on your support.

    Best regards,

    Stefan.

  • Hi Stefan,

    Glad that your issue is resolved.

    Thanks for the update.

    Regards,

    Rishabh