<?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: Problem with porting I2C from Arduino to Maple</title>
		<link>http://forums.leaflabs.com/topic.php?id=74407</link>
		<description>A place to share, learn, and grow...</description>
		<language>en-US</language>
		<pubDate>Fri, 22 Jan 2016 00:05:14 +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=74407" rel="self" type="application/rss+xml" />

		<item>
			<title>rogerclark on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105660</link>
			<pubDate>Fri, 20 Feb 2015 20:43:04 +0000</pubDate>
			<dc:creator>rogerclark</dc:creator>
			<guid isPermaLink="false">105660@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;@samtal&#60;/p&#62;
&#60;p&#62;I think if you posted to the Arduino forum &#60;a href=&#34;http://forum.arduino.cc/index.php?topic=265904.new#new&#34; rel=&#34;nofollow&#34;&#62;http://forum.arduino.cc/index.php?topic=265904.new#new&#60;/a&#62; you could probably find a solution to your problem&#60;/p&#62;
&#60;p&#62;People are using I2C a lot with maple mini and making fixes all the time&#60;/p&#62;
&#60;p&#62;Shame to abandon such a good product.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>bobc on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105649</link>
			<pubDate>Tue, 03 Feb 2015 15:11:04 +0000</pubDate>
			<dc:creator>bobc</dc:creator>
			<guid isPermaLink="false">105649@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;I don't know if it is discontinued, but absent a declaration of &#34;end of life&#34;, official Maple seems to be effectively abandoned. Sparkfun are still stocking Maple boards, so I guess LeafLabs will continue making them while there are sales, but they do not see it as a growth market.&#60;/p&#62;
&#60;p&#62;Meanwhile Maple seems to be having a little renaissance with the cheap Chinese clones available on ebay and elsewhere. The official Maples do not seem to be good value for money, but at $5 for a Maple mini clone that is a pretty good price.&#60;/p&#62;
&#60;p&#62;Fixing up libmaple to work under the latest Arduino IDE and fixing some of the outstanding bugs, plus cheaper hardware, are possibly the only things that are needed to keep Maple going, but I think LeafLabs are completely focused elsewhere now.&#60;/p&#62;
&#60;p&#62;&#34;has probably become commercial&#34;&#60;/p&#62;
&#60;p&#62;I really don't understand what you mean by that.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105648</link>
			<pubDate>Tue, 03 Feb 2015 01:14:17 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">105648@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks roger for your help.&#60;br /&#62;
After several attempts and tests, wasting hours, I decided to abandon the Maple and continue with the Arduino, (giving up the very important 12 bit AtoD and fast cpu).&#60;br /&#62;
Unfortunately, I could not get the I2C to unconditionally work on the Maple all the times.&#60;/p&#62;
&#60;p&#62;I came back to the Maple after 2-3 years, and I have the feeling that the Maple is a discontinued project, and has probably become commercial.&#60;br /&#62;
Am I right in my observation? Can anyone comment on that?&#60;br /&#62;
samtal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rogerclark on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105639</link>
			<pubDate>Sun, 25 Jan 2015 17:08:06 +0000</pubDate>
			<dc:creator>rogerclark</dc:creator>
			<guid isPermaLink="false">105639@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;&#34;Do you mean I can use the Arduino IDE 1.6 to directly upload the maple R5, and expect the Arduino included libraries to support my ST32 maple?&#34;&#60;/p&#62;
&#60;p&#62;Yes.&#60;/p&#62;
&#60;p&#62;Arduino 1.6 will directly upload to The Maple and Maple Mini. I'm not sure if anyone has specifically tested with the R5, I have a iTead Maple which seems to be an enhancement on the last Maple that LeafLabs designed, and it works fine with that.&#60;/p&#62;
&#60;p&#62;I2C works, but has only been tested on a few devices e.g BMP085 barometers and MPU9150 motion sensor, but should work with most things&#60;/p&#62;
&#60;p&#62;See &#60;a href=&#34;http://forum.arduino.cc/index.php?topic=265904.0&#34; rel=&#34;nofollow&#34;&#62;http://forum.arduino.cc/index.php?topic=265904.0&#60;/a&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105630</link>
			<pubDate>Sun, 18 Jan 2015 05:55:29 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">105630@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hello Crenn,&#60;br /&#62;
