Rasberry GPIO accces

Need help with C, C++, perl, python, etc?

Rasberry GPIO accces

Postby arzgi » 2021-04-03 15:48

Installed Debian Buster to Raspberry Zero.

When I had Rasbian, got a lcd-display wired to Zero working following https://www.circuitbasics.com/raspberry-pi-lcd-set-up-and-programming-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:
arzgi
 
Posts: 727
Joined: 2008-02-21 17:03
Location: Finland

Re: Rasberry GPIO accces

Postby arochester » 2021-04-03 16:41

Have you also asked on the Raspberry Pi Forums?
arochester
 
Posts: 1912
Joined: 2010-12-07 19:55

Re: Rasberry GPIO accces

Postby LE_746F6D617A7A69 » 2021-04-03 21:30

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
LE_746F6D617A7A69
 
Posts: 469
Joined: 2020-05-03 14:16

Re: Rasberry GPIO accces

Postby arzgi » 2021-04-04 13:07

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
arzgi
 
Posts: 727
Joined: 2008-02-21 17:03
Location: Finland


Return to Programming

Who is online

Users browsing this forum: No registered users and 5 guests

fashionable