Precision timestamp for GPIO IRQ

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

Precision timestamp for GPIO IRQ

781 Views
roryhansen
Contributor II

I am trying to get a very precise timestamp of when a GPIO IRQ occurs.  I've already altered gpiolib to create a new object:  "/sys/class/gpio/gpioXXX/timestamp"

What i can't figure out is how to write to it from within the ISR.  Should be fairly simple:

     do_gettimeofday(&tv);

     sprintf((char *)pointertotimestamp,"%08u.%06u\n",(int)(tv.tv_sec%100000000),(int)tv.tv_usec));

What I can't seem to figure out is how to get (or create) the pointer to "/sys/class/gpio/gpioXXX/timestamp" inside the interrupt routine.

Thank you everyone in advance.

Labels (2)
0 Kudos
2 Replies

552 Views
YixingKong
Senior Contributor IV

Rory

We have not got your response yet and will close the discussion. If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos

552 Views
alejandrolozan1
NXP Employee
NXP Employee

Hi Rory,

Sorry for the delay,

Are you still having problems?

Do you want to modify the value of the GPIO?

In kernel space you could try to use the gpio_set_value in case you want to modify the value of a pin.

If that is not what you want, please give me more details.

Best Regards,

Alejandro

0 Kudos