Thanks for your reply.&#60;br /&#62;
I am still struggling with the Maple I2C, while the Arduino works smooth with the same device.&#60;br /&#62;
I currently us the 4 library files:  Wire.h, Wire.cpp, WireBase.h and WireBase.cpp (and naturally also the I2C which comes with the maple anyhow.&#60;br /&#62;
I was not aware of the HardWire.h. I want to try it out. Where can I get it, and which headers do I still need to have available?&#60;/p&#62;
&#60;p&#62;I use the ST32 I2C2 pins which are maple 29(scl) and 30(sda).&#60;br /&#62;
Added 2.5k pull-ups to 5V (5V is required by the device)&#60;br /&#62;
For that, I changed the pin numbers in the Wire.h (#define SDA 29 , #define SCL 30)&#60;br /&#62;
I also changed the speed to match the device 100kHz by #define SOFT_STANDARD 18 (rather than 25).&#60;/p&#62;
&#60;p&#62;I wrote a small test program (snippet from my large program) and use it to compare Arduino vs. Maple. No need to add that the Arduino runs fine and stable.&#60;/p&#62;
&#60;p&#62;Tested some delays of 50mSec between various command for no avail.&#60;/p&#62;
&#60;p&#62;I used oscilloscope to check the signals. All look normal, except for somewhat inaccurate and jittering Maple timing. &#60;/p&#62;
&#60;p&#62;Can you please help by modifying my sample code to meet your modifications?&#60;/p&#62;
&#60;p&#62;samtal&#60;/p&#62;
&#60;p&#62;Here is my test code, with the bad serial output at the bottom: &#60;/p&#62;
&#60;p&#62;#include &#38;lt;Wire.h&#38;gt;&#60;/p&#62;
&#60;p&#62;static uint8 device_address = 0x54;&#60;br /&#62;
uint8 data_address;&#60;br /&#62;
uint8 data_size;&#60;/p&#62;
&#60;p&#62;void setup()&#60;br /&#62;
{&#60;br /&#62;
  Serial2.begin(115200);&#60;br /&#62;
  data_address = 0x10;&#60;br /&#62;
  data_size = 0x10;&#60;/p&#62;
&#60;p&#62;  Wire.begin();&#60;br /&#62;
  delay(100);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop()&#60;br /&#62;
{&#60;br /&#62;
  read_device_params(device_address, data_address, data_size);&#60;br /&#62;
  delay(1000);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void read_device_params(uint8 device_address, uint8 data_address, uint8 data_size)&#60;br /&#62;
{&#60;br /&#62;
  Wire.beginTransmission(device_address);&#60;br /&#62;
  Wire.send(data_address);&#60;br /&#62;
  Wire.endTransmission();&#60;br /&#62;
  Wire.requestFrom(device_address, data_size);&#60;/p&#62;
&#60;p&#62;  while(Wire.available() &#38;gt; 0)&#60;br /&#62;
  {&#60;br /&#62;
    char c = Wire.receive();	 // receive a uint8 as character&#60;br /&#62;
    Serial2.print(c);         // print the character&#60;br /&#62;
  }&#60;/p&#62;
&#60;p&#62;  Serial2.println();&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;/*  The outcome: (Should be AE-1500,         (That's AE-1500, + spaces, total 16 bytes).&#60;br /&#62;
 ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ&#60;br /&#62;
AE-1500,&#60;br /&#62;
AE-1500,&#60;br /&#62;
AE-1500,&#60;br /&#62;
AE-1500,&#60;br /&#62;
AE-1500,&#60;br /&#62;
5V0133411232014S  (This comes in the device at the next address)&#60;br /&#62;
AE-1500,  ÿÿÿÿÿ&#60;br /&#62;
AE-1500,       &#60;br /&#62;
AE-1500,  ÿÿÿÿÿ&#60;br /&#62;
AE-1500,&#60;br /&#62;
5V0133411232014S&#60;br /&#62;
AÅ-1500,       &#60;br /&#62;
5V0133411232014S&#60;br /&#62;
AE-150˜ÿÿÿÿÿÿÿÿÿ&#60;br /&#62;
        15V01334&#60;br /&#62;
AE-1500,&#60;br /&#62;
5V0133411232014S&#60;br /&#62;
AE-1500,&#60;br /&#62;
*/
&#60;/p&#62;</description>
		</item>
		<item>
			<title>crenn on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105629</link>
			<pubDate>Fri, 16 Jan 2015 21:47:21 +0000</pubDate>
			<dc:creator>crenn</dc:creator>
			<guid isPermaLink="false">105629@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi samtal,&#60;/p&#62;
&#60;p&#62;Have you downloaded the other Wire library to use with the IDE? I'm the one who wrote the replacement, it's not a clean solution file wise but shouldn't be too hard to use. There is a base class used to make it like using the arduino Wire functions, then there is a 2 more clases, HardWire and Wire. Wire is essentially the same as what is currently included with the MapleIDE (bit banging I2C) just it uses the base class. HardWire uses the actual I2C peripherals included in the Maple's STM32F103 core. The setup is harder than using the Arduino (aka Just Wire.begin) but not too hard.&#60;/p&#62;
&#60;p&#62;Here's an example sketch using the HardWire on port 1.&#60;/p&#62;
&#60;blockquote&#62;&#60;p&#62;&#60;code&#62;#include &#38;lt;HardWire.h&#38;gt;&#60;/p&#62;
&#60;p&#62;HardWire port(1);&#60;/p&#62;
&#60;p&#62;#define ADDR       0x20&#60;/p&#62;
&#60;p&#62;// MCP23x18 Registers&#60;br /&#62;
#define PORTA_MASK 0x00&#60;br /&#62;
#define PORTB_MASK 0x01&#60;br /&#62;
#define IODIR      0x00&#60;br /&#62;
#define IPOL       0x02&#60;br /&#62;
#define GPINTEN    0x04&#60;br /&#62;
#define DEFVAL     0x06&#60;br /&#62;
#define INTCON     0x08&#60;br /&#62;
#define IOCON      0x0A&#60;br /&#62;
#define GPPU       0x0C&#60;br /&#62;
#define INTF       0x0E&#60;br /&#62;
#define INTCAP     0x10&#60;br /&#62;
#define GPIO       0x12&#60;br /&#62;
#define OLAT       0x14&#60;/p&#62;
&#60;p&#62;void writeMCP(byte reg, byte data) {&#60;br /&#62;
  port.beginTransmission(ADDR);&#60;br /&#62;
  port.send(reg);&#60;br /&#62;
  port.send(data);&#60;br /&#62;
  port.endTransmission();&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void dualwriteMCP(byte reg, byte portA, byte portB) {&#60;br /&#62;
  port.beginTransmission(ADDR);&#60;br /&#62;
  port.send(reg);&#60;br /&#62;
  port.send(portA);&#60;br /&#62;
  port.send(portB);&#60;br /&#62;
  port.endTransmission();&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void setup(void) {&#60;br /&#62;
  port.begin();&#60;br /&#62;
  pinMode(21, OUTPUT);&#60;br /&#62;
  digitalWrite(21, LOW);&#60;br /&#62;
  digitalWrite(21, HIGH);&#60;br /&#62;
  delayMicroseconds(500);&#60;br /&#62;
  writeMCP(IOCON, 0x20);&#60;br /&#62;
  dualwriteMCP((PORTA_MASK&#124;IODIR), 0x00, 0x00);&#60;br /&#62;
  dualwriteMCP((PORTA_MASK&#124;GPPU), 0xFF, 0xFF);&#60;br /&#62;
}&#60;/p&#62;
&#60;p&#62;void loop(void) {&#60;br /&#62;
  static byte val = 0x01;&#60;br /&#62;
  writeMCP((PORTA_MASK&#124;GPIO), (~val));&#60;br /&#62;
  delay(100);&#60;br /&#62;
  val &#38;lt;&#38;lt;= 1;&#60;br /&#62;
  if((val &#38;amp; 0x20) != 0) {&#60;br /&#62;
    val &#124;= 0x01;&#60;br /&#62;
  }&#60;br /&#62;
}&#60;/code&#62;&#60;/p&#62;&#60;/blockquote&#62;
&#60;p&#62;-crenn
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105622</link>
			<pubDate>Tue, 13 Jan 2015 11:08:19 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">105622@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Thanks rogerclark.&#60;br /&#62;
I was very close to giving up.&#60;br /&#62;
The maple I2C seems to have been modified too many times with too many hands involved, to become a monster with files over files.&#60;br /&#62;
I have been wasting hours, including signal analysis (scope and logic analyzer), to come to the conclusion that whatever I do, I can not get it reliable enough.&#60;br /&#62;
The timing is unreliable, especially at start.&#60;br /&#62;
I will give your input additional time with the hope it will work, but I want to make sure I understand your input:&#60;br /&#62;
Do you mean I can use the Arduino IDE 1.6 to directly upload the maple R5, and expect the Arduino included libraries to support my ST32 maple?&#60;br /&#62;
If Yes I will gladly try it.&#60;br /&#62;
samtal
&#60;/p&#62;</description>
		</item>
		<item>
			<title>rogerclark on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105621</link>
			<pubDate>Mon, 12 Jan 2015 16:37:01 +0000</pubDate>
			<dc:creator>rogerclark</dc:creator>
			<guid isPermaLink="false">105621@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;You may want to consider using the official Arduino 1.6.rc IDE and the set of files I host on GitHub  see &#60;a href=&#34;https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki&#34; rel=&#34;nofollow&#34;&#62;https://github.com/rogerclarkmelbourne/Arduino_STM32/wiki&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Here is a video I did of how to install &#60;/p&#62;
&#60;p&#62;&#60;a href=&#34;https://www.youtube.com/watch?v=-zwGnytGT8M&#34; rel=&#34;nofollow&#34;&#62;https://www.youtube.com/watch?v=-zwGnytGT8M&#60;/a&#62;&#60;/p&#62;
&#60;p&#62;Note. I was using Arduino 1.5.8 at the time, since then 1.6.rc1 has been published, see the links in the wiki&#60;/p&#62;
&#60;p&#62;I have tested I2C with 2 different devices and it seems to work fine.
&#60;/p&#62;</description>
		</item>
		<item>
			<title>samtal on "Problem with porting I2C from Arduino to Maple"</title>
			<link>http://forums.leaflabs.com/topic.php?id=74407#post-105616</link>
			<pubDate>Sat, 10 Jan 2015 07:33:55 +0000</pubDate>
			<dc:creator>samtal</dc:creator>
			<guid isPermaLink="false">105616@http://forums.leaflabs.com/</guid>
			<description>&#60;p&#62;Hi,&#60;br /&#62;
I ported my app from Arduino to Maple r5 (I need the 12-bit resolution).&#60;br /&#62;
While everything else works fine (following some minor changes for pin location), my I2C (that communicates with a programmable power-supply) does not work.&#60;br /&#62;
To be more precise: Occasionally, after reset, it will show few first characters as a reply for request from the device, but that's all).  &#60;/p&#62;
&#60;p&#62;Using oscilloscope, the signals look OK, similar to Arduino case. The frequency and voltages are within expected.&#60;br /&#62;
Here is what I already have tried:&#60;br /&#62;
1. Adjusted the I2C frequency to 100 Khz in the Wire.h file (as my device requires and as runs OK on Arduino).&#60;br /&#62;
2. Installed pull-up resistors (3.3K and using 5V, similar to the Arduino, ).&#60;br /&#62;
3. Tried many pins combinations (Modified the Wire.h): The native maple I2c (9,5 and 29,30) and several others.&#60;br /&#62;
They all work fine as seen with the scope, but no flow of data.&#60;br /&#62;
4. I naturally tested using the same cables and connectors, but for no avail.&#60;/p&#62;
&#60;p&#62;I remember to have seen an article (post in the forum?) that describe similar problem, but I can't find it, and to the best of my remembrance, there was no solution there.&#60;/p&#62;
&#60;p&#62;I'd appreciate any help to get my I2C run on Maple as it does on the Arduino.&#60;br /&#62;
thanks Samtal
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
