While working on improving our code, our Pi's SD card crashed unexpectedly. After doing a reinstall of Wheezy, we found we were getting the following error on using Rpi.GPIO
No access to /dev/mem. Try running as root!
We used the following linux commands to fix it
sudo chown root.gpio /dev/gpiomem
sudo chmod g+rw /dev/gpiomem
sudo chown root.gpio /dev/mem
sudo chmod g+rw /dev/mem
These commands gave gpio, access to mem and gpiomem which cleared the issue. But these had to be re-executed on each reboot. So we made a bash script for it, permission.sh.
After that we ran the following commands to make it execute on startup
chmod 755 permission.sh
cp permission.sh /etc/init.d
sudo update-rc.d permission.sh default
chmod +x /etc/init.d/permission.sh
Copying to /etc/init.d gets it executed on startup. The next two commands are to unsure the script is added to startup and to make it an executable script.The permissions issues were fixed but now, we were getting a runtime error in our python code on trying to run the Rpi.GPIO.wait_for_edge(). After a lot of futile attempts to fix the issue, we decided to use another gpio library, pigpio.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.