<?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: SPI Loopback on maple</title>
		<link>http://forums.leaflabs.com/topic.php?id=220</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:19:15 +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=220" rel="self" type="application/rss+xml" />

		<item>
			<title>crenn on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220&amp;page=2#post-1645</link>
			<pubDate>Tue, 05 Oct 2010 14:12:50 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">1645@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Look at Pages 657-661, 693-698 and 701. That should have the majority of information you need.&#60;/p&#62;
&#60;p&#62;Poslatian, Hehe, might want to mention it in the documentation. That might be possible to do, I'm not sure if it will be a commonly used feature though.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DaemonMaker on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220&amp;page=2#post-1625</link>
			<pubDate>Tue, 05 Oct 2010 11:25:32 +0000</pubDate>
			<dc:creator>DaemonMaker</dc:creator>
			<guid isPermaLink="false">1625@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Crenn: Understandable. I should already have the page numbers but if you send me the ones you think I should look at it might help me identify what I'm doing wrong.&#60;/p&#62;
&#60;p&#62;Josheeg: My other device would be another Leaf Maple so yes it will generate a clock. I'm trying to setup several such that they can communicate with each other. The problem is that SPI slave mode isn't currently supported as Crenn pointed out so I have been trying to code it myself.&#60;/p&#62;
&#60;p&#62;Poslathian: Thanks for bumping this up but it's not really a big deal. I'm just trying to get more familiar with cortex m3 development and hey I would be thrilled to be able to contribute back to the project.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>poslathian on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220&amp;page=2#post-1607</link>
			<pubDate>Tue, 05 Oct 2010 08:57:53 +0000</pubDate>
			<dc:creator>poslathian</dc:creator>
			<guid isPermaLink="false">1607@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Ill consider this thread:&#60;br /&#62;
  feature request: spi slave mode.   And so it shall be bumped up the queue. Thanks! &#60;/p&#62;
&#60;p&#62;As for the speed issue, crenn is correct. SPI1 is faster, I suppose we could open up the SPI config interface a little more to allow more tweaking of the spi conf registers. What do you think?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josheeg on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1605</link>
			<pubDate>Tue, 05 Oct 2010 08:36:08 +0000</pubDate>
			<dc:creator>josheeg</dc:creator>
			<guid isPermaLink="false">1605@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Well DeamonMaker does your other device create the clock signal? If so then it is the master that is what that means in SPI. If that is the case the slave does something when the clock is triggered useualy shift data in or out. So that could be a hardware spi read that is also a write.&#60;br /&#62;
&#60;a href=&#34;http://arduino.cc/en/Reference/ShiftOut&#34; rel=&#34;nofollow&#34;&#62;http://arduino.cc/en/Reference/ShiftOut&#60;/a&#62;&#60;br /&#62;
shiftout might be useful&#60;br /&#62;
otherwise it is a read in.&#60;br /&#62;
The clock pin could be considered something you would want to interupt your maples program on they just came out with interupts for the arduino like maple language.&#60;br /&#62;
External interrupts (attachInterrupt()/detachInterrupt()) are implemented (see the external interrupts reference page for more information).&#60;br /&#62;
they can act and react on rising or falling or changing clock, that sounds like spi.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1599</link>
			<pubDate>Mon, 04 Oct 2010 23:43:56 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">1599@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I don't have an example, and I may not be able to give you for a while, however, I can point you to the pages in the reference manual if that helps.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>DaemonMaker on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1598</link>
			<pubDate>Mon, 04 Oct 2010 19:40:57 +0000</pubDate>
			<dc:creator>DaemonMaker</dc:creator>
			<guid isPermaLink="false">1598@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Crenn:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
Slave SPI is possible with the Maple, however it requires a manual setup.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;I have been trying to do this but I'm new to the Cortex family of processors. Do you by chance have an example of how to do this?&#60;/p&#62;
&#60;p&#62;TIA,&#60;br /&#62;
Dustin
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1593</link>
			<pubDate>Mon, 04 Oct 2010 17:57:52 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">1593@http://forums.leaflabs.com/</guid>
			<description>&#60;blockquote&#62;&#60;p&#62;n 1 unit8 spaces? well both point first to a arrays pointer or something you have to put a &#38;amp; infront of it was what I was saying. temp was just something I used to store the size of the array but said to be a 32 bit pointer.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;As in when you declared the array.&#60;/p&#62;
