Rasberry GPIO accces

Programming languages, Coding, executables, and scripting.
Post Reply
Message
Author
arzgi
Posts: 851
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 6 times

Rasberry GPIO accces

#1 Post by arzgi »

Installed Debian Buster to Raspberry Zero.

When I had Rasbian, got a lcd-display wired to Zero working following https://www.circuitbasics.com/raspberry ... in-python/

Testing with this script, also python3 shell stopped at the last line.

Code: Select all

#!/usr/bin/env python3

from RPLCD.gpio import CharLCD
from RPi import GPIO

GPIO.setwarnings(False)
lcd = CharLCD(pin_rs = 37, pin_e = 35, pins_data = [33, 31, 29, 23], numbering_mode = GPIO.BOARD)  


If I run the scrpt as user, I get this

Code: Select all

RuntimeError: No access to /dev/mem.  Try running as root!

If with sudo, it ends to this

Code: Select all

Memory overflow
Tried to change nmbering_mode from GPIO.BOARD to GPIO.BCM, did not help.

Code: Select all

$ ls -la /dev/mem
crw-r----- 1 root kmem 1, 1 helmi  14  2019 /dev/mem
I'm stuck :oops:

arochester
Global Moderator
Global Moderator
Posts: 2060
Joined: 2010-12-07 19:55
Has thanked: 1 time
Been thanked: 3 times

Re: Rasberry GPIO accces

#2 Post by arochester »

Have you also asked on the Raspberry Pi Forums?

LE_746F6D617A7A69
Posts: 521
Joined: 2020-05-03 14:16

Re: Rasberry GPIO accces

#3 Post by LE_746F6D617A7A69 »

arzgi wrote:

Code: Select all

RuntimeError: No access to /dev/mem.  Try running as root!
Your program is outdated, You should be able to access /dev/gpiomem without having the root privileges.
Anyway, it's a wrong forum to ask about RPi ;)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

arzgi
Posts: 851
Joined: 2008-02-21 17:03
Location: Finland
Been thanked: 6 times

Re: Rasberry GPIO accces

#4 Post by arzgi »

Thanks for answering anyhow, altough this is the wrong forum :)

There is now /dev/gpiomem on my system:

Code: Select all

i@rpi1-20210210:~$ ls -la /dev/mem
crw-r----- 1 root kmem 1, 1 helmi  14  2019 /dev/mem
pi@rpi1-20210210:~$ ls -la /dev/gpio*
crw------- 1 root root 254, 0 helmi  14  2019 /dev/gpiochip0
pi@rpi1-20210210:~$ cat /etc/debian_version
10.9

Post Reply