-
Notifications
You must be signed in to change notification settings - Fork 7
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
Root privs and /dev/gpiomem #18
Comments
Yes - run the pigpiod daemon process on the Pi and connect to it via sockets. See this page: https://github.com/mattjlewis/pigpioj#sockets. Also discussed here with diozero: https://www.diozero.com/concepts/remotecontrol.html#pigpio |
But can it be used without the daemon, via JNI? A lot of the python code out there nowadays is written to access via /dev/gpiomem (so called tinygpio, as seen in in the Rpi.GPIO library), which can be configured to work without needing root privileges... |
It can be used without the daemon, but because of the way pigpio is written it must have root access when using this JNI access method. |
Thanks for that reply... Cool, I was already using pigpio provider via diozero, so I assume you mean just use the core? To give some background, what I am trying to achieve to start with is to convert some Python code that drives some motors, via PWM on BCM pins 8 through 11. How do I convert the pin numbers in code? Can you point me to an example? Thanks |
You can use the diozero SystemInformation app to get information on GPIO names and physical PIN numbers. There’s also http://pinout.xyz Regarding PWM output I would recommend configuring two of the Pi’s hardware PWM channels via a device tree overlay. If you need more than 2 then diozero can do software controlled PWM output. This obviously won’t be as stable as the hardware signal. This is where pigpio can be useful - it uses low level hardware features to do accurate PWM output on any pin, but needs root access to do so. Can follow up with links and more examples later. |
Unfortunately, if I understand this correctly, GPIO8 through 11 do not support hardware PWM - and I cannot do anything to change the pins being used, as they are a fixed feature of the robot board I am using. Pretty dumb, IMHO, as the pins are also SPI0. I am looking at how the different libraries I have access to get round the limitations, including pigpio*. The python code I am converting uses the RPi.GPIO library, which uses its own C layer to implement the timing - I am not sure yet how the timing stability compares yet with native diozero.
On 18 February 2023 07:58:55 GMT, Matthew Lewis ***@***.***> wrote:
You can use the diozero SystemInformation app to get information on GPIO names and physical PIN numbers. There’s also http://pinout.xyz >
Regarding PWM output I would recommend configuring two of the Pi’s hardware PWM channels via a device tree overlay. If you need more than 2 then diozero can do software controlled PWM output. This obviously won’t be as stable as the hardware signal. This is where pigpio can be useful - it uses low level hardware features to do accurate PWM output on any pin, but needs root access to do so. >
Can follow up with links and more campers later.
-- >
Reply to this email directly or view it on GitHub:
#18 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
That is frustrating. If you have access to a scope you will be able to see how accurate the PWM signal is. Out of interest what board are you using? I have a scope and just about every Pi version so can do some tests for you. From a very quick Google - this seems to be the source for RPi.GPIO: https://github.com/sarnold/RPi.GPIO "Although hardware PWM is not available yet, software PWM is available to use on all channels." It would appear that that library uses software PWM - I strongly suspect that diozero / Java would produce a more stable software PWM signal than in Python. |
The main board is a Pi 4 8GB, the robot board is a Pimoroni Trilobot. I have a scope, it's old and cranky, but it should work. I found the source for RPi - the main one looks to be here: https://sourceforge.net/p/raspberry-gpio-python/code/ci/default/tree/
the github is a mirror, I think.
The actual software timing is done in a C library, so I suspect the quality of the code will matter more than the language...
On 19 February 2023 10:45:08 GMT, Matthew Lewis ***@***.***> wrote:
That is frustrating. If you have access to a scope you will be able to see how accurate the PWM signal is. Out of interest what board are you using? I have a scope and just about every Pi version so can do some tests for you.
From a very quick Google - this seems to be the source for RPi.GPIO: https://github.com/sarnold/RPi.GPIO
"Although hardware PWM is not available yet, software PWM is available to use on all channels."
It would appear that that library uses software PWM - I strongly suspect that diozero / Java would produce a more stable software PWM signal than in Python.
--
Reply to this email directly or view it on GitHub:
#18 (comment)
You are receiving this because you authored the thread.
Message ID: ***@***.***>
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Hi,
Can pigpioj be used without root access on systems where gpiomem is correctly configured and the user has permissions?
Thanks
Stephen P.
The text was updated successfully, but these errors were encountered: