Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve detect events skips #78

Open
automech-rb opened this issue Sep 20, 2022 · 5 comments
Open

Improve detect events skips #78

automech-rb opened this issue Sep 20, 2022 · 5 comments

Comments

@automech-rb
Copy link

automech-rb commented Sep 20, 2022

Hi,

Thanks for this awesome C++ implementation.
I am using the GPIO::add_event_detect(channel, GPIO::BOTH, callback_fn) feature to detect edge in Jetson AGX Xavier digital input. Environment is JP5.0.2 with docker.

I have a rotary encoder whose digital output change every 1 milliseconds from high to low (and vice versa).

The problem is when CPU load increases on Jetson to 50% or more, the add_event_detect is not able to pick up all the encoder output change. It don't detect around 30% of the edge (less callbacks) for same encoder RPM. I understand that this is not a RTOS based system, but do you have any recommendations to improve the GPIO callback performance?

thanks

@automech-rb
Copy link
Author

automech-rb commented Sep 20, 2022

To add, this error behaviour is easy to simulate when comparing output if 15W and MAXN mode.

For now to mitigate this issue, I am using different thread and looping at >1000hz to check digital input.

Also, #77 seems to be similar issue but for 20KHz instead of 1KHz for mine!

@pjueon
Copy link
Owner

pjueon commented Sep 26, 2022

Thanks for the report.

@ShimmyShaman
Do you have any idea about this issue?

@ShimmyShaman
Copy link
Collaborator

Distracted by other life things, but I have been looking into it. Believe there are fixes that can be made, but have to test/explore them.

@pjueon
Copy link
Owner

pjueon commented Sep 27, 2022

@automech-rb
Does this issue also occur when CPU load is low?

@automech-rb
Copy link
Author

From my testing, this issue only occurs with high CPU usage (over 50%).
To add more details:

  • I am using two add_event_detect for two encoders running inside docker container on JP5.0.2
  • Similar error behavior is observed when compute performance is limited by changing mode to 15W (+ more erratic callback sometimes low sometimes high in same timespan for constant encoder RPM)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants