<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.2" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>LeafLabs Garden &#187; Topic: External SRAM</title>
		<link>http://forums.leaflabs.com/topic.php?id=16390</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:14:18 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.2</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>http://forums.leaflabs.com/search.php</link>
		</textInput>
		<atom:link href="http://forums.leaflabs.com/rss.php?topic=16390" rel="self" type="application/rss+xml" />

		<item>
			<title>pyrohaz on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390&amp;page=2#post-33517</link>
			<pubDate>Thu, 26 Sep 2013 13:34:55 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">33517@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ah! Sorry, my mistake there. Darn, I think i'm definitely going to have to reconsider this one. Thanks as per guys.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390&amp;page=2#post-32840</link>
			<pubDate>Wed, 25 Sep 2013 19:31:55 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">32840@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;pyrohaz - 52bytes, every 20us? That is 2.6MByte/s, which would require, at least 20.8MHz. &#60;/p&#62;
&#60;p&#62;An Arduino's clock is only 16MHz.&#60;/p&#62;
&#60;p&#62;A single read or write instruction is 2 cycles, and, I think, a jump or branch is 2 cycles, so 6 cycles to read and write one byte in a loop. 16MHz / 6cycles/byte = 2.67MB/s at best (if you could solve getting the data out of the Arduino)&#60;/p&#62;
&#60;p&#62;I think the requirement is teetering on the wrong side of the brink of impossible :-(
&#60;/p&#62;</description>
		</item>
		<item>
			<title>ala42 on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390&amp;page=2#post-32839</link>
			<pubDate>Wed, 25 Sep 2013 19:27:01 +0000</pubDate>
			<dc:creator>ala42</dc:creator>
			<guid isPermaLink="false">32839@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Do your math again. 52 bytes in 20µs is 2.6 bytes/µs or 20.8MHz in SPI.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pyrohaz on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390&amp;page=2#post-32836</link>
			<pubDate>Wed, 25 Sep 2013 19:17:19 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">32836@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi gbulmer, cheers for the fast reply. Currently, i'll need to send 52 bytes per transfer. I'm looking at transfer rates of every roughly every 20us. With constant transfers, I think this would require a bit clock of about 4MHz. DMA into a circular buffer sounds like a perfect idea. The Arduino supports SPI at 8MHz max. In slave mode, does the maple care about the clock frequency aslong as its not too high?&#60;/p&#62;
&#60;p&#62;Since I want to send 52 bytes at once, as long as the circular buffer is 52 entries long, every time data is written, surely it will just update and write over it?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390&amp;page=2#post-32509</link>
			<pubDate>Wed, 25 Sep 2013 10:37:31 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">32509@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;pyrohaz - You still haven't mentioned how fast this must go.&#60;/p&#62;
&#60;p&#62;It looks like a serial buffer, and not random access. A serial stream of data is much easier than random access.&#60;/p&#62;
&#60;p&#62;So, assuming it isn't too fast, and if that description covers the major requirements, then IMHO it isn't worth the complexity of a separate memory chip.  &#60;/p&#62;
&#60;p&#62;IMHO it would be easier to build and debug using have the Arduino as an SPI master, and a Maple SPI port be a slave.&#60;/p&#62;
&#60;p&#62;It sounds straightforward; push data from the Arduino to the Maple. The Maple buffers the data in memory, and later consumes the data from the buffer.&#60;br /&#62;
It sounds like there is no need for a &#34;memory address&#34;. It sounds like a stream of data.&#60;br /&#62;
How big is each item of data?&#60;/p&#62;
&#60;p&#62;Access would be asynchronous in the sense that the Maple would 'catch' data from SPI as it arrives using an interrupt or DMA, which would put it into an in-memory buffer on the Maple,&#60;/p&#62;
&#60;p&#62;The main program loop on the Maple would retrieve data from the in-memory buffer. &#60;/p&#62;
&#60;p&#62;So, as long as the Maple isn't running more slowly than the data is received, then it is SPI to SPI comms.&#60;br /&#62;
Exactly the same thing could be done using a UART.&#60;br /&#62;
IMHO I2C is more complex than needed, and is an order of magnitude slower.&#60;/p&#62;
&#60;p&#62;So the Arduino side would be:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;void loop(){
  Send(Data);
  //Gather data
  Data = X;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;The Maple side would be:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;SPI-interrupt() {
   read Data from SPI buffer
   if buffer is full {
     set a flag for the main oop
     do the right thing with Data
   } else {
      put Data into buffer,
      update buffer so loop can detect that data is available.
   }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;loop would use a function which gets the next Data item from the buffer.&#60;/p&#62;
&#60;p&#62;The details of how to do it very much depends on what you want to do if data arrives too fast, and what you want to do if there is no data ready to be processed.&#60;/p&#62;
&#60;p&#62;There is some code in libmaple to handle circular buffers, but it isn't too hard to write. There are probably many implementations on the interwibble.&#60;br /&#62;
A circular buffer keeps track of both the start of the saved Data, and the end. This would allow the interrupt routine to detect if the buffer is full, and the main loop to detect if it is empty.&#60;/p&#62;
&#60;p&#62;Trying to use a shared memory chip will need a mechanism to communicate where the start and end of data are too, so your pseudo-code is glossing over a potentially hard problem to solve.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pyrohaz on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390#post-32453</link>
			<pubDate>Wed, 25 Sep 2013 09:16:31 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">32453@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hey, cheers for the replies, I don't think I explained enough.&#60;/p&#62;
&#60;p&#62;What i'm looking to do is have an arduino place data in some memory every x milliseconds over and over again and have the maple able to access that data even while the arduino is writing, hopefully this explains what I meant by asynchronously, kind of like the maple's normal memory just accessible by an arduino too. A really simple piece of pseudocode would be like this:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;void loop(){
  MemInc++;
  WriteToMemory(MemInc, Data);
  if(MemInc&#38;gt;MemMax){
    MemInc = 0;
  }
  //Gather data
  Data = X;
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Where MemInc is the address of the memory, and data is the data to be written to that point.&#60;/p&#62;
&#60;p&#62;On the maple, it would sequentially access the memory and fill an array with this data. the maple wouldn't need to write to the memory.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;void loop(){
  ArrayInc++;
  Array[ArrayInc] = ReadMemory(ArrayInc);
  if(ArrayInc&#38;gt;MemMax){
    ArrayInc = 0;
  }
}&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I hope that this clears it up a bit, I could just do the whole task synchronously but obviously this would be synchronizing the arduino data writes and the maple data reads which as i'm sure you can imagine is more work. If there aren't any ram chips that can be simultaneously read and written, this might be my only option!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390#post-31750</link>
			<pubDate>Mon, 23 Sep 2013 16:50:39 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">31750@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;pyrohaz, mlundinse - sorry for not finishing off my comment &#60;em&#62;&#34;So you're giong to either have to construct that interface with some other peripheral interface + software, or ...&#34;&#60;/em&#62;. Let me try to finish it.&#60;/p&#62;
