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

		<item>
			<title>gbulmer on "Flymaple_SPI"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74452#post-105778</link>
			<pubDate>Thu, 03 Sep 2015 13:07:02 +0000</pubDate>
			<dc:creator>gbulmer</dc:creator>
			<guid isPermaLink="false">105778@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@cherigo - Welcome to the forum.&#60;/p&#62;
&#60;p&#62;Would you please confirm that this &#60;a href=&#34;http://www.lsicsi.com/pdfs/Data_Sheets/LS7366R.pdf&#34;&#62;LS7366R&#60;/a&#62; is the device?&#60;/p&#62;
&#60;p&#62;What exactly do you mean by &#34;not working&#34;?&#60;/p&#62;
&#60;p&#62;At first glance, the code looks okay.  Have you access to an oscilloscope to see that the signal matches the Arduino's?&#60;/p&#62;
&#60;p&#62;I would try to make it behave as closely as reasonable to the arduino code, so I might change the SPI speed in&#60;br /&#62;
&#60;code&#62;spi.begin(SPI_18MHZ, MSBFIRST, 0);&#60;/code&#62;&#60;br /&#62;
to&#60;br /&#62;
&#60;code&#62;spi.begin(SPI_4_5MHZ, MSBFIRST, 0);&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;Have you got access to an easy to use device to test the SPI? For example a 74HC595 SIPO shift-register. They are reasonably low-cost (about $2 for 5)&#60;/p&#62;
&#60;p&#62;There is an example of how to drive that 74HC595 using software &#60;a href=&#34;http://static.leaflabs.com/pub/leaflabs/maple-docs/latest/lang/api/shiftout.html&#34;&#62;here&#60;/a&#62;.&#60;br /&#62;
It should be easy to monitor it working by putting a few LEDs on its output pins.&#60;/p&#62;
&#60;p&#62;(Full disclosure: I am not a member of LeafLabs staff.)
&#60;/p&#62;</description>
		</item>
		<item>
			<title>cherigo on "Flymaple_SPI"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74452#post-105777</link>
			<pubDate>Wed, 02 Sep 2015 21:24:56 +0000</pubDate>
			<dc:creator>cherigo</dc:creator>
			<guid isPermaLink="false">105777@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;hi guys i am new in this forum my question is the next :&#60;br /&#62;
i have a flymaple that i am trying connect to a quadrature counter LS7366R the code for do this is available in arduino. the communication is spi; between the maple and the counter but i not sure how work the SPI library in maple&#60;/p&#62;
&#60;p&#62;ARDUINO CODE&#60;br /&#62;
#include &#38;lt;SPI.h&#38;gt;&#60;br /&#62;
//#include &#38;lt;Arduino.h&#38;gt;&#60;/p&#62;
&#60;p&#62;#define CLR B00000000&#60;br /&#62;
#define RD B01000000&#60;br /&#62;
#define WR B10000000&#60;br /&#62;
#define LOAD B11000000&#60;/p&#62;
&#60;p&#62;#define MDR0 B00001000&#60;br /&#62;
#define MDR1 B00010000&#60;br /&#62;
#define DTR B00011000&#60;br /&#62;
#define CNTR B00100000&#60;br /&#62;
#define OTR B00101000&#60;br /&#62;
#define STR B00110000&#60;/p&#62;
&#60;p&#62;// filter factor 1&#60;br /&#62;
// async index&#60;br /&#62;
// no index&#60;br /&#62;
// free-running&#60;br /&#62;
// 4x quadrature&#60;br /&#62;
#define MDR0_CONF B00000011&#60;/p&#62;
&#60;p&#62;// no flag&#60;br /&#62;
// enabled&#60;br /&#62;
// 32 bits&#60;br /&#62;
#define MDR1_CONF B00000000&#60;/p&#62;
&#60;p&#62;void setup() {&#60;br /&#62;
  Serial.begin(9600);&#60;br /&#62;
  SPI.begin();&#60;br /&#62;
  pinMode(SS, OUTPUT);&#60;/p&#62;
