I have upgraded to the new rPi B+ 2 now from the old B model. Keep in mind that everything worked fine with my older boards. Now with my newer boards it does not.

I have my script in the rc.local which is to set my GPIO pins.

echo "$BOOT" > /sys/class/gpio/export
echo "out" > /sys/class/gpio/gpio$BOOT/direction
echo "1" > /sys/class/gpio/gpio$BOOT/value

if I enter these commands in the terminal which are the same ones as in my script, there is no effect on the pins. In the above case, I am setting pin25 to HIGH. When I check the values of direction and of value, I see that the above parameters are indeed written to those files, BUT my pin is still not HIGH and if I do a

gpio readall

I see that there is literally no change. readall reveals that pin25 is still "IN" and "LOW" even after I just ran the above commands.

However, if in the terminal, I manually set the parameters for that pin via:

gpio mode 25 out
gpio write 25 1

the pin changes to HIGH and my led comes on.

I suspect this has something to do with upgrading the pi image prior to being able to use it in this new pi, but can not figure why.

Any ideas?

2 Answers 2


Got it. What I found out and yet do not understand is that originally my script was using the pin numbers corresponding with the wPi column in the gpio readall table. So it appears that when I use the commands

gpio mode ....
gpio write .....

these are wPi column numbers. However, the script which is running from /etc/rc.local uses the pin numbers from the BCM column instead. Makes little sense to me, but either way it works for the moment.

  • The reason these are likely different is the /sys/class interface is a standard linux kernel thing, and I guess uses numbers supplied by the BCM SOC or else whatever scheme was used by whoever wrote the particular driver for the pi. This turns out to be different than the scheme used by the wiringPi library, as explained here. Neither of them make any particular sense from the perspective of the header, of course. >_< The gpio utility, according to the man page, was written specifically for the pi, presumably using wiringPI.
    – goldilocks
    Mar 16, 2015 at 12:10
  • Any way to change it from BCM to BOARD?
    – Cybergei
    Mar 16, 2015 at 12:27
  • I've lost track of what you say has happened. The sysfs interface is unchanged. Are you saying that script used to work but now doesn't? I don't see how that could be the case. Or are you saying there never was an error and you just misinterpreted what you were seeing?
    – joan
    Mar 16, 2015 at 12:35

All the gpio libraries which talk directly to the gpio hardware have to be updated for the Pi2. The hardware is at a different address.

This includes, but is not limited to, my pigpio, wiringPi, bcm2835, RPi.GPIO, RPIO.GPIO, servoblaster, pi-blaster, pi-fm etc. etc.

Make sure you update any third party gpio libraries you use.

  • not helpful. As I said, I had to update all to be able to use the old image with this new PI. I have already manually updated the libraries and even the distro
    – Cybergei
    Mar 16, 2015 at 10:22
  • Oh well, it'll just remain one of life's great mysteries.
    – joan
    Mar 16, 2015 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.