&#60;p&#62;&#60;code&#62;uint8 n[1];&#60;/code&#62;&#60;br /&#62;
compared to:&#60;br /&#62;
&#60;code&#62;uint8 n[2];&#60;/code&#62;&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;Oh I was working with port 1 the whole time so port 2 I would have to define in the begining but don't think I can work with both that is proably why it would compile for eather.&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;You can use both, they're both hardware implementations of SPI.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josheeg on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1590</link>
			<pubDate>Mon, 04 Oct 2010 17:05:05 +0000</pubDate>
			<dc:creator>josheeg</dc:creator>
			<guid isPermaLink="false">1590@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Oh I was working with port 1 the whole time so port 2 I would have to define in the begining but don't think I can work with both that is proably why it would compile for eather.&#60;/p&#62;
&#60;p&#62;n 1 unit8 spaces? well both point first to a arrays pointer or something you have to put a &#38;amp; infront of it was what I was saying. temp was just something I used to store the size of the array but said to be a 32 bit pointer.&#60;/p&#62;
&#60;p&#62;I didn't try any code I just compiled it.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1588</link>
			<pubDate>Mon, 04 Oct 2010 15:51:55 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">1588@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;SPI port 1 is faster than port 2, and to maintain the speed of 18MHz GPIO, they've limited it using the dividers.&#60;/p&#62;
&#60;p&#62;I'm surprised the code worked since you were assigning n 1 unit8 spaces, I assigned it to 2 and it compiled fine with my line of code.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josheeg on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1587</link>
			<pubDate>Mon, 04 Oct 2010 15:11:18 +0000</pubDate>
			<dc:creator>josheeg</dc:creator>
			<guid isPermaLink="false">1587@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;SPI_281_250KHZ added in compiles but at a lower frequency. So your saying SPI port 1 is less than the max speed of port 2. Also this is not in the maple documentation? &#60;/p&#62;
