When the raspberry Pi model A was announced a few days ago, I ordered one straight away. With three different models of raspberry Pi now available (or four, if you count the red Chinese variant), working out the capabilities of the board is becoming increasingly important. It’s vital for anyone involved in making hardware or software for other people to use, and it’s even pretty important for personal projects – you never know when you might want to use your hardware and software with a different board.
From my experimentation, here are the revision number values, and some useful things you can deduce from them:
Rev. No. | Model | Capabilities |
---|---|---|
0x2 | B1 | Original Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, (P2) JTAG pins, no mounting holes, Pin3=GPIO0, Pin5=GPIO1, Pin13=GPIO21, I2C-0 |
0x3 | B1+ | Original Model B with no polyfuses, 256MB RAM, Ethernet, two USB sockets, five LEDs, no mounting holes, Pin3=GPIO0, Pin5=GPIO1, Pin13=GPIO21, I2C-0 |
0x4 | B2 | Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5) |
0x5 | B2 | Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5) |
0x6 | B2 | Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5) |
0x7 | A | Model A, 256MB RAM, no Ethernet, one USB socket, two LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, I2C-1, 8 extra IO pads (P5) |
0x8 | A | Model A, 256MB RAM, no Ethernet, one USB socket, two LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, I2C-1, 8 extra IO pads (P5) |
0x9 | A | Model A, 256MB RAM, no Ethernet, one USB socket, two LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, I2C-1, 8 extra IO pads (P5) |
0xd | B2 | Rev2 Model B, 512MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5) |
0xe | B2 | Rev2 Model B, 512MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5) |
0xf | B2 | Rev2 Model B, 512MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5) |
Update: The above table has been extended based on Dom’s answer on the Raspberry Pi board
Apparently codes 0x4, 0x5, and 0x6 are allocated to B2 boards with 256MB RAM, although I have never seen one “in the wild”. If you have a board which responds with one of these numbers, or indeed anything else not in my table, please let me know!
Personally I have a B1 (0x2), a B2 (0xe) and an A (0x8). Now that I know how many there are, it kind of makes me want to collect them all ;)
Luckily the Raspberry Pi firmware provides ways to query the system about its revision number.
Here’s a few ways to find the revision number of the board your software is running on:
If you are running on Raspbian, check /proc/cmdline:
Language | code |
---|---|
bash |
cat /proc/cmdline | awk -v RS=" " -F= '/boardrev/ { print $2 }' |
python |
import re def getrevision(): revision = "unknown" with open('/proc/cmdline', 'r') as f: line = f.readline() m = re.search('bcm2708.boardrev=(0x[0123456789abcdef]*) ', line) revision = m.group(1) return revision print getrevision() |
ruby |
def getrevision line = File.open("/proc/cmdline").first m = line.match /bcm2708.boardrev=(0x[0123456789abcdef]*) / return m[1] end puts getrevision |
perl |
open my $file, '<', "/proc/cmdline"; my $firstline = <$file>; close $file; $firstline =~ /bcm2708.boardrev=(0x[0123456789abcdef]*) /; print "$1\n"; |
lua |
io.input("/proc/cmdline") s = io.read("*a") print(s:match("bcm2708.boardrev=(0x%x*) ")) io.close() |
C |
#include |
If your program is running on the "bare metal" of the Raspberry Pi without an operating system to do this stuff for you, please see my previous article about reading Raspberry Pi revision numbers
Pingback: Automatic #RaspberryPi board revision detection | Raspberry PiPod
Pingback: Guide to #RaspberryPi revisions / @Raspberry_Pi | Raspberry PiPod
Hi Frank, I’ve got a 0x4 board if you’re interested in any information from it. It was purchased as soon as the Sony manufacture announcement was made. I believe it was the first board to get the mounting holes, to be made in England, to be polyfuse free and to support powering the board by backfeeding the usb.
Thanks for the code snippets above, I could do with updating some of my modules to automatically detect i2c buses.
I’ve included a cpuinfo output below …
pi@pitop ~ $ cat /proc/cpuinfo
Processor : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 697.95
Features : swp half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 0004
Serial : 00000000422e4101
Looks like I was mistaken on the polyfuse thing.
Thanks for getting in touch. Presumably your board has only 256MB RAM, but is otherwise identical to the newer (0xd-0xf) B2 boards?
I find all the discussion about powering the boards by back-feeding the USB to be a bit odd. I often power all my boards, including the 0x2 B1 board, from a USB-to-serial converter plugged into the UART pins on the GPIO header. It’s a great way to get a nice neat single-cable system, provides almost all the features of an ssh connection when used with Linux, and is easy to communicate with from bare metal software. In fact, it’s the only way I have been able to talk to my model A so far!
Yes, it was just before the upgrade to 512mb, but otherwise it looks to be identical.
I’ve been powering them over the GPIO header in a few of my recent projects, but the usb backfeed can be quite handy too. I wrote up a tutorial for making up a Raspberry Pi Laptop using the Motorola Atrix Lapdock, and by backfeeding the Pi with usb power you can do the whole thing solder free.
I’ve just been using a rather cheap StarTech ethernet adaptor on my Model A for now, and ssh’ing into it. I just wanted the ability to run it from something like a solar panel for longer term datalogging.
Pingback: Automatic Raspberry Pi board revision detection: model A, B1 and B2 #piday #raspberrypi @Raspberry_Pi « adafruit industries blog
Pingback: My post about board revisions seems to have been quite popular | Raspberry Alpha Omega
Just including a Java code example on obtaining the board revision:
System.out.println("Board Revision: " +
com.pi4j.system.SystemInfo.getRevision());
Full example at:
http://pastebin.com/GXgbVVDc
More detailed example at:
http://pi4j.com/example/system-info.html
Thanks, Robert
Interesting info, thanks! (found a link to here from a hidden comment on http://elinux.org/RPi_HardwareHistory )
Why do your examples read values from /proc/cmdline ? I thought the official way was by reading values from /proc/cpuinfo ? http://www.raspberrypi.org/archives/1929
AFAIK reading /proc/cpuinfo will work on all Linux versions, but your /proc/cmdline version will only work with later versions of the firmware in /boot ?
I guess I justify using /proc/cmdline because it seems a bit smaller and simpler to parse. Ideally something this important should have its own pseudo file, than all this would not be necessary.
Pingback: A pair of new goodies | Raspberry Alpha Omega
Must dig out my alpha board and see what that says
Hey Dave
Do you really have a Raspberry Pi Alpha board? I’m starting a collection for my oldest son and looking for an alpha version. Would you be willing to part with it and if so what would be the cost. If I only had money when they were auctioning off the beta boards.
Pingback: MAKE | Which Pi do I have?
Pingback: Which Pi do I have? - IT Clips
Hi Frank,
Thanks for your work in getting all this information into one place. Have you thought about adding P6 data? I am also writing a shell script and during a cut and paste I noticed that your Model B data has 12C instead of I2C.
Here’s a slightly shorter shell script:
awk -v RS=” ” -F= ‘/boardrev/ { print $2 }’ /proc/cmdline
regards
Pingback: Elinizdeki Raspberry Pi Hangi Model Öğrenin | Raspberry Pi (RPi) Serüvenim
…alternatively:
cat /sys/module/bcm2708/parameters/boardrev
which displays the result in decimal rather than hexadecimal. To print it in hexadecimal (as seen in /proc/cpuinfo and /proc/cmdline) you can use:
printf “0x%X\n” `cat /sys/module/bcm2708/parameters/boardrev`
I guess your big table now needs to be updated for the Model B+ :-)
Yes. I have in my queue to do the same test for the following extra boards:
Red Chinese Model B
“Limited Edition” Blue Model B
CPU Module
Model B+
Not quite got around to it yet, though…
So, it appears I have an oddball board. The physical layout suggests it is an 0x3. It has no fuses, the P2 JTAG header and no mounting holes. But it has I2C-1. Running cat /proc/cmdline | awk -v RS=” ” -F= ‘/boardrev/ { print $2 }’ returns 0x0.
I have a 0x4 board. You said, let you know. :)
Thanks!
So does http://raspi.tv/2015/raspberry-pi-family-photo-update-the-red-b-and-256-mb-rev-2-b
:-)
cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 2.00
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xb76
CPU revision : 7
Hardware : BCM2708
Revision : 0010
Serial : 000000000a81b880
My rev shows 0x10
More up-to-date lists of revision codes can be found at:
http://elinux.org/RPi_HardwareHistory
http://raspi.tv/2015/updated-pi-family-photo-to-include-pi-2-b
Pingback: Raspberry Pi Modelleri | diyot.net
Slightly Improved Perl Script that has the table built in :-)
#!/usr/bin/perl
##
## DETECT Raspberry Pi Model and Display its info summary
##
open my $file, ‘<', "/proc/cmdline"; my $firstline = ; close $file;
$firstline =~ /bcm2708.boardrev=(0x[0123456789abcdef]*) /; $model = hex($1);
print “\nRaspberry Pi Model Information Tool\n”;
print “===================================\n\n”;
print “Detected RPI Hardware Model #: $1 ($model)\n\n”; $i=0;
print “RevNo Model Capabilities\n”;
print “===== ===== ============\n\n”;
while ($line = ){ $i++; if ($i eq $model){ print $line;} }
print “\n\n”;
__DATA__
RevNo Model Capabilities
0x2 B1 Original Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, (P2) JTAG pins, no mounting holes, Pin3=GPIO0, Pin5=GPIO1, Pin13=GPIO21, I2C-0
0x3 B1+ Original Model B with no polyfuses, 256MB RAM, Ethernet, two USB sockets, five LEDs, no mounting holes, Pin3=GPIO0, Pin5=GPIO1, Pin13=GPIO21, I2C-0
0x4 B2 Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5)
0x5 B2 Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5)
0x6 B2 Model B, 256MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5)
0x7 A Model A, 256MB RAM, no Ethernet, one USB socket, two LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, I2C-1, 8 extra IO pads (P5)
0x8 A Model A, 256MB RAM, no Ethernet, one USB socket, two LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, I2C-1, 8 extra IO pads (P5)
0x9 A Model A, 256MB RAM, no Ethernet, one USB socket, two LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, I2C-1, 8 extra IO pads (P5)
0xa – unknown
0xb – unknown
0xc – unknown
0xd B2 Rev2 Model B, 512MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5)
0xe B2 Rev2 Model B, 512MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5)
0xf B2 Rev2 Model B, 512MB RAM, Ethernet, two USB sockets, five LEDs, mounting holes, Pin3=GPIO1, Pin5=GPIO2, Pin13=GPIO27, 12C-1, 8 extra IO pads (P5)
##EOF##
Just in case the “paste” of the perl script didn’t work, email me and I will email you back the perl script file so that it can be properly posted. (I noticed that wordpress munged some stuff in the scripted). :-)
Quite simple:
cat /sys/firmware/devicetree/base/model