30

Is it possible to add RAM to a Raspberry Pi?

Peter Mortensen
  • 2,004
  • 2
  • 15
  • 18
Dortík
  • 403
  • 1
  • 4
  • 4

6 Answers6

29

No. There is no method by which RAM can be added to the Pi. See this discussion on the raspberrypi.org forums for more details, but basically the RAM and CPU are inextricably, inaccessibly connected. There is no physical method by which RAM could usefully be added, unless you want to start acid stripping the CPU chip, getting your microscope out and tracking down a micrometer scale soldering iron.

goobering
  • 10,730
  • 4
  • 39
  • 64
  • 4
    See here for a quick illustration of just how "inextricably connected" they are. – goldilocks Apr 29 '16 at 13:03
  • 3
    The Pi 2 has a separate RAM chip, and the tag on this question is for the Pi 2. Your answer is fine for earlier Pi versions, but does it apply to the 2? – Adam Davis Apr 29 '16 at 15:55
  • 3
    I'm looking into that - it certainly appears deeply implausible. The RAM chip is a 168 ball SMD, and is a little smaller than my thumbnail. I could say with reasonable certainty that it's going to be no fun whatsoever trying to get the old one off and the new one on. joan's answer perhaps covers this use case more accurately - even if you could physically deal with the chip, it wouldn't make any difference. Each SoC is already maxed out. – goobering Apr 29 '16 at 16:08
  • 3
    You could add an SSD and use it as swap. Next best thing. – Darth Egregious Apr 29 '16 at 17:23
  • 2
    While removing the memory chip would certainly be "no fun" it should doable with the right equipment and skills (and easier on the pi2 than the pi1) . The real issue is that the SoC can't support anything bigger. – Peter Green Apr 30 '16 at 04:47
12

No.

Generally each Pi model has already been fitted with the maximum amount of RAM supported.

Some early model B's only had 256MB and could have had 512MB instead. However there would be no way to update the RAM chip without destroying the board (unless you had a special laboratory).

joan
  • 71,024
  • 5
  • 73
  • 106
5

On a 256MB Pi it should theoretically be possible to replace the chip with a 512MB one but it would not be easy. You would have to carefully heat up the PoP stack and then somehow seperate processor from ram chip. Then cleanup the mess of old balls and solder down the new ram chip.

Theres also the question of whether the firmware would cope, 512MB models have different ID codes burned into the OTP on the SoC from 256MB models and i'm not sure if the boot code would work properly if things didn't match.

On 512MB BCM2835 based pis no upgrade is possible, the memory controller was designed to support 1GB but there was a bug that stopped it working properly at that size.

On The raspberry pi 2 Mdoel B and raspberry pi 3 model B 1GB is the limit, the design of the bus strucure and memory controller in the Soc simply doesn't support more.

