SRAM Expansion Shield for Arduino Mega

lagrangianpoint.net is pleased to announce the new SRAM Expansion Shield for Arduino Mega.

Have you been developing a project that required a lot of SRAM and blown the heap/stack? Maybe you just to prefer to write applications in C++ and also use the STL ports available out there. Those "unexplained" errors are not easy to debug! This shield could therefore be the solution to your needs.

Features include:

  • 448 kB SRAM available through the Arduino Mega extended digital interface.
  • Based on the design by Andy Brown, supported by the xmem software library.
  • Available in both kit (absolutely everything supplied) and PCB versions.

Check out the product page for more information and how to purchase. There's a Tech Note available explaining some of the background plus links to Andy Brown's original implementation.

I just ordered one piece and already I'm looking forward to it!

Do you have an example how to address this extra memory?

e.g. if I want to fill an array of 65 000 integers with analog samples from analogRead(A0);

How's that compare to the Rugged Circuits SRAM shields? http://www.ruggedcircuits.com/html/quadram.html http://www.ruggedcircuits.com/html/megaram.html

Rugged Circuits is cheaper

K5CZ: I just ordered one piece and already I'm looking forward to it!

So, my kit is now complete (many thanks to EverMAX s.r.o. for soldering SMD parts!!!) and now comes the time to test the expansion.

*** EDIT *** But first problem is here: under IDE 1.5.2 adding #include "xmem.h" causes multiple definition of `malloc' As a beginner I am not able to solve this problem. *** under IDE 1.0.5, 1.5.3 and 1.5.4 compilation passes without errors ***

And second question is: how to print current size of unused memory (free space for call stack and free space for heap)

And last question is: Calling xmem::begin(true); allocates memory like that?

AVR Map layout of RAM discovered.

There is a functionality in at least 1 compiler I am aware of called "addressmod"

Part of the IEEE Embedded C standard (ISO/IEC TR 18037), addressmod allows you to create custom qualifiers to create variables in any kind of memory device. The identifier can be used with any data types, including structures, unions, arrays, and pointers.

Maybe some compiler experts/gurus may implement that into the compiler, so we can use an external memory space fully transparently within the C code then.

pito: There is a functionality in at least 1 compiler I am aware of called "addressmod"

Part of the IEEE Embedded C standard (ISO/IEC TR 18037), addressmod allows you to create custom qualifiers to create variables in any kind of memory device. The identifier can be used with any data types, including structures, unions, arrays, and pointers.

Maybe some compiler experts/gurus may implement that into the compiler, so we can use an external memory space fully transparently within the C code then.

Infrastructure done. :) ]:)

Well, I and two other people implemented the machine independent support in the GCC 4.5 time frame for the Cell processor. Shortly afterwards the AVR compiler switched to use it for PROGMEM. I imagine if the AVR developer has the cycles to do it, it could be added for the external SRAM.

Of course given, the compiler shipped with current Arduino IDE's is still 4.3.2, it is kind of a moot point for most Arduino users.

Interesting! For example the compiler I know does it in following manner (or it claims it works such way):

..
_read - an user defined function for reading n-bytes from an external memory
_write - an user defined function for writing n-bytes into an external memory
..
addressmod(MY_EXT_RAM, _read, _write, 0x000000, 0x3FFFFF);
..
MY_EXT_RAM  long my_array_1[30000];
MY_EXT_RAM  char my_array_2[100000];
MY_EXT_RAM  float x,y,z;
..

I did some simple tests in past (with an external SPI FRAM) and it worked somehow. The var access times depend on _read/_write functions to the hw (ie. SPI, or bitbanging, etc..).

Does anyone know of any Mega2560 RAM expansion boards still available, both the rugged circuits board (“on backorder indefinitely”) and the lagrangianpoint.net board (“out of stock”) are currently unavailable.

I’m looking for a small number to boards (<10) and just need around 64K, but will take bigger ones if need be. I guess failing that, i’ll do a bit of a re-write and port to the Due…

MarkB

The ruggedcircuit removed this expansion from store, but other store have it for 46€ :confused: http://lagrangianpoint.net/en/prebuiltmodules/arduino-mega-sram-expansion-shield-pre-built

Up this topic.

I am designed the next board with ATmega2560-16au microcontrollers and design SRAM expansion board for it without using any addition pins. Have the gerber and other files from kicad.

The expansion SRAM board has 3 address window in 64k AVR-space sizing:

  1. “common” window has addresses 0 - 32k and be closed by internal SRAM below 0x2200;
  2. “low-pages” window has addresses 32k-48k. In this window can be see 15 pages about 16 k bytes size. 256kbytes total;
  3. “hight-pages” window has addresses 48k - 64k. In this window can be see own 15 pages with 16 kbytes size each. own 256kbytes total.

Using chip HMM628512ALFP-5 it can work without any additional wait states.

Now I am working on the integration of the Board in Arduino ID 1.8.5, including the placement of data arrays in additional memory using the compiler.

Is the interesting it? :slight_smile:

mega2560-a.jpg