GithubHelp home page GithubHelp logo

andrewfrommelbourne / raspberry_pi_revision Goto Github PK

View Code? Open in Web Editor NEW
32.0 14.0 8.0 72 KB

C code to decode the Revision: field of /proc/cpuinfo on the Raspberry Pi

License: MIT License

Makefile 1.46% C 98.54%

raspberry_pi_revision's Introduction

raspberry_pi_revision

C function to decode the Revision: field of /proc/cpuinfo on the Raspberry Pi.

Known revisions

The file /proc/cpuinfo contains a line such as:-

Revision : 0003

Prior to Raspberry Pi 2

that holds the revision number of the Raspberry Pi. Known revisions (prior to the Raspberry Pi 2) are:

Revision Model PCB Rev Memory Manufacturer
0000
0001
0002 B 1 256 MB Egoman
0003 B 1 256 MB Egoman
0004 B 2 256 MB Sony UK
0005 B 2 256 MB Qisda
0006 B 2 256 MB Egoman
0007 A 2 256 MB Egoman
0008 A 2 256 MB Sony UK
0009 A 2 256 MB Qisda
000a
000b
000c
000d B 2 512 MB Egoman
000e B 2 512 MB Sony UK
000f B 2 512 MB Egoman
0010 B+ 1 512 MB Sony UK
0011 compute 1 512 MB Sony UK
0012 A+ 1 256 MB Sony UK
0013 B+ 1 512 MB Embest
0014 compute 1 512 MB Embest
0015 A+ 1 256 MB Embest
0015 A+ 1 512 MB Embest

If the Raspberry Pi has been over-volted (voiding the warranty) the revision number will have 100 at the front. e.g. 1000002.

Raspberry Pi 2 / Model Zero

With the release of the Raspberry Pi 2, there is a new encoding of the Revision field in /proc/cpuinfo. The bit fields are as follows

FEDC BA98 7654 3210 FEDC BA98 7654 3210
HG FEEE DDDD CCCC BBBB BBBB AAAA
1098 7654 3210 9876 5432 1098 7654 3210
# bits contains values
A 00-03 PCB Revision (the pcb revision number)
B 04-11 Model name A, B, A+, B+, B Pi2, Alpha, Compute Module, unknown, Pi3, Zero, Compute Module 3, unknown, Zero W, Pi3+, 3A+, unknown, Compute Module 3+, Pi4, Zero 2 W, Compute Module 4, 400, Compute Module 4S, unknown, Pi5
C 12-15 Processor BCM2835, BCM2836, BCM2837, BCM2711, BCM2712
D 16-19 Manufacturer Sony UK, Egoman, Embest, Sony Japan, Embest, Stadium
E 20-22 Memory size 256 MB, 512 MB, 1024 MB, 2048 MB, 4096 MB, 8192 MB
F 23-23 encoded flag (if set, revision is a bit field)
G 24-24 waranty bit (if set, warranty void - Pre Pi2)
H 25-25 waranty bit (if set, warranty void - Post Pi2)

Also, due to some early issues the warranty bit has been move from bit 24 to bit 25 of the revision number (i.e. 0x2000000).

e.g.

Revision : A01041

A - PCB Revision - 1 (first revision)
B - Model Name - 4 (Model B Pi 2)
C - Processor - 1 (BCM2836)
D - Manufacturer - 0 (Sony UK)
E - Memory - 2 (1024 MB)
F - Endcoded flag - 1 (encoded cpu info)

Revision : A21041

A - PCB Revision - 1 (first revision)
B - Model Name - 4 (Model B Pi 2)
C - Processor - 1 (BCM2836)
D - Manufacturer - 2 (Embest)
E - Memory - 2 (1024 MB)
F - Endcoded flag - 1 (encoded cpu info)

Revision : 900092

A - PCB Revision - 2 (second revision)
B - Model Name - 9 (Model Zero)
C - Processor - 0 (BCM2835)
D - Manufacturer - 0 (Sony UK)
E - Memory - 1 (512 MB)
F - Endcoded flag - 1 (encoded cpu info)

