2

I know that it is possible to write data in ROM(Read Only Memory).
But what about if I want to write data in RAM(Random Access Memory)?
Can I do it using "Arduino Uno R3"?
RAM is normally associated with volatile types of memory.

There are several examples about writing data in EEPROM as in a (Read Only Memory) which may have 8 pins.
In order to store values read from analog input 0 into the EEPROM we need to use the "EEPROM.write()" function.
These values will stay in the EEPROM when the board is turned off and may be retrieved later by another sketch.
ROM is a Non-volatile type memory.
SD card is also Non-volatile type of memory.
We know that there are few SD card shields for "Arduino Uno" and it is possible create your own shields.

But what about volatile types of memory?
what about if I want to write data in RAM like a "DDR SDRAM" or in a DDR3 memory which may have 240 pins instead of 8 pins?
So my question is is it possible to write data in "DDR SDRAM" using "Arduiono Uno R3"?
How? Where should I connect those 240 pins?

6
  • What is your eventual goal? What do you want to do with DDR3 that you couldn't accomplish with SRAM? Or with an SD card if you need a large storage?
    – JRobert
    Commented Jun 6, 2015 at 11:43
  • I think the OP wants to write to external memory (not the onboard RAM). @IremadzeArchil19910311 - please specify what sort of RAM you have in mind (part number). 240 pins? I hope you are joking. There are not 240 I/O ports on the Arduino. These are designed to plug into a PC or Mac. You can however get SPI or I2C RAM modules.
    – Nick Gammon
    Commented Jul 6, 2015 at 10:45
  • "So can any kind of SDRAM Shield help me to solve this problem?" You've only asked about a solution - DRAM - and haven't yet explained the problem you're trying to solve. If you could have DRAM, what would you do with it? Must it be DRAM or can you accept alternate ways to accomplish your goal?
    – JRobert
    Commented Jul 6, 2015 at 11:32
  • Even in the rare situations where external RAM could be remotely sensible, you are probably better off using SRAM than any flavor of DRAM like DDR, SDRAM, etc, as you are unlikely to use enough of it for the greater complexity of dynamic RAM over static RAM to be justified by the lower cost-per-bit. But really, for anything requiring this scale of memory, you should move beyond the Arduino to a more appropriate platform first. Commented Jul 6, 2015 at 22:29
  • i too have similar question, its useful in case you have uno refreshing page running of arduino uno, so if you tick the check box on auto refreshing page it we be unchecked on page reload, so best is to store the state on RAM , which would also ensure vale is reset in case we reboot uno . Commented Dec 11, 2016 at 17:40

3 Answers 3

3

DRAM of any kind requires a memory controller which is not present in any AVR device. Larger AVR devices such as the ATmega64A and ATmega128A do have an external memory bus that can be used for SRAM and MMIO.

5
  • So can any kind of SDRAM Shield help me to solve this problem? Do SDRAM Shields have this memory controller? Commented Jun 5, 2015 at 17:02
  • The Uno R3 does not have an external memory bus regardless. And performing MMIO to access paged DRAM will be painful at best. Commented Jun 5, 2015 at 17:06
  • In short, the Uno (or rather, the ATmega328) simply isn't designed for that kind of application. The new Zero might, with it's Cortex M0+ processor. Don't quote me on that, though... Commented Jun 5, 2015 at 17:59
  • The memory controller wouldn't be integrated into the core, so it would depend on which specific chip or family it uses. The SAM-D21 (Zero) doesn't have an external memory bus. The SAM3X8E (Due) has an external memory bus but no memory controller and doesn't seem to expose the entire bus via headers. The Sitara 335X (Tre) does have a memory controller, but it is only connected to the on-board DRAM. Commented Jun 5, 2015 at 19:03
  • OK! But what about "Arduino Mega"? Or what about "Arduino Due" which is an ARM device? Commented Jun 6, 2015 at 7:57
3

Your program is already using the on board RAM:

int a = 5; // This is RAM. Where did you think it goes? (This might go to a CPU Reg)
int a[5000]; // This is RAM

DDR3 RAMs require (typically) 1633 MHz clocks, and store gigabytes of data, not something you use with Arduino, which has a 16 MHz CPU.

If you need EXTRA (emphasis on extra) RAM, my first advice would be to refactor your project, and reduce processing on Arduino.

However, if must have more RAM, get SRAM. In most cases, DDR3 trade high maintenance for cost. Have a look here.

3
  • int a = 5; is in RAM only if declared at global scope. If it's a local variable, it is almost certainly assigned to CPU registers. There are exceptions though: if you take the address of the variable, or if there are not enough available registers, it will end in RAM, but this is uncommon. Commented Jun 6, 2015 at 10:18
  • How about recursion. This will almost certainly use stack, in memory.
    – xyz
    Commented Jun 6, 2015 at 10:28
  • Even with recursion, the variable is likely to be assigned to a register while “live”, and saved on the stack only for the duration of the recursive call. This may depend on how much use the variable has though, so you should disassemble if you want to know for sure for some particular recursive function. Commented Jun 6, 2015 at 11:15
1

The easiest way to read and write DDR SRAM would be to install it in a PC and write a serial server that allowed the Arduino to access the data by requesting it over the serial port.

Now although that is possible to do, the performance probably won't be great. So it might be worth looking into memory that interfaces over SPI or IIC, there are several ICs that you could use. Most of them would have libraries already available and you would be looking at about £1 per 256kbits.

But like it has been said above if you are looking at storing multi-GBs of data then you probably want SD cards. If the write speed is going to be a problem then look at multiplexing the data over many SD cards.

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.