&#60;p&#62;I was thinking of mentioning I2C memory. That does have the advantage of bus-like protocol definition.&#60;br /&#62;
Then I thought, if one of the devices is an Arduino, then the throughput is sufficiently low that it might be easier to use the Maple as the memory. I.e. don't use an I2C memory chip. Instead, have the Maple act as the I2C memory. This might be a handy 'soft' approach, and might be relevant, depending on the hardware debugging tools available.&#60;/p&#62;
&#60;p&#62;Then I thought, why bother with emulating I2C?&#60;br /&#62;
It would be even easier to emulate an SPI memory, and that's adequate if only two boards are sharing the 'pool'.&#60;br /&#62;
One board is the SPI master, and the other the SPI-slave and has the pool of memory. &#60;/p&#62;
&#60;p&#62;The same idea (of one emulating shared memory) could be implemented using a UART. In fact anything that is convenient and quick enough.&#60;/p&#62;
&#60;p&#62;Using one board as an I2C/SPI/UART/... memory emulator could be straightforward to debug.&#60;/p&#62;
&#60;p&#62;All those use serial comms in some form, so, alternatively, if throughput is important, one could use GPIO pins to give a wider bus, and trigger transfer of any width that is convenient using DMA. This might 'swamp' an Arduino, but a couple of Maples could be connected this way.&#60;/p&#62;
&#60;p&#62;Of course these are asymmetric.&#60;br /&#62;
IMHO, if that matters, then we need to know more about the constraints.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>mlundinse on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390#post-31744</link>
			<pubDate>Mon, 23 Sep 2013 14:40:45 +0000</pubDate>
			<dc:creator>mlundinse</dc:creator>
			<guid isPermaLink="false">31744@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;If the memory bandwith is relatively small something like a I2C RAM could be used.&#60;br /&#62;
Both processors will then be masters on the bus and that would need some work&#60;br /&#62;
since I dont think the current I2C drivers can handle that.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>gbulmer on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390#post-31741</link>
			<pubDate>Mon, 23 Sep 2013 14:13:45 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">31741@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;pyrohaz - would you give us a bit more context?&#60;/p&#62;
&#60;p&#62;There are memory chips which do have multiple interfaces.&#60;/p&#62;
&#60;p&#62;However, Arduino, Maple mini, and  Maple do not have an external memory interface.&#60;br /&#62;
So you're going to either have to construct that interface with some other peripheral interface + software, or use other MCU's.&#60;/p&#62;
&#60;p&#62;Some of the STM32F chips have external memory interfaces, but AFAIK, they are all designed to be 'private &#38;amp; synchronous'. Maybe someone else knows enough to help&#60;/p&#62;
&#60;p&#62;The sort of things that determine feasibility are the peak bandwidth, maximum latency, size of memory, ... needed. So if you can give us information around those sort of numbers, someone might be able to help.&#60;/p&#62;
&#60;p&#62;If bandwidth between CPUs is an issue, I'd suggest something that is 'way over the top', like an Odroid.&#60;br /&#62;
If it really didn't need that sort of 'oomph', maybe something like the NXP LPC4300 which has a Cortex-M4 and Cortex-M0 on the same chip, with shared memory access, and synchronisation mechanisms.&#60;br /&#62;
&#60;a href=&#34;http://www.nxp.com/products/microcontrollers/cortex_m4/series/LPC4300.html&#34; rel=&#34;nofollow&#34;&#62;http://www.nxp.com/products/microcontrollers/cortex_m4/series/LPC4300.html&#60;/a&#62;&#60;br /&#62;
I am not sure if this is 'real' enough for non-corporate developers; I don't think I've seen a development board for it, so it is either hard to get or expensive.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>pyrohaz on "External SRAM"</title>
			<link>http://forums.leaflabs.com/topic.php?id=16390#post-31740</link>
			<pubDate>Mon, 23 Sep 2013 12:20:53 +0000</pubDate>
			<dc:creator>pyrohaz</dc:creator>
			<guid isPermaLink="false">31740@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;/p&#62;
&#60;p&#62;I'm designing a project using either two maples or a maple and an arduino. I'm looking at having a &#34;memory pool&#34; which is accessible by both processors asynchronously. Is there some form of memory chip that can be written to and read from simultaneously?&#60;/p&#62;
&#60;p&#62;Cheers, Harris
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