If we see a 512MB BCM2837 based Pi (e.g. a Raspberry pi 3 model A) then I expect an upgrade to 1GB will be theoretically possible but again BGA rework would be needed (though you wouldn't have the fun of PoP) and I don't know if there would be firmware issues.

Peter Green
  • 6,476
  • 1
  • 19
  • 24
3

If the SoC could support more, the designers would probably have included more memory, as others pointed out. There is a much more important reason, though: cost control.

The price difference, for that kind of part, between 512M and 1G is under USD 1; both are around USD 5. Even an 8G IC in that category is around USD 14, so you might think, big deal, up the price a bit. It's not that simple.

The 3 retails for USD40; its BOM is probably under $15, so even an extra dollar would significantly impact the retail price, percentage-wise. And although some people might buy a more expensive pi for more money, merely making two versions available increases costs (design, testing, distributing, stocking, etc.), and your $40 1G model might have to sell for $45 instead. You and I might not care, but that does make a big difference to the educational market, at which the Pi is primarily aimed.

Also, when you work with a constrained budget, you have to make decisions over what to include. I, for one, am a lot happier about having wifi and bt on the 3 than I would be with extra memory. Your experience my vary, but so far I've never needed more memory, but everything I've used the pi for needs WiFi, so saving me $5 on a wifi dongle was a choice I like.

If you absolutely need more memory than that, there are other (more expensive) options around!

JayEye
  • 1,898
  • 11
  • 18
3

You can't add RAM to a raspberry pi but raspberry pi clusters are another thing

Check : http://www.zdnet.com/article/build-your-own-supercomputer-out-of-raspberry-pi-boards/

UPDATE:

Since someone requested, I will summarize the link above. Although I myself is not familiar with the details, it seems that it is possible to "connect" raspberry Pi(s).

"Kiepert ran the High Performance Linpack (HPL), the standard supercomputer benchmark on his home-made computer and found that his RPiCluster with its 32 Broadcom BCM2708 ARM11 processors running are 1GHz and 14.6GB of usable RAM turned in a HPL peak performance of 10.13 GFLOPS"

  • Welcome to Raspberry Pi! Whilst this may theoretically answer the question (in fact, however, the answer is only tangential to the question), it would be preferable to include the essential parts of the answer here, and provide the link for reference. – Ghanima Apr 30 '16 at 07:30
2

If you only need more memory to work and you run a Linux Distribution it is possible enlarge the swap. For this follow the instructions here http://www.thegeekstuff.com/2010/08/how-to-add-swap-space/. On my Rasp I found a swapfile her /var/swap but this is only 100 MB. So I replaced it with a bigger one. Now my Rasp has 1 GB RAM and 4 GB swap.

The speed decreases if the swap is really needed. In normal operation this makes no effect to the performance. Take a look here en.wikipedia.org/wiki/Swappiness for further information. This solution should use if you need Memory for short time or memory peaks. Swapping to the SSD decreases the lifetime of the SSD. Remind, that swapping is not intended to enlarge the memory for normal operation use.

If you permanently look for more RAM and speed you should take a look here http://www.digitaltrends.com/computing/c2-offers-competitive-specs-to-raspberry-pi/.


Regarding to the discussion below here some example use cases, in which I would prefer swapping rather than changing hardware:

  1. Build software on the target. Here there are two possibilities:

  2. Using a single core to reduce the amount of needed memory. In my example this leads to a peak memory usage of 370 MB by an elapsed time of 9h 45min.

  3. Using parallel build. In my example this leads to an peak memory usage of 1400 MB by an elapsed time of 4h 30min. But in nearly 98% of this time the used memory is below 1024 MB.

  4. An application with an heavy initialisation process: Then it is known that the main part of the application needs less than existing RAM but the initialisation routine - which occurs only once a program life time - has some bigger memory peaks, swapping is an appropriate way to handle the need of memory.

To examine the hardware requirements you can use:

/usr/bin/time -v <program invocation>

this gives you these information

Command being timed: "program invocation"
User time (seconds): 33164.02
System time (seconds): 1560.20
Percent of CPU this job got: 98%
Elapsed (wall clock) time (h:mm:ss or m:ss): 9:45:12
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 379092
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 354
Minor (reclaiming a frame) page faults: 47740772
Voluntary context switches: 1049855
Involuntary context switches: 482091
Swaps: 0
File system inputs: 170240
File system outputs: 3477064
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

Deteiled steps to add swap

  1. Create a swapfile of the desired size (here 32 GB) - sometimes a swapfile /swapfile already exits, so I name it swapfile2
    # dd if=/dev/zero of=/swapfile2 bs=1G count=32
    
  2. Give it new rights
    # chmod 600 /swapfile2
    
  3. make this file a swap file
    # mkswap /swapfile2
    
  4. enable it
    # swapon /swapfile2
    
  5. check the new swap
    $ swapon -s
    Filename    Type  Size      Used  Priority
    /swapfile   file  1054428   0     -1
    /swapfile2  file  33554428  0     -2
    
  6. If it is required to be permanently added, add the new swapfile to the /etc/fstab
    # nano /etc/fstab
    
    and add the line
    /swapfile2   none  swap  sw  0  0
    
Alex44
  • 129
  • 4
  • 1
    The RPi is already slow. Letting it swap will make it even slower. – Thomas Weller Aug 25 '16 at 23:00
  • So far so right. But in some cases Memory is more important than speed. For me for example: I have to build a large amount of sources and the build rips because there are not enough Memory. So I enlarge the swap. And the speed only decreases if the swap is really needed. In normal operation this makes no effect to the performance. Take a look here https://en.wikipedia.org/wiki/Swappiness for further information. – Alex44 Aug 26 '16 at 11:23
  • Do you really need to build on the RPi itself? Don't you want to cross compile on a faster system? – Thomas Weller Aug 26 '16 at 15:31
  • It's a question of the performance of the application at the end. In case of a real time application it makes a different to use a crossbuild-essential-armel or the compiler of the shelf on the target device. But in respect to the build performance it can be make sense to cross build of course. – Alex44 Aug 26 '16 at 16:17
  • This is a good answer -- you made the case to me and I'm not a fan of swap. Although it's not a precise answer to the question, it probably has more pragmatic value to more people than some of the others... – goldilocks Aug 26 '16 at 20:36