&#60;p&#62;A loop back is done &#34;by just connecting MOSI to MISO.&#34; Ok got that.&#60;/p&#62;
&#60;p&#62;So to get eatch byte send indivigual bytes.&#60;/p&#62;
&#60;p&#62;Otherwise if I use a array it will send a series of bytes starting at n[0] to n[N]&#60;br /&#62;
returning the last thing back on the SPI port.&#60;/p&#62;
&#60;p&#62;This does not compile:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;&#60;br /&#62;
You can just use:&#60;br /&#62;
o=Spi.send(n, temp);&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;This does I need a &#38;amp;n for some reason it wants &#38;amp;n should I initilise it differently or use n differently? &#38;amp;n[0] also works should that be the begining or the end of the string I should pass in?&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;&#60;/p&#62;
&#60;p&#62;temp=sizeof(n);&#60;br /&#62;
o=Spi.send(&#38;amp;n, temp);&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;&#60;/blockquote&#62;</description>
		</item>
		<item>
			<title>crenn on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1584</link>
			<pubDate>Mon, 04 Oct 2010 14:23:00 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">1584@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;The documentation doesn't mention it, but the library does! You can either uses SPI port 2 or change:&#60;br /&#62;
&#60;code&#62;Spi.begin(SPI_140_625KHZ , MSBFIRST, 0);&#60;/code&#62;&#60;br /&#62;
to&#60;br /&#62;
&#60;code&#62;Spi.begin(SPI_281_250KHZ , MSBFIRST, 0);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;You can create a loop back purely by just connecting MOSI to MISO.&#60;/p&#62;
&#60;p&#62;Slave SPI is possible with the Maple, however it requires a manual setup.&#60;/p&#62;
&#60;p&#62;You can just use:&#60;br /&#62;
&#60;code&#62;o=Spi.send(n, temp);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;But as you might know, it only returns the last byte, however, if you send each byte separate, you can get each byte back. It's also possible to modify the library, however I'll leave that for the LeafLabs team if they wish to do that.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josheeg on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1583</link>
			<pubDate>Mon, 04 Oct 2010 13:44:45 +0000</pubDate>
			<dc:creator>josheeg</dc:creator>
			<guid isPermaLink="false">1583@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I do not know where documentation says what you said how would I do that?&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;
For use of SPI, you need to run port 1 faster than the minimum speed.
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;So I could not create a loopback? on the same port miso to mosi?&#60;/p&#62;
&#60;p&#62;I agree it seems the maple seems to only be able to be master.&#60;/p&#62;
&#60;p&#62;It looks like after me trying to get the code to work it reads when it writes.&#60;/p&#62;
&#60;p&#62;but also it requires uint8 data types that are not colored. I like them better because I know what size data I am working with at least.&#60;/p&#62;
&#60;p&#62;The code seems to return one byte and send a array so I would send a array with 1 element to get one thing back? Also it seems to want a array of uint8 's but wants it in the format of &#34; o=Spi.send(&#38;amp;n[0], temp);&#34;&#60;/p&#62;
&#60;p&#62;The &#38;amp; sign confuses me so it gets the address of the array element zero so would return one character?&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;&#60;br /&#62;
//hello world with a SPI loop back twist&#60;/p&#62;
&#60;p&#62;//this has to be added at the top above setup&#60;br /&#62;
HardwareSPI Spi(1);&#60;/p&#62;
&#60;p&#62;uint8 n[1];&#60;br /&#62;
uint32 temp=0;&#60;br /&#62;
uint8 o=0;&#60;/p&#62;
&#60;p&#62;void setup() {&#60;/p&#62;
&#60;p&#62;Spi.begin(SPI_140_625KHZ , MSBFIRST, 0);&#60;br /&#62;
n[0]=255;&#60;br /&#62;
n[1]=1;&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
  SerialUSB.println(&#34;Hello World!&#34;);&#60;/p&#62;
&#60;p&#62;temp=sizeof(n);&#60;/p&#62;
&#60;p&#62;o=Spi.send(&#38;amp;n[0], temp);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;&#60;/code&#62;&#60;/blockquote&#62;
&#60;/code&#62;&#60;/p&#62;&#60;/blockquote&#62;</description>
		</item>
		<item>
			<title>crenn on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1582</link>
			<pubDate>Mon, 04 Oct 2010 13:21:30 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">1582@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;For use of SPI, you need to run port 1 faster than the minimum speed.&#60;/p&#62;
&#60;p&#62;An example of using SPI can be found here:&#60;br /&#62;
&#60;a href=&#34;http://www.crennsmind.com/Code/Maple/SPI/ADXL345-Code_Current_SPI1.txt&#34; rel=&#34;nofollow&#34;&#62;http://www.crennsmind.com/Code/Maple/SPI/ADXL345-Code_Current_SPI1.txt&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;EDIT: Also note the SPI library only supports Master mode.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josheeg on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1581</link>
			<pubDate>Mon, 04 Oct 2010 12:43:47 +0000</pubDate>
			<dc:creator>josheeg</dc:creator>
			<guid isPermaLink="false">1581@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I tried the same code as above using Spi.send(data, size()&#60;/p&#62;
&#60;p&#62;as shown on the leaflabs website.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;`&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;//hello world with a SPI loop back twist&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;char n=255;&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;void setup() {&#38;lt;br /&#38;gt;&#60;br /&#62;
HardwareSPI Spi(1);&#38;lt;br /&#38;gt;&#60;br /&#62;
Spi.begin(SPI_140_625KHZ , MSBFIRST, 0);&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;}&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;void loop() {&#38;lt;br /&#38;gt;&#60;br /&#62;
  SerialUSB.println(&#34;Hello World!&#34;);&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;Spi.send(n, size(n));&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;}&#38;lt;/p&#38;gt;&#60;br /&#62;
&#38;lt;p&#38;gt;`
&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;How does this function return characters? the other spi program&#60;br /&#62;
n=spi.....&#60;/p&#62;
&#60;p&#62;that returns something when it writes something.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>josheeg on "SPI Loopback on maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=220#post-1580</link>
			<pubDate>Mon, 04 Oct 2010 12:32:28 +0000</pubDate>
			<dc:creator>josheeg</dc:creator>
			<guid isPermaLink="false">1580@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I am getting a error:&#60;br /&#62;
error: 'SPI' was not declared in this scope&#60;/p&#62;
&#60;p&#62;Here is the example I am trying to wire together from the documentation.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;&#60;/p&#62;
&#60;p&#62;//hello world with a SPI loop back twist&#60;/p&#62;
&#60;p&#62;char n=255;&#60;/p&#62;
&#60;p&#62;void setup() {&#60;br /&#62;
HardwareSPI Spi(1);&#60;br /&#62;
Spi.begin(SPI_140_625KHZ , MSBFIRST, 0);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
  SerialUSB.println(&#34;Hello World!&#34;);&#60;/p&#62;
&#60;p&#62;  n = Spi.transfer(0x2A);            // sends the byte 0x2A&#60;br /&#62;
	                           // and returns the byte received&#60;/p&#62;
&#60;p&#62;n = Spi.transfer(0x2A, 2);         // waits 2 usec, then sends the byte 0x2A&#60;br /&#62;
                                   // and returns the byte received&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;&#60;/code&#62;&#60;/p&#62;&#60;/blockquote&#62;</description>
		</item>

	</channel>
</rss>
