6

To enhance my bash script decoding the Revision returned by cat /proc/cpuinfo
I'd like to know what the RaspBerry Pi 4 codes for ModelName,Processor and Memory are.
(my own one is still underway)

Sample sanitized output:

LotPings@LegoBlack:~ $ ./pirevision.sh
Serial          =  00000000a3123456
MAC-address(es) =  b8:27:eb:12:34:56 b8:27:eb:ab:cd:ef
Revision        =  a020d3
PCBRevision     =  3
ModelName       =  3B+
Processor       =  BCM2837
Manufacturer    =  Sony UK
MemorySize      =  1024 MB
EncodedFlag     =  revision is a bit field
WarrantyVoidOld =  no
WarrantyVoidNew =  no

EDIT: The documentation was updated in the meantime,
so the script should output official information now.

#!/bin/bash
## resources:
## https://github.com/AndrewFromMelbourne/raspberry_pi_revision
## http://elinux.org/RPi_HardwareHistory#Board_Revision_History
## https://www.raspberrypi.org/documentation/hardware/raspberrypi/revision-codes/README.md
## https://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/revision-codes/README.md

Revision=$(cat /proc/cpuinfo | grep 'Revision' | awk '{print $3}')
Serial=$(cat /proc/cpuinfo|grep 'Serial'|awk '{print $3}')
MACs=$(ifconfig | grep '[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:'|awk '{print $2}')
echo 'Serial          = ' $Serial
echo 'MAC-address(es) = ' $MACs
echo 'Revision        = ' $Revision
Encoded=$((0x$Revision >> 23 & 1))

if [ $Encoded = 1 ]; then
    PCBRevision=('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15')
    ModelName=('A' 'B' 'A+' 'B+' 'Pi2B' 'Alpha' 'CM1' 'unknown' '3B' 'Zero' 'CM3' 'unknown' 'Zero W' '3B+' '3A+' 'internal use only' 'CM3+' '4B' '18 ?' '19 ?' '20 ?')
    Processor=('BCM2835' 'BCM2836' 'BCM2837' 'BCM2711' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15')
    Manufacturer=('Sony UK' 'Egoman' 'Embest' 'Sony Japan' 'Embest' 'Stadium' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15')
    MemorySize=('256 MB' '512 MB' '1024 MB' '2048 MB' '4096 MB' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15')
    EncodedFlag=('' 'revision is a bit field')
    WarrantyVoidOld=('no' 'warranty void - Pre Pi2')
    WarrantyVoidNew=('no' 'warranty void - Post Pi2')

    echo 'PCBRevision     = ' ${PCBRevision[$((0x$Revision&0xf))]}
    echo 'ModelName       = ' ${ModelName[$((0x$Revision>>4&0xff))]}
    echo 'Processor       = ' ${Processor[$((0x$Revision>>12&0xf))]}
    echo 'Manufacturer    = ' ${Manufacturer[$((0x$Revision>>16&0xf))]}
    echo 'MemorySize      = ' ${MemorySize[$((0x$Revision>>20&7))]}
    echo 'EncodedFlag     = ' ${EncodedFlag[$((0x$Revision>>23&1))]}
    echo 'WarrantyVoidOld = ' ${WarrantyVoidOld[$((0x$Revision>>24&1))]}
    echo 'WarrantyVoidNew = ' ${WarrantyVoidNew[$((0x$Revision>>25&1))]}
fi

Current Revision bit field explanation

# Bit NOs  3322 2222 2222 1111 1111 1100 0000 0000
# Decimal  1098 7654 3210 9876 5432 1098 7654 3210
# Fields   uuuu uuHG FMMM CCCC PPPP TTTT TTTT RRRR
#  WarrantyVoidNew/| |Mem Manu Proc ModelName PCB
#   WarrantyVoidOld/ |Siz fact                Rev
#          EncodedFlag
# 
#   bits  contains        values
# R 00-03 PCBRevision     ('0' '1' '2' '3' '4' '5' '6' '7' '8' '9' '10' '11' '12' '13' '14' '15')
# T 04-11 ModelName       ('A' 'B' 'A+' 'B+' 'Pi2B' 'Alpha' 'CM1' 'unknown' 'Pi3B' 'Zero' 'CM3' 'unknown' 'Zero W' 'Pi3B+' 'Pi3A+' 'internal use only' 'CM3+' '4B')
# P 12-15 Processor       ('BCM2835' 'BCM2836' 'BCM2837' 'BCM2711)
# C 16-19 Manufacturer    ('Sony UK' 'Egoman' 'Embest' 'Sony Japan' 'Embest' 'Stadium')
# M 20-22 MemorySize      ('256 MB' '512 MB' '1024 MB' '2048 MB' '4096 MB')
# F 23-23 EncodedFlag     ('' 'revision is a bit field')
# G 24-24 WarrantyVoidOld ('' 'warranty void - Pre Pi2')
# H 25-25 WarrantyVoidNew ('' 'warranty void - Post Pi2')
# u 26-31 unused
LotPings
  • 366
  • 1
  • 13

2 Answers2

4

My 1GB PI4B returns revision a03111.

$ cat /proc/cpuinfo
processor   : 0
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 1
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 2
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

processor   : 3
model name  : ARMv7 Processor rev 3 (v7l)
BogoMIPS    : 108.00
Features    : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32 
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part    : 0xd08
CPU revision    : 3

Hardware    : BCM2835
Revision    : a03111
Serial      : 1000000060e0fce7
$

Your script returns the following on my Pi4B.

Serial          =  1000000060e0fce7
MAC-address(es) =  dc:a6:32:03:fd:dc dc:a6:32:03:fd:dd
Revision        =  a03111
PCBRevision     =  1
ModelName       =  17 ?Pi4
Processor       =  3 ?BCM2711
Manufacturer    =  Sony UK
MemorySize      =  1024 MB
EncodedFlag     =  revision is a bit field
WarrantyVoidOld =  no
WarrantyVoidNew =  no
joan
  • 71,024
  • 5
  • 73
  • 106
  • Thanks for feedback Joan, so above scripts returns ModelName = 17 ?Pi4 and Processor = 3 ?BCM2711? – LotPings Jun 28 '19 at 15:37
  • 1
    @LotPings added the script output to answer. – joan Jun 28 '19 at 16:34
  • Interresting that the Serial starts with a one now and that the MAC prefix dc:a6:32 is now registered to Raspberry Pi Trading Ltd no longer to Raspberry Pi Foundation – LotPings Jun 28 '19 at 21:41
3

My 4GB model returns a different revision

root@raspberrypi:/home/pi# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 3 (v7l)
BogoMIPS        : 108.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd08
CPU revision    : 3

[repeated 3 more times]

Hardware        : BCM2835
Revision        : c03111
Serial          : 1000000076a314ff

Output of script

Serial          =  1000000076a314ff
MAC-address(es) =  dc:a6:32:04:0f:96 dc:a6:32:04:0f:97
Revision        =  c03111
PCBRevision     =  1
ModelName       =  4B
Processor       =  BCM2711
Manufacturer    =  Sony UK
MemorySize      =  4096 MB
EncodedFlag     =  revision is a bit field
WarrantyVoidOld =  no
WarrantyVoidNew =  no
Jeff Atwood
  • 141
  • 3
  • 2
    The c03111 rather than a03111 is because of the extra memory (the amount of memory is coded in bits 20-22 of the 32-bit revision value). – joan Jul 22 '19 at 10:01
  • I get the exact same outputs on my 4GB model too. – mehdix Oct 08 '19 at 09:33