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

		<item>
			<title>crenn on "SPI pins and setup?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=10232#post-22326</link>
			<pubDate>Sat, 09 Feb 2013 04:40:13 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">22326@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;The number you pass the constructor for HardwareSPI related to the SPI port you are using since the Maple has 2. You have to set up a chip select pin by yourself, there is one for each SPI port, but it is not driven automatically. Here's a bit of example code:&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;HardwareSPI spi(1);&#60;/p&#62;
&#60;p&#62;void setup() {&#60;br /&#62;
  spi.begin(SPI_1_125MHZ, MSBFIRST, 0);&#60;br /&#62;
  pinMode(10, OUTPUT);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop(){&#60;br /&#62;
  digitalWrite(10, LOW);&#60;br /&#62;
  spi.transfer(0x00);&#60;br /&#62;
  digitalWrite(10, HIGH);&#60;br /&#62;
  delay(500);&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;This code sets up the SPI port on port 1, setting it to 1.125MHz (see &#60;a href=&#34;http://leaflabs.com/docs/lang/api/hardwarespi.html#lang-hardwarespi&#34;&#62;HardwareSPI documentation&#60;/a&#62; for other speeds), Most Significant bit first, and mode 0 (which defines when to take samples and the clock polarity).&#60;br /&#62;
It also sets the CS pin as an output in this case D10. The loop set the CS line low (which usually selects the SPI device you wish to communicate with) and then transmits a single byte before setting the CS line to high and waiting 500ms before delaying again.&#60;/p&#62;
&#60;p&#62;Hope that helps!
&#60;/p&#62;</description>
		</item>
		<item>
			<title>flyingsilverfin on "SPI pins and setup?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=10232#post-22325</link>
			<pubDate>Sat, 09 Feb 2013 00:34:04 +0000</pubDate>
			<dc:creator>flyingsilverfin</dc:creator>
			<guid isPermaLink="false">22325@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Oops sorry, i just found the pin map for the Maple. D11 for MOSI, D12 for MISO, and D13 for clock.&#60;br /&#62;
NSS is negative chip select... but Im now guessing i can choose whatever pin i want for chip select with HardwareSPI spi(#)?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>flyingsilverfin on "SPI pins and setup?"</title>
			<link>http://forums.leaflabs.com/topic.php?id=10232#post-22324</link>
			<pubDate>Sat, 09 Feb 2013 00:29:37 +0000</pubDate>
			<dc:creator>flyingsilverfin</dc:creator>
			<guid isPermaLink="false">22324@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I feel a little silly for asking this question. I'm still finding the differences between the Arduino and the Maple; I need to use the SPI library to communicate with an ADC. I looked at the HardwareSPI reference, but I don't so much need help with the software as with the hardware (although i'm not sure exactly what I'm missing).&#60;br /&#62;
On the Arduino, I had set up one chip select pin, and there were preset pins listed in the reference for clock and data in and data out. Looking at the HardwareSPI reference I'm a little confused because I don't know which pins to use for chip select, clock, MOSI and MISO... is there more reference material I missed somewhere? Also, when I start the program with HardwareSPI spi(1), port one is then the chip select, the clock, or a data pin? Sorry if i'm missing something obvious...
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
