Closed mathiask88 closed 8 years ago
Do things improve if echo 17 > /sys/class/gpio/unexport
is executed from the command line after the script terminates?
Unexporting the pin solves the problem, but there must be a way to delete the epoll event listener properly and leave the pin exportet?
The issue isn't related to the file descriptor that's being (that was) monitored by epoll. The monitoring stopped when the remove method was called. In addition, the process has terminated so it can't be monitoring the file descriptor any more.
The issue is occurring because interrupts are activated and occurring at a rate of 3300 per second. The OS is still processing them. The GPIO needs to be unexported or interrupts should be disabled with echo none > /sys/class/gpio/gpio17/edge
I haven't tried it out but the CPU usage may even be visible after the export and setting of interrupts and before the script is run.
Ahh okay that makes sense. I will try that tomorrow and report back. Thanks!
Couldn't wait until tomorrow, tested with my smartphone's ssh client :) You were right, if I set the edge to none the cpu load drops. Thanks for your help!
No problem :) Thanks for the feedback.
Hi,
I got a 3300Hz pulse attached to a RPI2 GPIO pin. And if I test the interrupts with this script
the kworker process still is at ~8% cpu usage after the script has finished. If I disconnect the source from the pin the cpu usage goes down to 0%, so I think the deregistration of the fd does not work properly.
// Edit: Linux raspberrypi 4.1.17-v7+ #838 SMP Tue Feb 9 13:15:09 GMT 2016 armv7l GNU/Linux