Revision : A02082

A - PCB Revision - 2 (second revision)
B - Model Name - 8 (Model B Pi 3)
C - Processor - 2 (BCM2837)
D - Manufacturer - 0 (Sony UK)
E - Memory - 2 (1024 MB)
F - Endcoded flag - 1 (encoded cpu info)

Revision : A52082

A - PCB Revision - 2 (second revision)
B - Model Name - 8 (Model B Pi 3)
C - Processor - 2 (BCM2837)
D - Manufacturer - 5 (Stadium)
E - Memory - 2 (1024 MB)
F - Endcoded flag - 1 (encoded cpu info)

Revision : B03111

A - PCB Revision - 1 (first revision)
B - Model Name - 17 (Model B Pi 4)
C - Processor - 3 (BCM2711)
D - Manufacturer - 0 (Sony UK)
E - Memory - 3 (2048 MB)
F - Endcoded flag - 1 (encoded cpu info)

raspberry_pi_revision's People

Contributors

andrewfrommelbourne avatar milhousevh avatar markusrudolf avatar

Stargazers

Dhiru Kholia avatar Eric Wiessner (KI7POL) avatar C64Emulator avatar Timon avatar  avatar Flávio Lisbôa avatar David MiZak avatar Emanuele Barsanti avatar aleks avatar  avatar McKenzie Long avatar Ton Smets avatar Vadims Tihomirovs avatar Herry avatar Woojay Poynter avatar Vladimir Suravtsov avatar matteyeux avatar gonzoid avatar Yukimasa Sugizaki avatar Panagiotis Atmatzidis avatar Mathew Mrosko avatar Easion avatar Manuel Pietschmann avatar Ryan Coe avatar Lars Tørnes Hansen avatar Jamie Nuttall avatar Mārtiņš Možeiko avatar David Thorpe avatar Neil Kolban avatar  avatar  avatar  avatar

Watchers

Mathew Mrosko avatar Lars Tørnes Hansen avatar Joseph Moschini avatar  avatar Manuel Pietschmann avatar  avatar James Cloos avatar  avatar  avatar  avatar Jamie Nuttall avatar C64Emulator avatar SteveA avatar  avatar

raspberry_pi_revision's Issues

No revision match for new Raspberry Pi 4 Model B Rev 1.5

Hi Andrew,

I find your little programs quite useful, am using them since 2017 :-)

Just wanted to let you know that in the version of current master, ./table does not show a quite new revision of a current RP4 model.
Moreover, there is a mismatch between /proc/cpuinfo and ./test.

Output of /proc/cpuinfo is

Hardware        : BCM2835
Revision        : c03115
Serial          : 10000000f8b73778
Model           : Raspberry Pi 4 Model B Rev 1.5

Output of ./test does not match CPU and model name of CPU info, but correctly reports manufacturer and RAM

memory: 4096 MB
processor: Broadcom BCM2711
i2cDevice: /dev/i2c-1
model: Raspberry Pi 4 Model B
manufacturer: Sony UK
pcb revision: 5
warranty void: no
revision: c03115
peripheral base: 0xFE000000

I have got viewed the code, but did not get through it deep enough to feel save to extend it by the required data without breaking sth.
Otherwise I would have tried and put a pull request...

add additional information (e.g. architecture: ARMv6 (32 Bit), ARMv7 (32 Bit), ARMv8 (64 Bit) or GPU-Type: VideoCore IV, VideoCore VI)

HI,
great tool. Fast updates in case of new board revisions. I appreciate your work.

I have a feature request: Is it possible to add additional information, depending on CPU?
Examples:

  • architecture: ARMv6 (32 Bit) | ARMv7 (32 Bit) | ARMv8 (64 Bit)
  • CPU-Type: ARM1176JZF-S | Cortex-A53 | Cortex-A7 | Cortex-A53 | Cortex-A72
  • GPU-Type: VideoCore IV, VideoCore VI
  • ...
    Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.