So I just found out that the Raspberry Pi 2 came out, and I'm wondering whether stuff like this would work on it without any modifications (except for recompiling it for ARMv7 of course). This piece of code accesses the Pi's GPIO pins directly, through writing to bcm2835-specific register addresses.

I have read what they say on the website about the new Pi, which is that the chip is the same as the old one, except for the faster processor. But this description is very brief, and leaves me wondering whether low-level and very hardware-specific code that was written for the old Pi would work on the new one.

  • It should be identical at that level. But until it's in peoples sweaty hands and software has been compiled and run there will be doubt. In other words don't expect any answers until tomorrow.
    – joan
    Feb 2, 2015 at 13:20
  • Oh, it came out today? I had no idea. I thought it was out there for some time, and I only discovered it today. Well, let's wait then I guess :)
    – notadam
    Feb 2, 2015 at 13:22

3 Answers 3


Unfortunately it looks like all the register addresses have changed.

The peripherals base address for previous (ARMv6) models was 0x20000000. The new (ARMv7) model seems to have a peripherals base address of 0x3F000000.

This will break all the existing low level C libraries (wiringPi, bcm2835, pigpio), bare-metal programs, and any code which directly accesses the peripherals.

If this is the extent of the changes it is fairly trivial to fix.

However it's hard to reconcile this change with the statement that no changes are required.

  • Thanks for the answer! If only the base address has changed, then the fix would be very trivial, as you said. I hope that the rest stayed the same, otherwise that would be a pain in the ass for some developers.
    – notadam
    Feb 2, 2015 at 20:41
  • @adam10603 It'll certainly be a pain in the proverbial if the DMA implementation has changed. pigpio makes a lot of use of DMA.
    – joan
    Feb 2, 2015 at 21:07
  • joan, as the Foundation forum's still off line, if you go to Gordon's wiringpi site, he has more info', & indeed base address must be changed. john
    – user26598
    Feb 2, 2015 at 21:07
  • I've been looking at the kernel, in particular github.com/raspberrypi/linux/blob/rpi-3.18.y/arch/arm/…
    – joan
    Feb 2, 2015 at 21:56

The last commit on rpi firmware brought 3 new functions in bcm_host : https://github.com/raspberrypi/userland/commit/3b81b91c18ff19f97033e146a9f3262ca631f0e9

You now can use void bcm_host_get_peripheral_address() to get the register address.


According to the official blog post:

Let's get the good stuff out of the way above the fold. Raspberry Pi 2 is now on sale for $35 (the same price as the existing Model B+), featuring:

A 900MHz quad-core ARM Cortex-A7 CPU (~6x performance)
1GB LPDDR2 SDRAM (2x memory)
Complete compatibility with Raspberry Pi 1

So, my best guess would be that yes. The new Raspberry Pi 2's GPIO will work exactly the same.

However, like @joan mentioned, this new Pi has just barely been announced - and nobody has really had time to experiment on it - so we can't be entirely sure.

  • Just looking at github.com/raspberrypi/firmware/tree/master/boot/overlays "act_led_gpio (default "16" on a non-Plus board, "47" on a Plus)" This is the OK or ACT led. I would assume as the physical layout is the same as the + the GPIO's will relate to B+, thus the pins on the board should be the same, but some of the SoC GPIO's may be slightly different Feb 2, 2015 at 15:04
  • @Naughty_Ottsel Thanks for that, definitely is some useful information to have! Feb 2, 2015 at 15:32
  • Hopefully my board will be here tomorrow so I can test it. Wish Broadcom would release their technical details on the new SoC Feb 2, 2015 at 15:34
  • @Naughty_Ottsel Nice! I went and looked on Element14's site and it's already sold out :) Feb 2, 2015 at 17:03
  • I ordered with RS-Online almost as soon as the news dropped. Just keeping my fingers crossed it does turn up tomorrow :D Feb 2, 2015 at 17:04

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.