&#60;p&#62;  digitalWrite(SS, LOW);&#60;br /&#62;
  SPI.transfer(WR &#124; MDR0);&#60;br /&#62;
  SPI.transfer(MDR0_CONF);&#60;br /&#62;
  digitalWrite(SS, HIGH);&#60;/p&#62;
&#60;p&#62;  digitalWrite(SS, LOW);&#60;br /&#62;
  SPI.transfer(WR &#124; MDR1);&#60;br /&#62;
  SPI.transfer(MDR1_CONF);&#60;br /&#62;
  digitalWrite(SS, HIGH);&#60;/p&#62;
&#60;p&#62;  digitalWrite(SS, LOW);&#60;br /&#62;
  SPI.transfer(CLR &#124; CNTR);&#60;br /&#62;
  digitalWrite(SS, HIGH);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;long count = 0;&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
  digitalWrite(SS, LOW);&#60;br /&#62;
  byte b = SPI.transfer((byte) RD &#124; CNTR);&#60;br /&#62;
  count = SPI.transfer(0x00);&#60;br /&#62;
  count &#38;lt;&#38;lt;= 8;&#60;br /&#62;
  count &#124;= SPI.transfer(0x00);&#60;br /&#62;
  count &#38;lt;&#38;lt;= 8;&#60;br /&#62;
  count &#124;= SPI.transfer(0x00);&#60;br /&#62;
  count &#38;lt;&#38;lt;= 8;&#60;br /&#62;
  count &#124;= SPI.transfer(0x00);&#60;br /&#62;
  count = count*0.351;&#60;br /&#62;
  digitalWrite(SS, HIGH);&#60;br /&#62;
  Serial.print(count);&#60;br /&#62;
  Serial.println();&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;//////////////////////////////////////////////////////////////////////&#60;br /&#62;
 i suppose that  is the way to do  in flymaple board  but not working&#60;/p&#62;
&#60;p&#62;#include &#38;lt;spi.h&#38;gt;&#60;/p&#62;
&#60;p&#62;#define CLR 0x00&#60;br /&#62;
#define RD 0x40&#60;br /&#62;
#define WR 0x80&#60;br /&#62;
#define LOAD 0xC0&#60;/p&#62;
&#60;p&#62;#define MDR0 0x08&#60;br /&#62;
#define MDR1 0x10&#60;br /&#62;
#define DTR 0x18&#60;br /&#62;
#define CNTR 0x20&#60;br /&#62;
#define OTR 0x28&#60;br /&#62;
#define STR 0x30&#60;/p&#62;
&#60;p&#62;// filter factor 1&#60;br /&#62;
// async index&#60;br /&#62;
// no index&#60;br /&#62;
// free-running&#60;br /&#62;
// 4x quadrature&#60;br /&#62;
#define MDR0_CONF 0x03&#60;/p&#62;
&#60;p&#62;// no flag&#60;br /&#62;
// enabled&#60;br /&#62;
// 32 bits&#60;br /&#62;
#define MDR1_CONF 0x00&#60;/p&#62;
&#60;p&#62;HardwareSPI spi(2);&#60;/p&#62;
&#60;p&#62;void setup() {&#60;br /&#62;
  spi.begin(SPI_18MHZ, MSBFIRST, 0);&#60;br /&#62;
  SerialUSB.begin();&#60;br /&#62;
   pinMode(D31, OUTPUT);&#60;/p&#62;
&#60;p&#62;  digitalWrite(D31, LOW);&#60;br /&#62;
  spi.transfer(WR &#124; MDR0);&#60;br /&#62;
  spi.transfer(MDR0_CONF);&#60;br /&#62;
  digitalWrite(D31, HIGH);&#60;/p&#62;
&#60;p&#62;  digitalWrite(D31, LOW);&#60;br /&#62;
  spi.transfer(WR &#124; MDR1);&#60;br /&#62;
  spi.transfer(MDR1_CONF);&#60;br /&#62;
  digitalWrite(D31, HIGH);&#60;/p&#62;
&#60;p&#62;  digitalWrite(D31, LOW);&#60;br /&#62;
  spi.transfer(CLR &#124; CNTR);&#60;br /&#62;
  digitalWrite(D31, HIGH);&#60;/p&#62;
&#60;p&#62;}&#60;/p&#62;
&#60;p&#62;long count = 0;&#60;/p&#62;
&#60;p&#62;void loop() {&#60;br /&#62;
  digitalWrite(D31, LOW);&#60;br /&#62;
  byte b = spi.transfer( RD &#124; CNTR);&#60;br /&#62;
  count = spi.transfer(0x00);&#60;br /&#62;
  count &#38;lt;&#38;lt;= 8;&#60;br /&#62;
  count &#124;= spi.transfer(0x00);&#60;br /&#62;
  count &#38;lt;&#38;lt;= 8;&#60;br /&#62;
  count &#124;= spi.transfer(0x00);&#60;br /&#62;
  count &#38;lt;&#38;lt;= 8;&#60;br /&#62;
  count &#124;= spi.transfer(0x00);&#60;br /&#62;
  count = count*0.351;&#60;br /&#62;
  digitalWrite(D31, HIGH);&#60;/p&#62;
&#60;p&#62;  SerialUSB.print(count);&#60;br /&#62;
  SerialUSB.println();&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;please  please help
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
